[webgpu] Fix wrongly used u32 of WGSL#5559
Conversation
|
@qjia7 @haoyunfeix @xhcao @gyagp , PTAL |
|
@kainino0x @lina128 take a look, thanks. |
lina128
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 1 of 1 approvals obtained (waiting on @axinging and @kainino0x)
tfjs-backend-webgpu/src/kernels/conv2d_mm_vec4_webgpu.ts, line 312 at r1 (raw file):
if (coordRow < 0) {
If coordRow < 0, is this an error? Why handle it silently?
coordRow < 0 happens when padding is applied during computing convolution. This is intended behavior, can not report error. |
lina128
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 3 of 1 approvals obtained (waiting on @axinging)
tfjs-backend-webgpu/src/kernels/conv2d_mm_vec4_webgpu.ts, line 312 at r1 (raw file):
Previously, axinging (Xu Xing) wrote…
coordRow < 0 happens when padding is applied during computing convolution. This is intended behavior, can not report error.
Ah, right. If it's uint, then it will get a large number, which is incorrect. Got it. Thanks.
With this change, when the real coord < 0, 0.0 will be returned. However, without this change, when the real coord < 0, 0.0 will also be returned. This is why existing case can not catch this error.
Below is explanation for without this change. For example:
When the real result of right side < 0, coordCol (of type u32) will be interpreted as a very big data, this big data will fail the check done by coordsInBounds4D, so 0.0 will be returned.
This change is