Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS/WebGPU] Expand operator fixes #17137

Merged
merged 3 commits into from
Aug 16, 2023
Merged

[JS/WebGPU] Expand operator fixes #17137

merged 3 commits into from
Aug 16, 2023

Conversation

hariharans29
Copy link
Member

Description

  1. The cacheHint for Expand is set to be a function of the input tensors' shapes. This is a problem because the shader is a function of the first input's shape and the second input's contents. Without this fix, we could be using a cached ProgramInfo incorrectly in places where we should be using a different ProgramInfo. A test is checked-in for this.

  2. Support the first input tensor being 1-D. The const inputShape = ${input.indices(...inputShape)}; returns an u32 for a 1-D tensor which means that we can't be using logic like inputShape[i] in that case as it is not an array. A similar (but not exactly the same) issue was fixed in [js/web] JSEP Expand fix for inputs with rank < 2 #16829 but after the indices helper refactoring a similar issue was re-introduced back. A fix is proposed and a test is added for this.

Motivation and Context

Fix some bugs in Expand WebGPU

@guschmue guschmue added the ep:WebGPU ort-web webgpu provider label Aug 14, 2023
fs-eire
fs-eire previously approved these changes Aug 14, 2023
js/web/lib/wasm/jsep/webgpu/ops/expand.ts Outdated Show resolved Hide resolved
js/web/lib/wasm/jsep/webgpu/ops/expand.ts Show resolved Hide resolved
satyajandhyala
satyajandhyala previously approved these changes Aug 16, 2023
@satyajandhyala satyajandhyala self-requested a review August 16, 2023 17:56
@satyajandhyala satyajandhyala dismissed their stale review August 16, 2023 17:57

Have a question

@hariharans29 hariharans29 merged commit 66df117 into main Aug 16, 2023
@hariharans29 hariharans29 deleted the hari/webgpu_expand_fix branch August 16, 2023 18:24
kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this pull request May 9, 2024
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