-
Notifications
You must be signed in to change notification settings - Fork 2k
webgpu: support MaxPoolGrad kernel #7261
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
Conversation
| const maxPoolPositions = backend.runWebGPUProgram( | ||
| maxPoolPositionsProgram, [x], 'int32', uniformData); | ||
|
|
||
| const avgPoolBackpropProgram = new MaxPool2DBackpropProgram(convInfo); |
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.
nit: avgPoolXXX -> maxPoolXXX
| @@ -0,0 +1,93 @@ | |||
| /** | |||
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.
Will MaxPool3DBackpropProgram share the same file? If yes, maybe we should remove 2d from file name?
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.
Currently, I am not sure the file will be shared by 3d, so we keep the name with 2d here. If we put the 3d in this file, then we could rename the file.
| dispatch: [number, number, number]; | ||
| variableNames = ['dy', 'maxPos']; | ||
| uniforms = | ||
| `stride : vec2<i32>, pad : vec2<i32>, dilation : vec2<i32>, filterDims : vec2<i32>, |
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.
Can we unify to use strides, pads, dilations from this PR? And you can do the refactor for other places in a separate PR.
|
@gyagp Please take a look, thanks |
| this.dispatch = computeDispatch( | ||
| this.dispatchLayout, this.outputShape, this.workgroupSize); | ||
|
|
||
| this.shaderKey = `max_pool2d_backprop`; |
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.
| this.shaderKey = `max_pool2d_backprop`; | |
| this.shaderKey = `maxPool2DBackprop`; |
What's the convention for shaderKey? Maybe className.replace('Program', '') and variants split by '_'? We need to somehow unify this.
gyagp
left a comment
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.
LGTM with nit to unify shaderKey
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is