Repository navigation
Fix WebGPU grouped Conv vectorization across group boundaries - #33129
Merged
Xavier DuprΓ© (xadupre) merged 1 commit intoOct 6, 2026
Merged
Conversation
Select NHWC grouped-Conv vector width from output channels per group, while retaining the depthwise specialization. Add scalar-reference regressions for group widths, layouts, bias and depthwise multipliers with CPU fallback disabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
π’ Approval recommended
The focused fix preserves existing special cases and is covered across affected layouts and group configurations.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes #33086 by preventing NHWC grouped-Conv vectors from crossing group boundaries.
Changes:
- Selects vector width using output channels per group.
- Preserves depthwise and NCHW behavior.
- Adds 128 WebGPU regression cases with an independent reference.
No actionable issues identified.
| File | Description |
|---|---|
onnxruntime/βcore/βproviders/βwebgpu/βnn/βconv.cc |
Corrects grouped-Conv vector-width selection. |
onnxruntime/βtest/βproviders/βwebgpu/βgrouped_conv_padding_test.cc |
Adds comprehensive grouped-Conv regressions. |
π‘ Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Jiajia Qin (qjia7)
approved these changes
Oct 6, 2026
Xavier DuprΓ© (xadupre)
deleted the
fix/webgpu-grouped-conv-vector-width
branch
October 6, 2026 14:53
eserscor
pushed a commit
that referenced
this pull request
Oct 7, 2026
### Description <!-- Describe your changes. --> Choose the general NHWC grouped-Conv vector width from the number of output channels **per group**, rather than the total output channel count. This prevents a vector from straddling two groups while the shader uses one input-group offset for all its components. Keep the dedicated depthwise vector path unchanged: its one-to-one input/output channel correspondence permits vectorization across groups. NCHW and existing aligned-group vector widths are unchanged. Add 128 parameterized operator regressions with an independent scalar convolution reference: - Two/four groups and one/three input channels per group. - 1, 3, 4, 5, 6, 7, 8, and 12 output channels per group. - NHWC/NCHW and bias/no bias, with batch size two and a non-pointwise kernel. - Explicit WebGPU selection with CPU EP fallback disabled; unavailable providers skip before constructing the tester. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Fixes #33086. For example, two groups with six output channels each previously selected `vec4` from the total of twelve channels. The vector covering channels 4β7 crosses the group boundary, but all four lanes use the first group's input channels. Selecting `vec2` from six channels per group preserves group boundaries. Validation on Linux Release with Mesa lavapipe (software Vulkan), executing actual WebGPU shaders: - Full WebGPU provider-test build β **passed**: ```bash source .venv/bin/activate python tools/ci_build/build.py --config Release --build_dir build/linux_webgpu \ --use_webgpu --cmake_generator Ninja --parallel 24 --skip_tests \ --update --build --target onnxruntime_provider_test ``` - Temporarily restoring the original vector-width selection and rebuilding reproduced **three numerical failures** for NHWC with 5, 6, and 7 output channels per group: ```bash cmake --build build/linux_webgpu/Release --target onnxruntime_provider_test -j 24 cd build/linux_webgpu/Release VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \ timeout 180 ./onnxruntime_provider_test \ --gtest_filter='Conv_WebGPU/GroupedConvVectorizationTest.OutputVectorsStayWithinGroups/13:Conv_WebGPU/GroupedConvVectorizationTest.OutputVectorsStayWithinGroups/17:Conv_WebGPU/GroupedConvVectorizationTest.OutputVectorsStayWithinGroups/21' ``` - Restoring the fix and rebuilding β **passed**. Final targeted execution β **129 passed, none skipped**, including the existing padding regression: ```bash cmake --build build/linux_webgpu/Release --target onnxruntime_provider_test -j 24 cd build/linux_webgpu/Release VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.x86_64.json \ timeout 180 ./onnxruntime_provider_test \ --gtest_filter='Conv_WebGPU.GroupedConvWithPaddingUsesSignedCoordinates:Conv_WebGPU/GroupedConvVectorizationTest.*' ``` - Formatting and whitespace β **passed**: ```bash .venv/bin/clang-format --dry-run --Werror \ onnxruntime/core/providers/webgpu/nn/conv.cc \ onnxruntime/test/providers/webgpu/grouped_conv_padding_test.cc git diff --check ``` Not validated locally: physical GPU drivers, Metal/D3D12, FP16, graph capture, or the full test suite. Software Vulkan establishes correctness for these MatMul-free grouped-Conv cases, not GPU performance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Choose the general NHWC grouped-Conv vector width from the number of output channels per group, rather than the total output channel count. This prevents a vector from straddling two groups while the shader uses one input-group offset for all its components.
Keep the dedicated depthwise vector path unchanged: its one-to-one input/output channel correspondence permits vectorization across groups. NCHW and existing aligned-group vector widths are unchanged.
Add 128 parameterized operator regressions with an independent scalar convolution reference:
Motivation and Context
Fixes #33086.
For example, two groups with six output channels each previously selected
vec4from the total of twelve channels. The vector covering channels 4β7 crosses the group boundary, but all four lanes use the first group's input channels. Selectingvec2from six channels per group preserves group boundaries.Validation on Linux Release with Mesa lavapipe (software Vulkan), executing actual WebGPU shaders:
source .venv/bin/activate python tools/ci_build/build.py --config Release --build_dir build/linux_webgpu \ --use_webgpu --cmake_generator Ninja --parallel 24 --skip_tests \ --update --build --target onnxruntime_provider_test.venv/bin/clang-format --dry-run --Werror \ onnxruntime/core/providers/webgpu/nn/conv.cc \ onnxruntime/test/providers/webgpu/grouped_conv_padding_test.cc git diff --checkNot validated locally: physical GPU drivers, Metal/D3D12, FP16, graph capture, or the full test suite. Software Vulkan establishes correctness for these MatMul-free grouped-Conv cases, not GPU performance.