Skip to content

[webgpu] Fix batch-norm for ort-web-tests#24404

Merged
fs-eire merged 2 commits intomicrosoft:mainfrom
jchen10:batch-norm
Apr 15, 2025
Merged

[webgpu] Fix batch-norm for ort-web-tests#24404
fs-eire merged 2 commits intomicrosoft:mainfrom
jchen10:batch-norm

Conversation

@jchen10
Copy link
Contributor

@jchen10 jchen10 commented Apr 13, 2025

'global_idx' should be used to calculate the output indices.

'global_idx' should be used to calculate the output indices.
@jchen10
Copy link
Contributor Author

jchen10 commented Apr 13, 2025

@xhcao @fs-eire PTAL
The fix should be right per my understanding and local verification. However, the JS operator has the same problem. I am not clear yet why it can pass the same test. @qjia7 It seems these code lines were originally from you. Please help double check this, thanks!

@fs-eire
Copy link
Contributor

fs-eire commented Apr 13, 2025

I think this makes sense to me. The definition of "offset" is a little bit different between JSEP and WebGPUEP. In JSEP, "offset" is defined on the "tensor data". In WebGPU EP, "offset" is defined on the "WGSL input/output data". take the following example:

we have a tensor x of shape [2, 3, 4], components = 4.

tensor's element is float32.
the corresponding input/output element in WGSL is vec4.

The JSEP's offset range is [0, 24), and WebGPUEP's offset range is [0, 6).

fs-eire
fs-eire previously approved these changes Apr 13, 2025
@fs-eire
Copy link
Contributor

fs-eire commented Apr 13, 2025

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,ONNX Runtime Web CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Apr 13, 2025

/azp run Linux QNN CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline,Linux DNNL CI Pipeline,Linux MIGraphX CI Pipeline,Linux ROCm CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 7 pipeline(s).

@jchen10
Copy link
Contributor Author

jchen10 commented Apr 13, 2025

I think this makes sense to me. The definition of "offset" is a little bit different between JSEP and WebGPUEP. In JSEP, "offset" is defined on the "tensor data". In WebGPU EP, "offset" is defined on the "WGSL input/output data". take the following example:

we have a tensor x of shape [2, 3, 4], components = 4.

tensor's element is float32. the corresponding input/output element in WGSL is vec4.

The JSEP's offset range is [0, 24), and WebGPUEP's offset range is [0, 6).

Got it, thanks for the clarification.

@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label Apr 14, 2025
@fs-eire
Copy link
Contributor

fs-eire commented Apr 14, 2025

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,ONNX Runtime Web CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline

@fs-eire
Copy link
Contributor

fs-eire commented Apr 14, 2025

/azp run Linux QNN CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline,Linux DNNL CI Pipeline,Linux MIGraphX CI Pipeline,Linux ROCm CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 7 pipeline(s).

@fs-eire fs-eire merged commit d60891d into microsoft:main Apr 15, 2025
70 of 83 checks passed
ashrit-ms pushed a commit that referenced this pull request Apr 24, 2025
'global_idx' should be used to calculate the output indices.
@jchen10 jchen10 deleted the batch-norm branch September 2, 2025 11:38
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.

4 participants