---
title: "규칙 8.7: 함수와 진입점, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 8.7(함수와 진입점)입니다. @compute carries the workgroup size as an array literal of one to three positive whole-number literals…"
url: https://typeshade.dev/ko/reference/rules/8-7/
language: ko
---

# 규칙 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`](https://gpuweb.github.io/gpuweb/wgsl/#workgroup-size-attr); WebGPU [Limits](https://gpuweb.github.io/gpuweb/#limits) (`maxComputeWorkgroupSizeX` and `Y` 256, `Z` 64, `maxComputeInvocationsPerWorkgroup` 256); [#118](https://github.com/typeshade/typeshade/issues/118).

## 검증 방식

테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.

컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.

- `TS8037 WORKGROUP_ARG`, where a bare `@compute` emits `@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`](https://typeshade.dev/ko/reference/errors/sd0111/), which keeps a `portable` kernel’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에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.

- [`src/compiler/ts/stage3.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/stage3.test.ts#L1)

## 설명하는 절

커밋 af54ddad5의 언어 문서에서 이 규칙을 설명하는 절입니다.

- [§3 Entries — stage attributes and explicit builtins](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#3-entries--stage-attributes-and-explicit-builtins)
- [§7 Diagnostics (required)](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#7-diagnostics-required)

## 적용하는 오류 코드

규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.

**[`SD0111`](https://typeshade.dev/ko/reference/errors/sd0111/)**

portable kernel outside the gather-only tier

**[`TS8026`](https://typeshade.dev/ko/reference/errors/ts8026/) `WORKGROUP_SHAPE`**

경고입니다. `@compute([x, y, z])`가 WebGPU의 기본 compute 한도(`x`와 `y`는 256, `z`는 64, 전체 호출은 256)를 넘으므로, 한도를 올리지 않고 요청한 장치는 파이프라인을 거부합니다.

**[`TS8037`](https://typeshade.dev/ko/reference/errors/ts8037/) `WORKGROUP_ARG`**

`@compute(...)`의 인자가 정수 하나에서 셋으로 이루어진 배열 리터럴이 아닙니다. 객체, 숫자 하나, 식별자, 빈 배열, 원소가 넷인 배열이 그렇습니다. 기본 한도 검사는 `WORKGROUP_SHAPE`입니다.

## 함께 보기

- [규칙 8.6](https://typeshade.dev/ko/reference/rules/8-6/) 테스트
- [규칙 8.8](https://typeshade.dev/ko/reference/rules/8-8/) 테스트
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

- [`docs/language-design.md:833`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L833) (설계 문서)
- [`reqs/rules/RULE-0807.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0807.md) (추적 항목)
