mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-03 23:49:44 +00:00
[js/webgpu] fix Conv2DMatMul shader's out-of-bound read (#23085)
### Description <!-- Describe your changes. --> Fix a bug caused by potential out-of-bound reads of `W` in the Conv2DMatMul shader. ### Motivation and Context Fixes #22983
This commit is contained in:
parent
890a719c91
commit
01539ee7ab
1 changed files with 15 additions and 1 deletions
|
|
@ -143,7 +143,21 @@ const conv2dCommonSnippet = (
|
|||
}
|
||||
return ${typeSnippet(innerElementSizeX, dataType)}(0.0);`;
|
||||
|
||||
const sampleW = `${getWSnippet(innerElementSizeW)}`;
|
||||
const sampleW = isChannelsLast
|
||||
? fitInner && fitBOuter
|
||||
? getWSnippet(innerElementSizeW)
|
||||
: `
|
||||
let col = colIn * ${innerElementSizeW};
|
||||
if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) {
|
||||
${getWSnippet(innerElementSizeW)}
|
||||
}
|
||||
return ${typeSnippet(innerElementSizeW, dataType)}(0.0);`
|
||||
: `
|
||||
let col = colIn * ${innerElementSizeW};
|
||||
if (row < uniforms.dim_inner && col < uniforms.dim_a_outer) {
|
||||
${getWSnippet(innerElementSizeW)}
|
||||
}
|
||||
return ${typeSnippet(innerElementSizeW, dataType)}(0.0);`;
|
||||
|
||||
const resType = typeSnippet(innerElementSize, dataType);
|
||||
const aType = isChannelsLast ? typeSnippet(innerElementSizeX, dataType) : typeSnippet(innerElementSizeW, dataType);
|
||||
|
|
|
|||
Loading…
Reference in a new issue