TS8037
이 페이지에서

TS8037

프런트엔드 코드 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.

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

발생 조건

@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.shade.ts
"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.
}

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

TS8037 error, 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.

고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

example.shade.ts
"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.
}

이 코드가 적용하는 규칙

규칙 8.7 테스트
@compute carries the workgroup size as an array literal of one to three whole numbers, x, y and z, a missing y or z being 1, and the default is 64; every extent reaches the emitted @workgroup_size and the reflection, and a shape over WebGPU’s default compute limits must be reported as a warning.

함께 보기

TS8026 WORKGROUP_SHAPE
A warning: @compute([x, y, z]) exceeds one of WebGPU's default compute limits (x and y 256, z 64, 256 invocations in all), so a device requested without raising that limit refuses the pipeline.

소스

커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

이 페이지 편집 문제 보고