n resource-bundle structs (each holding two textures, a sampler and a StructuredBuffer) declared at global scope and all read in the entry point. Nesting resource handles inside an aggregate forces `legalizeResourceTypes` to flatten each struct's resource fields into individually-bound resources before a target can consume them — a pass no other workload triggers (every other workload's only resource is a bare RWStructuredBuffer). Resources are kept live (sampled / indexed into the output) so dead-code elimination can't drop them before legalization runs. Scales by breadth = number of bundles, i.e. the count of resource fields the pass must legalize; legalizeResourceTypes grows super-linearly in n. Scaling null: n scales resource-carrying structs, each O(1); ideal legalization cost is O(n) — the measured ~N^1.8 in legalizeResourceTypes is a genuine compiler finding, not a workload property.
bucket: resource_legalize · 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× |
|---|---|---|---|---|---|---|
| 80–640 | 14 | 1.49 | 0.996 | 66 | 1162 | 3.08× |
compileInner grows by 1096 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=80 | t@N=640 | Δ ms | share | × lin | ∝Nk |
|---|---|---|---|---|---|---|
| generateOutput (self) | 12 | 264 | +252 | 23% | 2.57× | 1.59 |
| linkAndOptimizeIR (self) | 8 | 230 | +222 | 20% | 3.18× | 1.73 |
| legalizeResourceTypes | 3 | 208 | +205 | 19% | 4.35× | 1.99 |
| legalizeExistentialTypeLayout | 2 | 126 | +124 | 11% | 4.71× | 2.02 |
| simplifyIR | 6 | 101 | +96 | 9% | 2.05× | 1.42 |
Also growing (below top-5): specializeModule (+79 ms, 7%), generateIR (+54 ms, 5%), SemanticChecking (+34 ms, 3%).
Near-constant (≤2% of growth each): compileInner (self) (2→10 ms), frontEndExecute (self) (2→9 ms), linkIR (2→5 ms), performMandatoryEarlyInlining (0→5 ms), performForceInlining (0→4 ms), parseTranslationUnit (1→3 ms), unrollLoopsInModule (0→0 ms).
| N | compileInner | legalizeResourceTypes | linkAndOptimizeIR |
|---|---|---|---|
| 80 | 66 | 3 | 31 |
| 160 | 139 | 13 | 75 |
| 320 | 377 | 54 | 231 |
| 640 | 1162 | 208 | 768 |