Skip to content

[WebGPU] Add GridSample operator#28264

Merged
guschmue merged 1 commit into
microsoft:mainfrom
TomCrypto:webgpu-grid-sample
Apr 29, 2026
Merged

[WebGPU] Add GridSample operator#28264
guschmue merged 1 commit into
microsoft:mainfrom
TomCrypto:webgpu-grid-sample

Conversation

@TomCrypto
Copy link
Copy Markdown
Contributor

Description

Implements the GridSample operator (opset 16–19) for the WebGPU EP.

Motivation and Context

GridSample was missing from the WebGPU EP and all other major execution providers already support it. The GridSample tests were extended to cover the WebGPU EP and seem to pass successfully.

I haven't tested that the onnxruntime-web build would pick up this new operator implementation because it's really hard to build this locally, but it seems like it should just work.

Closes #27085

@TomCrypto
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@guschmue guschmue requested a review from Copilot April 29, 2026 16:34
@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial support for the ONNX GridSample operator (opset 16–19) to the WebGPU Execution Provider, and expands existing GridSample operator tests to exercise the WebGPU EP.

Changes:

  • Register GridSample (16–19) kernel for the WebGPU EP and add shader/program implementation.
  • Add WebGPU EP to the GridSample provider test matrix (when USE_WEBGPU is enabled).
  • Add a layout-conversion override so WebGPU doesn’t try to transform GridSample into NHWC.

Reviewed changes

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

File Description
onnxruntime/test/providers/cpu/tensor/grid_sample_test.cc Adds WebGPU EP to the set of execution providers used by GridSample tests.
onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc Registers the WebGPU GridSample kernel and disables NHWC layout conversion for this op.
onnxruntime/core/providers/webgpu/tensor/grid_sample.h Declares the WebGPU GridSample kernel and its shader program.
onnxruntime/core/providers/webgpu/tensor/grid_sample.cc Implements GridSample shader generation and kernel execution for WebGPU.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread onnxruntime/core/providers/webgpu/tensor/grid_sample.cc
Comment thread onnxruntime/core/providers/webgpu/tensor/grid_sample.cc
@guschmue guschmue merged commit abb284d into microsoft:main Apr 29, 2026
91 checks passed
@guschmue
Copy link
Copy Markdown
Contributor

thanks for the op !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebGPU ort-web webgpu provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Implement GridSample node for WebGPU EP

3 participants