WebGPU: Support int64 for Reshape - #29830
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/cc @adrastogi |
|
@hariharans29, PTAL, thanks! |
Review: PR #29830 — WebGPU: Support int64 for Reshape (head
|
There was a problem hiding this comment.
Pull request overview
This PR extends the WebGPU Execution Provider’s Reshape kernel registration to support conditional int64 enablement (matching the existing enable_int64 factory-registration pattern used by other WebGPU tensor shape ops), and adds an explicit WebGPU int64 test for Reshape to prevent CPU fallback in WebNN-mapped graphs.
Changes:
- Replace static macro-based
Reshapekernel registration withCreateReshape*KernelInfo(enable_int64)factory registration. - Add WebGPU
Reshapeint64 test coverage gated behindUSE_WEBGPUandep.webgpuexecutionprovider.enableInt64. - Add
Reshapekernel-info factory declarations to the WebGPUreshapeheader and implement them inreshape.cc.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| onnxruntime/test/providers/cpu/tensor/tensor_op_test.cc | Adds a WebGPU-only int64 Reshape test using the WebGPU provider option to enable int64. |
| onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc | Moves Reshape registration to the conditional enable_int64 registration section and removes static registration entries. |
| onnxruntime/core/providers/webgpu/tensor/reshape.h | Declares CreateReshape*KernelInfo(enable_int64) factory helpers. |
| onnxruntime/core/providers/webgpu/tensor/reshape.cc | Implements Reshape kernel-info factories and explicit template instantiations to support conditional int64 constraints. |
|
LGTM, thanks |
|
Can you please address the copilot comment ? |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Yes, addressed. @hariharans29, please take another look, thanks! |
Description
This updates WebGPU
Reshapeto follow the existingenable_int64factory-registration pattern (used byUnsqueeze/Expand/etc.) instead of static macro registration, and adds explicit int64 WebGPU test coverage forReshape.Motivation and Context
PR microsoft/onnxruntime#27478 added int64 support for the Expand and Unsqueeze (Squeeze) operators in the WebGPU EP. However, the WebNN EP maps a number of those shape-manipulation operators — including Squeeze/Unsqueeze — onto Reshape (WebNN spec doesn't support Squeeze/Unsqueeze). As a result, when a model uses int64 data through these WebNN-mapped ops, execution falls back because Reshape itself does not yet accept int64 tensors, undermining the int64 coverage that #27478 was intended to enable.
Fix #29756