---
title: "Rule 8.7: Functions and entry points in TypeShade"
description: "Rule 8.7 of the TypeShade language design, in Functions and entry points."
url: https://typeshade.dev/reference/rules/8-7/
language: en
---

# Rule 8.7

Chapter 8, Functions and entry points 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`. 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.

The rule text and the parts under it are the compiler's own English, as the design document writes them.

## Rationale

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.

## Derives from

[`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).

## How it is verified

Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.

Where the rule says the compiler enforces it:

- `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/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.

The files that verify it at commit af54ddad5, each at the first line that names the rule:

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

## Explained in

The sections of the surface document that explain this rule, at commit 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)

## Error codes that enforce it

The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:

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

portable kernel outside the gather-only tier

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

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

**[`TS8037`](https://typeshade.dev/reference/errors/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, or an empty or four-wide array. The check of the default limits is `WORKGROUP_SHAPE`.

## See also

- [Rule 8.6](https://typeshade.dev/reference/rules/8-6/) Test
- [Rule 8.8](https://typeshade.dev/reference/rules/8-8/) Test
- [Design rules](https://typeshade.dev/reference/rules/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

The rule at commit af54ddad5:

- [`docs/language-design.md:833`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L833) (the design document)
- [`reqs/rules/RULE-0807.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0807.md) (its traceability item)
