TS8037
On this page

TS8037

Front-end code WORKGROUP_ARG

@compute(...) with an argument that is not an array literal of one to three whole numbers: an object, a bare number, an identifier, or an empty or four-wide array. The check of the default limits is WORKGROUP_SHAPE.

The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.

The registry text and every compiler message on these pages are the compiler's own English.

Example

example.shade.ts
"use typeshade"
declare const data: storage<array<f32>, "read_write">
@compute(64)
export function main(id: builtin<"global_invocation_id">): void {
data[id.x] = data[id.x] * 2.
}

Compiled at build time against the pinned compiler, this program gets:

TS8037 error, line 5: compute takes an array of one to three whole numbers, "@compute([64, 1, 1])"; "64" is not a workgroup shape.

How to fix it

The same program, corrected. It compiles with no diagnostic.

example.shade.ts
"use typeshade"
declare const data: storage<array<f32>, "read_write">
@compute([64])
export function main(id: builtin<"global_invocation_id">): void {
data[id.x] = data[id.x] * 2.
}

The rules this enforces

Rule 2.1 Test
Every author-facing name must come from exactly one of three sources:
Rule 8.7 Test
@compute carries the workgroup size as an array literal of one to three positive whole-number literals, integer module constants or u32 override names, x, y and z, a missing y or z being 1, and the default is 64; every default extent reaches reflection and the manifest, and each override name reaches WGSL’s @workgroup_size.

See also

Source

Where the compiler raises this code at commit af54ddad5, one line per file:

Edit this page Report a problem