Skip to content

Commit 36a0548

Browse files
authored
[webgpu] Fix access mode for storage address space (#6607)
* [webgpu] Fix access mode for storage address space BUG Due to WGSL Spec(https://www.w3.org/TR/WGSL/#address-space), storage address space only supported read_write and read access modes. * Change module-scope 'let' -> 'const'
1 parent e744307 commit 36a0548

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tfjs-backend-webgpu/src/matmul_packed_webgpu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export function makeMatMulVectorSource(
177177
workGroupSize[1] === 1 && workGroupSize[2] === 1,
178178
() => `A linear work group size is required. But got ${workGroupSize}.`);
179179
return `
180-
let TileSize = ${workGroupSize[0] * 4};
180+
const TileSize = ${workGroupSize[0] * 4};
181181
var<workgroup> mm_Asub : array<vec4<f32>, ${workGroupSize[0]}>;
182182
183183
${getMainHeaderString()}

tfjs-backend-webgpu/src/webgpu_program.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function makeShader(
167167
outShapeStrides : vec2<i32>,
168168
};
169169
170-
@group(0) @binding(0) var<storage, write> result: array<${
170+
@group(0) @binding(0) var<storage, read_write> result: array<${
171171
mapToWgslTypes(outputData.dtype, program.isVec4)}>;
172172
@group(0) @binding(2) var<uniform> uniforms: Uniform;
173173
`);
@@ -238,7 +238,7 @@ function makeShader(
238238
`);
239239
} else {
240240
prefixSnippets.push(`
241-
@group(0) @binding(0) var<storage, write> result: array<${
241+
@group(0) @binding(0) var<storage, read_write> result: array<${
242242
mapToWgslTypes(outputData.dtype, program.isVec4)}>;
243243
`);
244244
}

0 commit comments

Comments
 (0)