File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,13 @@ layout(binding = 0) readonly buffer inputBuffer { float x[]; };
15
15
layout(binding = 1) writeonly buffer outputBuffer { float y[]; };
16
16
layout(binding = 2) readonly buffer batchInfosBuffer { BatchInfo infos[]; };
17
17
18
- shared uint sharedPosition;
19
18
shared BatchInfo sharedInfo;
20
19
21
20
void main() {
22
21
const uint threadIndex = gl_LocalInvocationID.x;
23
22
const uint batchIndex = gl_GlobalInvocationID.y;
24
23
25
24
if (threadIndex == 0) {
26
- sharedPosition = uint(x[batchIndex]);
27
25
sharedInfo = infos[batchIndex];
28
26
}
29
27
Original file line number Diff line number Diff line change @@ -31,10 +31,11 @@ void main() {
31
31
memoryBarrierShared();
32
32
barrier();
33
33
34
- const uint start = sharedInfo.inputOffset + threadIndex;
35
- const uint end = sharedInfo.inputOffset + sharedInfo.inputSizeX;
34
+ const uint inputSizeX = sharedInfo.inputSizeX;
35
+ const uint xyOffset = sharedInfo.inputOffset;
36
+ const uint mOffset = inputSizeX * batchIndex;
36
37
37
- for (uint i = threadIndex; i < end ; i += N_THREADS) {
38
- y[i] = x[i] * m[i];
38
+ for (uint i = threadIndex; i < inputSizeX ; i += N_THREADS) {
39
+ y[xyOffset + i] = x[xyOffset + i] * m[mOffset + i];
39
40
}
40
41
}
You can’t perform that action at this time.
0 commit comments