Skip to content

[WebNN] Fallback int64 indices to int32 - #26308

Merged
Dwayne Robinson (fdwr) merged 2 commits into
microsoft:mainfrom
Honry:cast-scatter-indices
Oct 29, 2025
Merged

[WebNN] Fallback int64 indices to int32#26308
Dwayne Robinson (fdwr) merged 2 commits into
microsoft:mainfrom
Honry:cast-scatter-indices

Conversation

@Honry

Copy link
Copy Markdown
Contributor

ONNX's ScatterND and ScatterElements limit their indices input to int64, but some WebNN backends only support int32 indices. As a workaround for such backends, we can insert a Cast operation to convert the data type.

@Honry

Copy link
Copy Markdown
Contributor Author

Dwayne Robinson (@fdwr), Guenther Schmuelling (@guschmue), PTAL, thanks! This will make Whisper Base demo on WebNN Developer Preview can fully run behind TFLite backend without any fallback.

@fdwr Dwayne Robinson (fdwr) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 Minor thought, else LGTM.

Comment thread onnxruntime/core/providers/webnn/builders/impl/scatterElements_op_builder.cc Outdated
@fdwr

Copy link
Copy Markdown
Contributor

/azp run ONNX Runtime Web CI Pipeline,Windows GPU CI Pipeline,Linux Android Emulator QNN CI Pipeline,Windows GPU WebGPU CI Pipeline,Windows OpenVINO CI Pipeline

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,MacOS CI Pipeline,Windows ARM64 QNN CI Pipeline,Windows CPU CI Pipeline

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Windows GPU TensorRT CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,Windows x64 QNN CI Pipeline,Big Models

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Test Linux CUDA x64 Release,Test Linux TensorRT x64 Release,web_Debug / build_onnxruntime_web,web_Release / build_onnxruntime_web

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@fdwr Dwayne Robinson (fdwr) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@fdwr

Copy link
Copy Markdown
Contributor

/azp run ONNX Runtime Web CI Pipeline,Windows GPU CI Pipeline,Linux Android Emulator QNN CI Pipeline,Windows GPU WebGPU CI Pipeline,Windows OpenVINO CI Pipeline

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,MacOS CI Pipeline,Windows ARM64 QNN CI Pipeline,Windows CPU CI Pipeline

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Windows GPU CUDA CI Pipeline,Windows GPU DML CI Pipeline,Windows GPU Doc Gen CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Windows GPU TensorRT CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,Windows x64 QNN CI Pipeline,Big Models

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Test Linux CUDA x64 Release,Test Linux TensorRT x64 Release,web_Debug / build_onnxruntime_web,web_Release / build_onnxruntime_web

@fdwr

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@fdwr

Dwayne Robinson (fdwr) commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

Hmm, I've retried the Linux CI build and CUDA build twice now. Wonder if this happens in main now.

image

ONNX's ScatterND and ScatterElements limit their indices input to int64,
but some WebNN backends only support int32. As a workaround for such backends,
we can insert a Cast operation to convert the data type.
@Honry

Copy link
Copy Markdown
Contributor Author

Hmm, I've retried the Linux CI build and CUDA build twice now. Wonder if this happens in main now.

image

Let me rebase it to main and pls. help retrigger the CI.

@guschmue

Copy link
Copy Markdown
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 4 pipeline(s).

@Honry

Copy link
Copy Markdown
Contributor Author

Guenther Schmuelling (@guschmue), all CLs passed, could you please merge this one? Thanks!

@fdwr
Dwayne Robinson (fdwr) merged commit 80b6e93 into microsoft:main Oct 29, 2025
90 checks passed
Naomi Ovadia (naomiOvad) pushed a commit to naomiOvad/onnxruntime that referenced this pull request Nov 2, 2025
ONNX's ScatterND and ScatterElements limit their indices input to int64,
but some WebNN backends only support int32 indices. As a workaround for
such backends, we can insert a Cast operation to convert the data type.
Wanming Lin (Honry) added a commit to Honry/webnn-developer-preview that referenced this pull request Nov 6, 2025
Upgrade the onnxruntime-web to 1.24.0-dev.20251104-75d35474d5
which includes the PR [1] to support ScatterND with int64 indices
for TFLite backend. With this PR, Whisper Base demo can fully
run behind TFLite backend without any fallback.

Upgrade the test dist as well BTW.

[1] microsoft/onnxruntime#26308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants