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, an empty or four-wide array.
The registry text and every compiler message on these pages are the compiler's own English.
When it fires
@compute(...) with an argument that is not an array literal of one to three whole numbers: an object, a bare number, an identifier, an empty or four-wide array. It used to fall through to the default of 64 with no diagnostic, so the author dispatched against a size they never asked for. The default-limit check is WORKGROUP_SHAPE.
Example
"use typeshade"
declare const data: storage<array<f32>, "read_write">
@compute(64)export function main(@builtin("global_invocation_id") id: vec3u): 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])", or no argument for the default of 64; "64" is not a workgroup shape.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
declare const data: storage<array<f32>, "read_write">
@compute([64])export function main(@builtin("global_invocation_id") id: vec3u): void { data[id.x] = data[id.x] * 2.}The rule this enforces
- Rule 8.7 Test
@computecarries the workgroup size as an array literal of one to three whole numbers,x,yandz, a missingyorzbeing 1, and the default is 64; every extent reaches the emitted@workgroup_sizeand the reflection, and a shape over WebGPU’s default compute limits must be reported as a warning.
See also
-
TS8026WORKGROUP_SHAPE - A warning:
@compute([x, y, z])exceeds one of WebGPU's default compute limits (xandy256,z64, 256 invocations in all), so a device requested without raising that limit refuses the pipeline.
Source
Where the compiler raises this code at commit 26de7be8, one line per file: