Skip to content

Enable WebGPU subgroup matrix path for WASM builds - #32269

Merged
Jiajia Qin (qjia7) merged 2 commits into
microsoft:mainfrom
jchen10:sgmm_wasm
Aug 28, 2026
Merged

Jiajia Qin (qjia7) merged 2 commits into
microsoft:mainfrom
jchen10:sgmm_wasm

Conversation

@jchen10

Copy link
Copy Markdown
Contributor

The subgroup-matrix code was compiled out of WASM builds via #if !defined(__wasm__) guards, because emdawnwebgpu did not expose the Dawn subgroup-matrix API.
Bump the Dawn dependency to v20260818.211311, which includes the needed support for the Dawn subgroup-matrix API in WASM builds.

Copilot AI balanced review requested due to automatic review settings August 26, 2026 01:31
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables subgroup-matrix acceleration for WebGPU WASM builds by removing WASM guards and updating Dawn.

Changes:

  • Enables subgroup-matrix feature discovery and shaders on WASM.
  • Enables optimized MatMul, Gemm, and quantized kernels.
  • Updates Dawn to v20260818.211311.

Reviewed changes

Copilot reviewed 18 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
webgpu_context.h Exposes subgroup configuration on WASM.
webgpu_context.cc Enables feature discovery and adapter configuration.
subgroup_matrix_tiling_selector.h/.cc Enables tiling selection on WASM.
intel_device_info.h/.cc Enables Intel device metadata on WASM.
shader_helper.cc Enables subgroup-matrix WGSL extensions.
subgroup_matrix_matmul.h/.cc Enables optimized MatMul implementation.
subgroup_matrix_gemm.h/.cc Enables optimized Gemm implementation.
subgroup_matrix_config.h/.cc Enables configuration validation.
matmul.cc Activates subgroup MatMul dispatch.
gemm.cc Activates subgroup Gemm dispatch.
compute_context.h Exposes subgroup configuration to kernels.
subgroup_matrix_matmul_nbits.h/.cc Enables quantized subgroup kernels.
matmul_nbits.cc Activates quantized subgroup dispatch.
matmul_nbits_qkv.cc Enables subgroup eligibility for QKV.
matmul_nbits_mlp.cc Enables subgroup eligibility for MLP.
cmake/deps.txt Updates the Dawn dependency.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread onnxruntime/core/providers/webgpu/webgpu_context.cc
Comment thread cmake/deps.txt
Remove the `#if !defined(__wasm__)` guards around the subgroup-matrix
MatMul/GEMM path, its Intel tiling selector, and the WGSL
`enable chromium_experimental_subgroup_matrix;` emission.

Bump Dawn to v20260818.211311, the first tag whose dawn.json tags the
subgroup-matrix API for emdawnwebgpu (CL 331255), so
AdapterPropertiesSubgroupMatrixConfigs and friends exist under
Emscripten.

That Dawn revision removes the subgroupMatrixLoad/Store overloads
taking a boolean `col_major`, so convert all 185 call sites across the
six core and contrib templates to the majorness template form
(`<T, row_major>` / `<col_major>`). Semantics are unchanged: majorness
selects the same index-to-memory mapping the boolean did.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 28 changed files in this pull request and generated no new comments.

The subgroup-matrix templates moved to Dawn's majorness template form,
which changes the generated output that
tools/python/wgsl_template/test/test_in_tree_smoke.py compares against
checked-in goldens, so InTreeTemplatesGoldenTest was failing in CI.

Regenerated with `UPDATE_WGSL_GOLDEN=1 python
wgsl_template/test/run_tests.py`.
@qjia7
Jiajia Qin (qjia7) merged commit 4f6af34 into microsoft:main Aug 28, 2026
90 checks passed
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