Rule 11.7
Chapter 11, Targets and the oracle Test
The CPU tier, which runs a host call of a module’s function and, where there is no GPU tier, the invocations of an entry a host calls and the pixels of a fragment entry a host draws (Rule 8.24), is the oracle’s generated code (generateModuleJs) at f32 precision, written into the module the bundler reads as module code, with no new Function, over the op library alone, typeshade/runtime/internal.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
a host call computes what the GPU would, so it rounds as f32 does, which the default f64 algebra oracle is blind to by construction.
The generated code computes each operation as the interpreter’s runtime helper does: a vector operation of a known width, on operands nothing can leave missing, is written one component at a time, each the scalar operation the helper applies to it (dot, length, distance, normalize and cross summed in the order their entries sum), and every other operation, one on an operand that may be missing (a helper’s discard, an element read past an array’s end) among them, calls the helper itself; src/core/cpu-codegen.test.ts holds the two to each other bit for bit in both precisions, so the tier is the oracle and not a fourth implementation (Rule 11.1).
Building it with new Function at run time would need unsafe-eval, which a strict content security policy forbids, and would ship the IR and the generator; as module code it is minified with the application, and the application ships the op library only.
Derives from
change 0009 in changes/ (“The CPU tier’s precision”); src/core/oracle.ts (the 'f32' mode, “a correctly-rounding f32 machine over the same IR”); Rule 11.1.
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:
hostFace in src/compiler/ts/host-face.ts, which generates at precision: 'f32', and src/core/host-runtime.ts, what a generated module imports through typeshade/runtime/internal; pinned by src/compiler/ts/host-face.test.ts, where every call equals compileModule(m, { precision: 'f32' }) on inputs chosen so the f32 and f64 answers part, and the generated module holds no new Function.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
Explained in
The sections of the surface document that explain this rule, at commit 26de7be8:
See also
Source
The rule at commit 26de7be8:
docs/language-design.md:1162(the design document)reqs/rules/RULE-1107.md(its traceability item)