Rule 11.20
Chapter 11, Targets and the oracle Test
A common module is a shader package the compiler repository publishes under a typeshade/<name> subpath: typeshade/algorithms and typeshade/random (change 0072). Every function of it is written in "use typeshade". Every function of it gives, on WebGPU, on WebGL2 and on the CPU tier, the bits the CPU oracle gives, under the determinism report’s rows (Rule 11.5), and the differential gate holds that. Every kernel function of it satisfies the planner’s facts (Rule 11.13), so that it fuses with its neighbours in a fuse scope. A common module imports typeshade/runtime and its sibling modules, and nothing of the compiler. The subpath serves two faces (change 0024): a "use typeshade" file imports the shader module under the typeshade condition, and host code imports the host face under default, which the compiler repository bakes from the shader module with the function the Vite plugin and tshc run.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
two hosts built on the compiler each wrote the same copy, maps, reductions, scan and random draw, with their own tests on their own tiers, and a fix in one reached neither the other nor the compiler. A module here inherits the oracle as its reference implementation, the differential gate and the change control, and proves that the language can write its own library, as C’s libc is written in C. A kernel function cannot carry a builtin’s name (it is then no kernel function), so a map or a reduction named <op>Map or <op>All in the shader module is exported by the host face under the builtin’s name (change 0072, Amendment 1).
Derives from
change 0072 in changes/, with its Amendment 1; Rule 11.5; Rule 11.8; Rule 11.13; change 0024 (the typeshade condition).
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:
scripts/bake-common-modules.ts, which bakes face.ts, view.ts and index.ts of each module from its index.shade.ts, and src/common-modules.test.ts, which holds the baked files to the bake, each function to its contract on the CPU tier, fillUniform to generator(seed), and the facts of each face to the planner’s grouping; scripts/gpu-differential.ts, whose common-module arm runs every function of both modules on WebGPU and on WebGL2 against the f32 oracle; scripts/bundle-boundary.ts, which holds each host face to src/runtime/ and src/core/ and to its budget in scripts/bundle-budget.json; src/api-surface.test.ts and src/api-doc-coverage.test.ts, which read the two subpaths.
The files that verify it at commit 91c2fe31, each at the first line that names the rule:
Explained in
The sections of the surface document that explain this rule, at commit 91c2fe31:
See also
Source
The rule at commit 91c2fe31:
docs/language-design.md:1401(the design document)reqs/rules/RULE-1120.md(its traceability item)