Repository navigation
[WebGPU] Enable subgroup matrix kernels on AMD GPUs - #32667
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Allow subgroup matrix kernels to select their required subgroup size on adapters that expose a variable subgroup-size range. Require subgroup-size control in that case and request the selected configuration's size for prepack and multiplication shaders. Update Dawn to v20260828.013844 and Agility SDK to 1.721.3-preview. The newer Dawn is required because the previous revision depended solely on the global D3D12 LinAlg tier, did not reject type combinations whose operation SupportFlags were unsupported, and did not forward the enumerated matrix configurations to Tint's HLSL lowering. AMD preview drivers can report valid operation-specific configurations even when the global tier is absent, so those fixes are needed to expose and compile the WebGPU subgroup-matrix feature correctly. Tested on Windows D3D12 with an AMD Radeon RX 9070 XT, AMD driver 26.10.07.02 (32.0.31007.2064), and Agility SDK 721. MatMulNBits.Float16_4b_Accuracy4 passed while generating FP16 16x16x16 subgroup-matrix shaders. SubgroupMatrixConfigTest.RequiredSubgroupSizeCompatibility also passed.
a0688c7 to
40f3518
Compare
|
@microsoft-github-policy-service agree company="Microsoft" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp |
Supported commands
See additional documentation. |
There was a problem hiding this comment.
π΅ Needs a closer look
The vendor-specific GPU behavior and foundational Dawn dependency update require final human and hardware-backed validation.
Pull request overview
Enables WebGPU subgroup-matrix kernels on AMD GPUs with variable subgroup sizes.
Changes:
- Selects and requests each kernel configurationβs required subgroup size.
- Adds subgroup-size compatibility tests.
- Updates Dawn and Direct3D Agility SDK dependencies.
File summaries
| File | Description |
|---|---|
onnxruntime/test/providers/cpu/math/matmul_test.cc |
Tests fixed, variable, and invalid subgroup-size ranges. |
onnxruntime/core/providers/webgpu/math/subgroup_matrix_matmul.cc |
Configures MatMul workgroups with the selected subgroup size. |
onnxruntime/core/providers/webgpu/math/subgroup_matrix_gemm.cc |
Configures Gemm workgroups with the selected subgroup size. |
onnxruntime/core/providers/webgpu/math/subgroup_matrix_config.h |
Defines required subgroup sizes and compatibility logic. |
onnxruntime/core/providers/webgpu/math/subgroup_matrix_config.cc |
Validates adapter ranges and size-control support. |
onnxruntime/contrib_ops/webgpu/quantization/subgroup_matrix_matmul_nbits.cc |
Pins prepack and multiplication shaders to the selected size. |
cmake/patches/dawn/dawn_binskim.patch |
Rebases the warning-policy patch onto the new Dawn revision. |
cmake/deps.txt |
Updates Dawn and Agility SDK pins. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 0
- Review effort level: Balanced
π‘ Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Jiajia Qin (@qjia7), please help to review this PR to support subgroup matrix on AMD. |
|
/run bots |
|
The /run bots request was received from Yang Gu (@gyagp), but no CI run was started. No pending action-required workflow runs matched the current PR head. |
|
Yang Gu (@gyagp) Just checked, no regression. |
Thanks, Jie Chen (@jchen10)! |
### Description - Update Dawn to `v20260828.013844` and Agility SDK to `1.721.3-preview`. - Support subgroup-matrix kernels on adapters that expose a variable subgroup-size range. - Require `subgroup-size-control` for variable-size adapters and request the selected configuration's subgroup size for prepack and multiplication shaders. - Add coverage for valid and invalid subgroup-size configurations. ### Motivation and Context AMD RDNA 3+ supports the FP16 16x16x16 subgroup-matrix configuration with a required subgroup size of 32, while the adapter exposes a variable subgroup-size range. The previous ORT check required the adapter's minimum and maximum subgroup sizes to exactly match the kernel size, so the optimized path was not selected. The Dawn update is required in addition to the ORT changes. The previous Dawn revision: - depended solely on the global D3D12 LinAlg tier to expose subgroup matrices, although preview drivers can report valid operation-specific configurations when that tier is absent; - did not reject reported type combinations whose D3D12 operation `SupportFlags` lack the supported bit; and - did not forward enumerated subgroup-matrix configurations to Tint's HLSL lowering. The newer Dawn revision evaluates the authoritative D3D12 capability data and supplies the configurations to Tint, allowing ORT to expose and compile the WebGPU subgroup-matrix path correctly. Related Dawn issue: https://issues.chromium.org/issues/549226780 ### Testing Windows D3D12 on AMD Radeon RX 9070 XT: - AMD preview driver `26.10.07.02` (`32.0.31007.2064`) - Agility SDK 721 - `SubgroupMatrixConfigTest.RequiredSubgroupSizeCompatibility`: passed - `MatMulNBits.Float16_4b_Accuracy4`: passed - Confirmed FP16 16x16x16 shaders using `subgroupMatrixLoad`, `subgroupMatrixMultiplyAccumulate`, and `subgroupMatrixStore`.
### Description - Replace the transitive `compute_context.h` dependency in `subgroup_matrix_config.h` with the Dawn type header and a forward declaration of `ComputeContextBase`. - Include `compute_context.h` in the implementation file where the complete type is required. ### Motivation and Context #32667 added `subgroup_matrix_config.h` to `matmul_test.cc`. In WebGPU plugin builds, the old transitive include chain reached `webgpu_execution_provider.h` without the EP adapter precompiled header, so `onnxruntime::ep::adapter::Logger` was undeclared. This broke `webgpu_plugin_build_x64_RelWithDebInfo` both on #32667 and on `main`. Keeping the implementation dependency out of the public configuration header fixes the plugin test build and avoids exposing the execution-provider header to callers that only need subgroup matrix configuration types. Failing main run: https://github.com/microsoft/onnxruntime/actions/runs/35204008069 ### Testing - `git diff --check` Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
v20260828.013844and Agility SDK to1.721.3-preview.subgroup-size-controlfor variable-size adapters and request the selected configuration's subgroup size for prepack and multiplication shaders.Motivation and Context
AMD RDNA 3+ supports the FP16 16x16x16 subgroup-matrix configuration with a required subgroup size of 32, while the adapter exposes a variable subgroup-size range. The previous ORT check required the adapter's minimum and maximum subgroup sizes to exactly match the kernel size, so the optimized path was not selected.
The Dawn update is required in addition to the ORT changes. The previous Dawn revision:
SupportFlagslack the supported bit; andThe newer Dawn revision evaluates the authoritative D3D12 capability data and supplies the configurations to Tint, allowing ORT to expose and compile the WebGPU subgroup-matrix path correctly.
Related Dawn issue: https://issues.chromium.org/issues/549226780
Testing
Windows D3D12 on AMD Radeon RX 9070 XT:
26.10.07.02(32.0.31007.2064)SubgroupMatrixConfigTest.RequiredSubgroupSizeCompatibility: passedMatMulNBits.Float16_4b_Accuracy4: passedsubgroupMatrixLoad,subgroupMatrixMultiplyAccumulate, andsubgroupMatrixStore.