-
Notifications
You must be signed in to change notification settings - Fork 2k
[webgpu] Use different global index for flat and non-flat dispatch #5706
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
base: master
Are you sure you want to change the base?
Conversation
@qjia7 @haoyunfeix @xhcao @gyagp PTAL |
@@ -65,7 +65,7 @@ export class SliceProgram implements WebGPUProgram { | |||
|
|||
const userCode = ` | |||
${getMainHeaderString()} { | |||
${getGlobalIndexString()} | |||
${getGlobalIndexString(true)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SliceProgram uses the flat dispatch layout. Why pass true
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In high level, I think for non-flat dispatch, we shouldn't call ${getGlobalIndexString}
at all. Our fixing should remove the dependency on getGlobalIndexString
on non-flat dispatch.
92fb01f
to
dc08875
Compare
let outputCoords : ${ | ||
outputCoordsType} = getOutputCoords(globalId, globalIndex); | ||
outputCoordsType} = getOutputCoords(globalId, i32(globalId.x)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second parameter seems like meaningless for non-flat dispatch. You already passed globalId
. But you still have to pass globalId.x
. I prefer that you refactor getXXX
method to remove the dependency of globalIndex
. Similar for other places.
This change is