A single moderately complex shader. Compiled to multiple targets by the harness (same source, varying -target) to isolate generateOutput cost. ``n`` scales the amount of straight-line math the backend must emit. Scaling null: n scales op count and the emitted output is O(n); ideal codegen cost is O(n).
bucket: codegen_source · mode: target · flags: -target wgsl
compileInner split into phase buckets (named leaves + (self) residuals) stacked across the sweep sizes — the top edge is compileInner, so you can see which phase drives the scaling.
floor-subtracted power-law fit (t − floor) = a·Nk; floor = the minimal workload (fixed per-compile cost), k the global exponent, top-2× the local high-end doubling ratio.
| N range | floor (ms) | k (work) | fit R² | t(Nmin) | t(Nmax) | top-2× |
|---|---|---|---|---|---|---|
| 100–800 | 9 | 1.67 | 0.991 | 68 | 1879 | 3.87× |
compileInner grows by 1811 ms across the sweep; the mutually-exclusive phase buckets below partition that growth exactly (no nested-timer double counting). × lin is the same metric as the top-level panels, per bucket: the end point vs a linear expectation anchored to the bucket's share of the minimal floor and fitted on the low-N half — 1.0 = grew exactly linearly, >1 bends up. The super-linearity lives where × lin (and k) are red.
| bucket | t@N=100 | t@N=800 | Δ ms | share | × lin | ∝Nk |
|---|---|---|---|---|---|---|
| emitEntryPointsSourceFromIR | 18 | 880 | +862 | 48% | 4.40× | 1.88 |
| legalizeResourceTypes | 7 | 430 | +423 | 23% | 5.28× | 2.02 |
| legalizeExistentialTypeLayout | 6 | 420 | +414 | 23% | 5.01× | 2.01 |
| SemanticChecking | 28 | 106 | +78 | 4% | 0.71× | 0.71 |
Near-constant (≤2% of growth each): generateIR (4→17 ms), specializeModule (2→11 ms), simplifyIR (1→10 ms), parseTranslationUnit (0→2 ms), linkIR (1→1 ms), performMandatoryEarlyInlining (0→0 ms), performForceInlining (0→0 ms), frontEndExecute (self) (1→0 ms), compileInner (self) (0→0 ms), unrollLoopsInModule (0→0 ms).
| N | compileInner | emitEntryPointsSourceFromIR | generateOutput |
|---|---|---|---|
| 100 | 68 | 35 | 35 |
| 200 | 151 | 105 | 105 |
| 400 | 486 | 411 | 412 |
| 800 | 1879 | 1752 | 1753 |