A kernel that keeps values in a private (thread) arena through pointers stored in a closure-like
struct, then read back after its stitched calls are inlined, kept every such slot in memory: on
NVIDIA the arena became local memory (4,304 B on the heaviest authored shape) and the kernel ran
6-10x slower than the same arithmetic in registers.
canon::forward now runs once link, byval, erase, inline and devirt are done, and again right
after the first SCCP and the constant-load folds, over the variant the function constants pick
(SCCP runs again only when forwarding changed the body). A load from a thread allocation becomes
the value its single dominating store wrote where type, offset and length match; allocations with
no read left are dropped; inttoptr(ptrtoint p) read back through such a slot becomes p. A load of
an aggregate that holds a pointer, and a load that would read a thread or threadgroup null
pointer (it exists only in memory), stay memory loads. Plain loads and stores only: volatile,
atomic and non-private address spaces are untouched.
Running forward before SCCP first walked every unspecialized body with all function-constant
variants (peak worker 469 MB, work 10.9 M -> 29.3 M units on the scan cases); forwarding over the
specialized body keeps them at the tip's level.
Verified (ftk2, dff96439f6 on 33de04117d):
- NVIDIA statistics: the heavy kernel's local memory 4,304 B -> 0 (registers 59 -> 64); its
sibling stays 0 B. Module words: 28078 -> 14358, 15253 -> 11962, 8132 -> 6846.
- RTX 2080 (26970, runtime CB span, median of 21): the three heavy shapes 0.430/0.470/0.221 ->
0.044/0.046/0.034 ms (6.5-10.3x); others within -1..+3%. RX 7900 XTX (26972): 0.106/0.144/0.068
-> 0.019/0.020/0.014 ms (4.8-7.4x); one conv shape +8% (A/B 27033 pending), another -6%.
- Census (M3, 26969): 2369 cases, 48670 compiled, 1079 refused, 0 failed, 0 differences, 0
regressions, 10362 artifacts moved; peak worker 228 MB, slowest compile 908 ms, wall 116 s.
- Suites (msi 26948/26949) pass but golden_hashes (578 cells, re-blessed on development); clippy
all features, each alone, m2v_gpu and m2v_cpu_icd 0; rustdoc 0. canon/tests/forwarding.rs fails
before and passes after.
- Pipeline state creation on the 2080, cold process: 19-25 ms tip, 21-36 ms with the change,
almost all of it the driver.
SEMANTICS_VERSION 2098 -> 2099.