Skip to content

Commit 99ad3ec

Browse files
committed
Swap row col to fix r32f regression
1 parent 6a20d30 commit 99ad3ec

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎demo/common.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,17 @@ export async function checkCorrectnessMatmul(
9999
*/
100100
var errorSummary = 0;
101101

102+
/*
102103
const matmulCPUOp = new compute.MatmulCPUOp(firstMatrix, secondMatrix, shape);
103104
matmulCPUOp.executeSync();
104105
const matmulReferenceData = matmulCPUOp.data();
106+
*/
107+
const matmulGPUOp = new compute.MatmulBufferOp(
108+
device, glslang, firstMatrix, secondMatrix, shape);
109+
110+
matmulGPUOp.executeSync();
111+
const matmulReferenceData = await matmulGPUOp.data();
112+
105113
{
106114
const op = new compute.MatmulBufferOp(
107115
device, glslang, firstMatrix, secondMatrix, shape);

‎src/matmul_texturer32f.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ export class MatmulTextureR32FOp extends TextureOp {
161161
}
162162
}
163163
float mm_readA(int row, int col) {
164-
return imageLoad(A, ivec2(row, col)).r;
164+
return imageLoad(A, ivec2(col, row)).r;
165165
}
166166
167167
float mm_readB(int row, int col) {
168-
return imageLoad(B, ivec2(row, col)).r;
168+
return imageLoad(B, ivec2(col, row)).r;
169169
}
170170
171171
void mm_write(int row, int col, float value) {
172172
// TODO: Figure out why need vec4 here.
173-
imageStore(result, ivec2(row,col), vec4(value, 0.0, 0.0, 0.0));
173+
imageStore(result, ivec2(col, row), vec4(value, 0.0, 0.0, 0.0));
174174
}
175175
176176
void main() {

0 commit comments

Comments
 (0)