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 | 11 | 0.99 | 0.999 | 51 | 326 | 1.99× |
compileInner grows by 275 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) | 10 | 70 | +60 | 22% | 1.06× | 1.05 |
| specializeModule | 6 | 46 | +40 | 15% | 1.00× | 1.00 |
| SemanticChecking | 13 | 47 | +34 | 12% | 0.83× | 0.83 |
| linkAndOptimizeIR (self) | 5 | 36 | +31 | 11% | 1.03× | 1.03 |
| generateIR | 6 | 36 | +30 | 11% | 0.96× | 0.94 |
Also growing (below top-5): simplifyIR (+24 ms, 9%), legalizeResourceTypes (+20 ms, 7%), compileInner (self) (+9 ms, 3%), frontEndExecute (self) (+7 ms, 3%).
Near-constant (≤2% of growth each): legalizeExistentialTypeLayout (1→6 ms), performMandatoryEarlyInlining (0→5 ms), linkIR (1→5 ms), performForceInlining (0→3 ms), parseTranslationUnit (1→3 ms), unrollLoopsInModule (0→0 ms).
| N | compileInner | legalizeResourceTypes | linkAndOptimizeIR |
|---|---|---|---|
| 80 | 51 | 1 | 18 |
| 160 | 88 | 3 | 35 |
| 320 | 163 | 7 | 71 |
| 640 | 326 | 21 | 149 |