Open
Conversation
Port the Conv3D naive shader from the JS implementation to C++. This adds support for rank-5 (3D) convolutions in the WebGPU EP, handling both regular Conv and FusedConv with activations (Relu, Clip, HardSigmoid). New files: - conv3d_naive.h: Conv3DNaiveProgram class declaration - conv3d_naive.cc: WGSL shader generation and dispatch logic Modified: - conv.cc: Add rank-5 dispatch to Conv3DNaiveProgram
Remove kWebGpuExecutionProvider from excluded_providers for the float32 Conv3D tests (Conv3D_1, Conv3D_2, Conv3D_Bias) so they run on the WebGPU EP. Keep fp16 Conv3D tests excluded since they require ShaderF16 device support which not all GPUs have. Added a TODO comment about enabling them when the test infrastructure supports conditional skipping based on device capabilities.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds initial Conv3D support to the WebGPU Execution Provider by introducing a dedicated naive WGSL shader path and enabling existing Conv3D unit tests to run against WebGPU.
Changes:
- Implemented a new
Conv3DNaiveProgramshader (supports channels-first/last, optional bias, optional fused activation). - Updated WebGPU
Convkernel logic to detect 5D tensors and route to the new Conv3D shader (explicitly rejects grouped Conv3D for now). - Enabled WebGPU execution for existing Conv3D float32 tests; added a note explaining why fp16 Conv3D tests remain excluded for WebGPU.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/core/providers/webgpu/nn/conv.cc | Routes rank-5 (Conv3D) to the new naive shader path; rejects grouped Conv3D. |
| onnxruntime/core/providers/webgpu/nn/conv3d_naive.h | Declares the new Conv3D WebGPU program and its uniforms. |
| onnxruntime/core/providers/webgpu/nn/conv3d_naive.cc | Implements the naive per-output-element Conv3D WGSL generation. |
| onnxruntime/test/providers/cpu/nn/conv_op_test.cc | Enables WebGPU for existing Conv3D float32 test cases. |
| onnxruntime/test/providers/cpu/nn/conv_fp16_test.cc | Adds TODO note for future fp16 Conv3D enablement on WebGPU (capability-based skipping). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…t long lines, sort includes
guschmue
approved these changes
Apr 2, 2026
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
This pull request adds support for Conv3D operations to the WebGPU execution provider in ONNX Runtime. The main changes include implementing a new naive Conv3D shader, updating the convolution logic to handle 3D convolutions, and enabling relevant tests for Conv3D on WebGPU. Grouped Conv3D is not yet supported.
Conv3D WebGPU support:
Conv3DNaiveProgramclass (conv3d_naive.h,conv3d_naive.cc) that implements a per-element Conv3D shader for WebGPU, supporting both "channels last" and "channels first" layouts, with optional bias and activation. [1] [2]conv.ccto detect 5D tensors (Conv3D), construct the appropriate shader program, and pass spatial/stride/dilation parameters as uniforms. Grouped Conv3D is explicitly disallowed for now.conv3d_naive.hheader in the main convolution implementation.Test coverage:
conv_op_test.cc). [1] [2] [3]Motivation and Context
Support additional cases in WebGPU EP Conv kernel.