Skip to content

Fix WGSL runtime on WASM - #1619

Open
ArthurBrussee wants to merge 5 commits into
tracel-ai:mainfrom
ArthurBrussee:fix/webgpu-wasm-runtime
Open

ArthurBrussee wants to merge 5 commits into
tracel-ai:mainfrom
ArthurBrussee:fix/webgpu-wasm-runtime

Conversation

@ArthurBrussee

@ArthurBrussee ArthurBrussee commented Sep 6, 2026

Copy link
Copy Markdown
Contributor
  • retain WGSL operation interface registrations in WebAssembly binaries
  • request the WebGPU subgroups extension only for subgroup operations
  • skip synchronous throughput probes on WebAssembly, where client synchronization is unsupported

This makes Brush runnable again on WebGPU + WASM

@ArthurBrussee ArthurBrussee changed the title Fix WGSL runtime on WebAssembly Fix WGSL runtime on WASM Sep 6, 2026
@antimora
antimora requested a balanced review from Copilot September 7, 2026 02:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Direct subgroup builtin usage can still generate WGSL without the required subgroups enable directive.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes WGSL execution on WebAssembly by retaining operation interfaces, conditionally enabling subgroup support, and avoiding unsupported synchronous probes.

Changes:

  • Root WGSL operation registrations in WASM binaries.
  • Enable WGSL subgroups only for tagged plane operations.
  • Return Unsupported for throughput probes on WASM.
File summaries
File Description
compiler/wgsl/to_wgsl.rs Adds the WASM inventory-root macro.
compiler/wgsl/compiler.rs Invokes inventory roots during WASM compilation.
compiler/wgsl/ops/mod.rs Aggregates operation-module roots.
compiler/wgsl/ops/atomic.rs Roots atomic registrations.
compiler/wgsl/ops/bitwise.rs Roots bitwise registrations.
compiler/wgsl/ops/branch.rs Roots branch registrations.
compiler/wgsl/ops/cmp.rs Roots comparison registrations.
compiler/wgsl/ops/general.rs Roots general registrations.
compiler/wgsl/ops/math.rs Roots math registrations.
compiler/wgsl/ops/memory.rs Roots memory registrations.
compiler/wgsl/ops/plane.rs Roots plane registrations and tags subgroup operations.
compiler/wgsl/ops/sync.rs Roots synchronization registrations.
compiler/wgsl/ops/vector.rs Roots vector registrations.
throughput/base.rs Disables synchronous probes on WASM.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/cubecl-wgpu/src/compiler/wgsl/ops/plane.rs
Comment thread crates/cubecl-std/src/throughput/base.rs
@ArthurBrussee
ArthurBrussee force-pushed the fix/webgpu-wasm-runtime branch from b563e28 to 828bb56 Compare September 8, 2026 20:14
};
}

requires_subgroups!(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler now does't work when we pass enable subgroups on wgpu native for all plane ops.

if let Some(builtin) = op.get_arg_attr::<BuiltInAttr>(ctx, i, &ATTR_BUILTIN)
&& matches!(
builtin.0,
BuiltIn::SubgroupSize | BuiltIn::SubgroupId | BuiltIn::SubgroupInvocationId

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are availalbe even if plane ops aren't I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants