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 | 14 | 1.50 | 0.991 | 72 | 1340 | 3.43× |
compileInner grows by 1268 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 |
|---|---|---|---|---|---|---|
| specializeModule | 21 | 941 | +921 | 73% | 3.84× | 1.85 |
| simplifyIR | 9 | 172 | +163 | 13% | 2.18× | 1.44 |
| generateOutput (self) | 11 | 72 | +61 | 5% | 1.25× | 1.02 |
| linkAndOptimizeIR (self) | 7 | 62 | +55 | 4% | 1.35× | 1.15 |
| generateIR | 6 | 34 | +28 | 2% | 1.09× | 0.91 |
Near-constant (≤2% of growth each): SemanticChecking (14→36 ms), legalizeExistentialTypeLayout (1→8 ms), legalizeResourceTypes (1→6 ms), linkIR (1→4 ms), parseTranslationUnit (1→3 ms), performForceInlining (0→1 ms), compileInner (self) (0→1 ms), performMandatoryEarlyInlining (0→1 ms), frontEndExecute (self) (0→1 ms), unrollLoopsInModule (0→0 ms).
| N | compileInner | specializeModule | legalizeExistentialTypeLayout | simplifyIR |
|---|---|---|---|---|
| 50 | 72 | 21 | 1 | 9 |
| 100 | 147 | 67 | 2 | 21 |
| 200 | 391 | 232 | 4 | 55 |
| 400 | 1340 | 941 | 8 | 172 |