규칙 8.7
8장, 함수와 진입점 테스트
@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. A selected shape must contain positive integers within the active WebGPU device’s per-axis and total-invocation limits; the compiler warns when the declared defaults exceed WebGPU’s default limits.
규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
근거
an argument the decorator cannot read must not fall through to a default the author did not ask for, and an extent the author wrote must not be dropped. The limits are the device’s, not the language’s: a device requested with raised limits runs a larger workgroup, so a shape over the defaults compiles, and the warning says which limit the host has to raise.
출처
workgroup_size; WebGPU Limits (maxComputeWorkgroupSizeX and Y 256, Z 64, maxComputeInvocationsPerWorkgroup 256); #118.
검증 방식
테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.
컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.
TS8037 WORKGROUP_ARG, where a bare@computeemits@workgroup_size(64)and the object form is refused (compute takes an array of one to three whole numbers, "@compute([64, 1, 1])"; "{ workgroup: [64, 1, 1] }" is not a workgroup shape.);TS8026 WORKGROUP_SHAPE, a warning naming the first default limit the shape exceeds;SD0111, which keeps aportablekernel’s workgroup one-dimensional, since the WebGL2 lowering has no workgroup;- surface §3’s bullets on the payload of
@compute, under the entry example, which state the default of 64, the emitted spelling of a two- or three-dimensional shape, the limits warning, and the refused object form.
커밋 af54ddad5에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 af54ddad5의 언어 문서에서 이 규칙을 설명하는 절입니다.
적용하는 오류 코드
규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.
-
SD0111 - portable kernel outside the gather-only tier
-
TS8026WORKGROUP_SHAPE - 경고입니다.
@compute([x, y, z])가 WebGPU의 기본 compute 한도(x와y는 256,z는 64, 전체 호출은 256)를 넘으므로, 한도를 올리지 않고 요청한 장치는 파이프라인을 거부합니다. -
TS8037WORKGROUP_ARG @compute(...)의 인자가 정수 하나에서 셋으로 이루어진 배열 리터럴이 아닙니다. 객체, 숫자 하나, 식별자, 빈 배열, 원소가 넷인 배열이 그렇습니다. 기본 한도 검사는WORKGROUP_SHAPE입니다.
함께 보기
소스
커밋 af54ddad5의 규칙 원문:
docs/language-design.md:833(설계 문서)reqs/rules/RULE-0807.md(추적 항목)