Skip to content

Implement WebGPU subgroup-size-control infrastructure - #32056

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

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

Conversation

@jchen10

Copy link
Copy Markdown
Contributor

Add support for the WebGPU subgroup-size-control extension, which allows compute pipelines to request a fixed subgroup size via WGSL @subgroup_size(N) attribute. As an example, the MatMulNBits kernel has been enforced to use a subgroup size of 32 on Intel.

Add support for the WebGPU subgroup-size-control extension, which allows
compute pipelines to request a fixed subgroup size via WGSL @subgroup_size(N)
attribute. As an example, the MatMulNBits kernel has been enforced to use
a subgroup size of 32 on Intel.
@azure-pipelines

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

@jchen10
Jie Chen (jchen10) marked this pull request as draft August 13, 2026 05:52
@jchen10

Copy link
Copy Markdown
Contributor Author

Jiawei Shao (@Jiawei-Shao) PTAL

@jchen10
Jie Chen (jchen10) marked this pull request as ready for review August 14, 2026 01:11
@azure-pipelines

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

@jchen10

Copy link
Copy Markdown
Contributor Author

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

This PR adds support in the WebGPU EP for the subgroup-size-control feature so WGSL compute entry points can request a fixed subgroup size via @subgroup_size(N), and wires that through program configuration, shader generation, and cache keys. It also applies the new capability to enforce subgroup size 32 for the WebGPU MatMulNBits subgroup-matrix path on Intel adapters.

Changes:

  • Request wgpu::FeatureName::SubgroupSizeControl during device creation when available.
  • Add ProgramBase::SetSubgroupSize() / SubgroupSize() and include subgroup size in shader generation (enable subgroup_size_control; + @subgroup_size(...)) and the program cache key.
  • Apply Intel-specific subgroup size 32 selection in subgroup_matrix_matmul_nbits.

Reviewed changes

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

Show a summary per file
File Description
onnxruntime/core/providers/webgpu/webgpu_context.cc Requests SubgroupSizeControl feature when the adapter supports it.
onnxruntime/core/providers/webgpu/shader_helper.cc Validates subgroup-size requests and emits WGSL feature enable + @subgroup_size.
onnxruntime/core/providers/webgpu/program.h Adds subgroup-size API surface to ProgramBase.
onnxruntime/core/providers/webgpu/program.cc Implements SetSubgroupSize and initializes the new member.
onnxruntime/core/providers/webgpu/program_cache_key.cc Extends program cache key to include subgroup-size overrides.
onnxruntime/contrib_ops/webgpu/quantization/subgroup_matrix_matmul_nbits.cc Enforces subgroup size 32 on Intel when supported.

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

Comment thread onnxruntime/core/providers/webgpu/shader_helper.cc
Comment thread onnxruntime/core/providers/webgpu/program_cache_key.cc Outdated
@qjia7
Jiajia Qin (qjia7) merged commit fdd011e into microsoft:main Aug 17, 2026
86 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