An interface-typed *field* inside a struct (`Scene { IMat m; ... }`), with n implementations selected at runtime through a switch. Unlike `dynamic_dispatch` (a bare local existential), boxing the existential in an aggregate forces `legalizeExistentialTypeLayout` to float the existential field out and recompute the parent layout, and feeds specializeModule a witness-table-per-case blowup. Stresses specializeModule + legalizeExistentialTypeLayout + the downstream simplifyIR. Scales by breadth (number of implementations / switch cases). Scaling null: n scales cases, each an O(1) body; ideal specialization cost is O(n).
bucket: dynamic_dispatch · mode: target · flags: -target spirv -emit-spirv-directly
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× |
|---|---|---|---|---|---|---|
| 50–400 | 9 | 1.16 | 0.988 | 64 | 622 | 2.56× |
compileInner grows by 558 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=50 | t@N=400 | Δ ms | share | × lin | ∝Nk |
|---|---|---|---|---|---|---|
| simplifyIR | 9 | 223 | +214 | 38% | 2.48× | 1.55 |
| specializeModule | 6 | 156 | +150 | 27% | 2.82× | 1.60 |
| generateOutput (self) | 9 | 64 | +55 | 10% | 1.14× | 1.06 |
| linkAndOptimizeIR (self) | 6 | 58 | +52 | 9% | 1.31× | 1.14 |
| SemanticChecking | 26 | 53 | +27 | 5% | 0.46× | 0.40 |
Also growing (below top-5): generateIR (+25 ms, 5%), legalizeExistentialTypeLayout (+17 ms, 3%).
Near-constant (≤2% of growth each): legalizeResourceTypes (1→11 ms), linkIR (1→4 ms), parseTranslationUnit (1→3 ms), performForceInlining (0→1 ms), performMandatoryEarlyInlining (0→1 ms), unrollLoopsInModule (0→1 ms), frontEndExecute (self) (0→1 ms), compileInner (self) (0→0 ms).
| N | compileInner | specializeModule | legalizeExistentialTypeLayout | simplifyIR |
|---|---|---|---|---|
| 50 | 64 | 6 | 1 | 9 |
| 100 | 108 | 14 | 2 | 24 |
| 200 | 243 | 45 | 6 | 73 |
| 400 | 622 | 156 | 18 | 223 |