[webgpu] Set is_channels_last to true by default in ComputeMatMul#27674
[webgpu] Set is_channels_last to true by default in ComputeMatMul#27674guschmue merged 7 commits intomicrosoft:mainfrom
is_channels_last to true by default in ComputeMatMul#27674Conversation
|
@qjia7 PTAL, thanks! |
There was a problem hiding this comment.
Pull request overview
This PR updates the WebGPU MatMul/Conv Split-K plumbing to treat is_channels_last as an optional signal (only meaningful when bias is present), reducing ambiguity for bias-less call sites and enabling the Split-K MatMul path.
Changes:
- Change
is_channels_lastparameters tostd::optional<bool>across WebGPU MatMul helpers and Split-K configuration. - Update shader-generation helpers (
MatMulWriteFnSourceForMatMul) to acceptstd::optional<bool>andstd::string_view. - Adjust WebGPU Conv and WebGPU BERT Attention call sites to only pass
is_channels_lastwhen bias is used.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/core/providers/webgpu/webgpu_utils.h | Updates Split-K config API to accept optional is_channels_last. |
| onnxruntime/core/providers/webgpu/webgpu_utils.cc | Updates Split-K gating logic to only consult is_channels_last when provided. |
| onnxruntime/core/providers/webgpu/vendor/intel/math/matmul.h | Simplifies Intel MatMul subgroup program interface (bias removed). |
| onnxruntime/core/providers/webgpu/vendor/intel/math/matmul.cc | Updates Intel subgroup shader generation for new MatMul write helper signature. |
| onnxruntime/core/providers/webgpu/nn/conv.cc | Passes is_channels_last only when Conv MatMul path includes bias. |
| onnxruntime/core/providers/webgpu/math/matmul_packed.h | Updates MatMul program API to carry optional is_channels_last. |
| onnxruntime/core/providers/webgpu/math/matmul_packed.cc | Treats bias presence as is_channels_last_.has_value() and threads optional into shader generation. |
| onnxruntime/core/providers/webgpu/math/matmul.h | Makes ComputeMatMul accept optional is_channels_last with a default of {}. |
| onnxruntime/core/providers/webgpu/math/matmul.cc | Enforces consistency between bias presence and is_channels_last engagement; wires optional into Split-K selection and MatMul program creation. |
| onnxruntime/core/providers/webgpu/math/gemm_utils.h | Updates MatMul write helper signature to optional is_channels_last and string_view. |
| onnxruntime/core/providers/webgpu/math/gemm_utils.cc | Implements optional-aware bias handling in MatMul write helper. |
| onnxruntime/core/providers/webgpu/math/gemm_packed.cc | Updates Split-K selection call site to pass std::nullopt for is_channels_last. |
| onnxruntime/contrib_ops/webgpu/bert/attention.cc | Builds MatMul input list conditionally and passes optional is_channels_last only with bias. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This patch sets `is_channels_last` to true by default in the parameter of `ComputeMatMul` and ignores it in `UseSplitK` when there is no `bias`.
is_channels_last with std::optional is_channels_last to true by default in ComputeMatMul
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @guschmue, could you take a look at this PR? |
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
|
The errors are not related to this PR: The self-hosted runner lost communication with the server. Verify the machine is running and has a healthy network connection. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error. |
|
The failures on DirectML CI are not related to this PR. |
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
Pull request was closed
This patch sets
is_channels_lastto true by default in the parameterof
ComputeMatMuland ignores it inUseSplitKwhen there is nobias.