Skip to content

Commit c66daac

Browse files
committed
Fixed exceeding workgroup size
1 parent 85c789f commit c66daac

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/typegpu-concurrent-sum/src/compute.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import tgpu from 'typegpu';
22
import * as d from 'typegpu/data';
33
import * as std from 'typegpu/std';
4-
import { dataBindGroupLayout } from './schemas.ts';
4+
import { dataBindGroupLayout, fixedArrayLength } from './schemas.ts';
55

6-
export const workGroupSize = 256;
6+
export const workGroupSize = fixedArrayLength;
77

88
const { inputArray } = dataBindGroupLayout.bound;
99

@@ -12,7 +12,7 @@ export const computeShader = tgpu['~unstable'].computeFn({
1212
workgroupSize: [workGroupSize],
1313
})((input) => {
1414
const threadId = input.in.x;
15-
const length = d.u32(1024);
15+
const length = d.u32(fixedArrayLength);
1616
const log2Length = d.i32(std.log2(d.f32(length)));
1717

1818
// Up-sweep phase

packages/typegpu-concurrent-sum/src/schemas.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import tgpu from 'typegpu';
22
import * as d from 'typegpu/data';
33

4+
export const fixedArrayLength = 256;
45
export const inputValueType = d.struct({
5-
in: d.arrayOf(d.f32, 1024),
6+
in: d.arrayOf(d.f32, fixedArrayLength),
67
})
78
.$name('inArray');
89

0 commit comments

Comments
 (0)