WebGPU: Support int64 for Add operator - #29844
Merged
hariharans29 merged 4 commits intoJul 27, 2026
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
@hariharans29, PTAL, thanks! /cc @adrastogi |
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the WebGPU EP Add kernel registration to include tensor(int64) when enable_int64 is set, matching the conditional factory-function registration pattern already used for other WebGPU ops (e.g., Sub, Equal). This resolves WebGPU kernel-lookup failures for INT64 Add nodes (notably in graph-capture flows where INT64 is enabled).
Changes:
- Convert
AddWebGPU kernel registration from static macro entries to conditionalCreateAdd*KernelInfo(...)factory functions, registered viaRegisterKernels(enable_int64). - Add WebGPU unit tests covering INT64
Addfor elementwise, broadcast, scalar LHS/RHS, and size-divisible-by-4 cases. - Expose
CreateAdd*KernelInfodeclarations inbinary_elementwise_ops.hfor use by the WebGPU EP registry.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc | Adds USE_WEBGPU-guarded tests validating INT64 Add execution on WebGPU with kEnableInt64=1. |
| onnxruntime/core/providers/webgpu/webgpu_execution_provider.cc | Removes static Add registration and registers Add via RegisterKernels() using conditional INT64 type constraints. |
| onnxruntime/core/providers/webgpu/math/binary_elementwise_ops.h | Declares CreateAddVersionedKernelInfo / CreateAddKernelInfo templates for EP registration. |
| onnxruntime/core/providers/webgpu/math/binary_elementwise_ops.cc | Implements CreateAdd*KernelInfo and explicitly instantiates the supported versions (7–12, 13, 14+). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Low
Contributor
Author
|
Fixed the merge conflicts, @hariharans29, please take another look, thanks! |
hariharans29
approved these changes
Jul 27, 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
Extends the WebGPU EP
Addoperator to accepttensor(int64)inputs by converting its registration from a static macro to the same conditional factory-function pattern already used bySubandEqual(#29392)Motivation and Context
Int64
Addnodes (e.g. token-position arithmetic in LLMs, mobileclip_s0 text model) fail kernel lookup in the WebGPU EP.The shader already handles int64 generically for all binary ops; only the kernel registration was missing the int64 type constraint for
Add.