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 | 10 | 1.55 | 0.996 | 59 | 1226 | 3.32× |
compileInner grows by 1167 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) | 11 | 297 | +286 | 24% | 2.95× | 1.65 |
| linkAndOptimizeIR (self) | 7 | 239 | +232 | 20% | 3.29× | 1.76 |
| legalizeResourceTypes | 3 | 207 | +204 | 17% | 4.34× | 2.01 |
| legalizeExistentialTypeLayout | 2 | 126 | +124 | 11% | 4.68× | 2.01 |
| specializeModule | 7 | 97 | +90 | 8% | 1.69× | 1.29 |
Also growing (below top-5): simplifyIR (+89 ms, 8%), generateIR (+57 ms, 5%), SemanticChecking (+36 ms, 3%), compileInner (self) (+28 ms, 2%).
Near-constant (≤2% of growth each): frontEndExecute (self) (2→8 ms), linkIR (1→5 ms), performMandatoryEarlyInlining (0→5 ms), performForceInlining (0→4 ms), parseTranslationUnit (1→3 ms), unrollLoopsInModule (0→0 ms).
| N | compileInner | legalizeResourceTypes | linkAndOptimizeIR |
|---|---|---|---|
| 80 | 59 | 3 | 25 |
| 160 | 133 | 13 | 69 |
| 320 | 370 | 54 | 224 |
| 640 | 1226 | 207 | 776 |