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 | 9 | 1.32 | 0.990 | 70 | 939 | 2.91× |
compileInner grows by 869 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) | 14 | 340 | +326 | 38% | 2.67× | 1.60 |
| legalizeResourceTypes | 4 | 240 | +236 | 27% | 4.12× | 1.97 |
| legalizeExistentialTypeLayout | 2 | 138 | +136 | 16% | 4.80× | 2.02 |
| SemanticChecking | 27 | 67 | +40 | 5% | 0.53× | 0.50 |
| generateIR | 6 | 35 | +29 | 3% | 0.88× | 0.85 |
Also growing (below top-5): simplifyIR (+27 ms, 3%), linkAndOptimizeIR (self) (+25 ms, 3%), specializeModule (+19 ms, 2%).
Near-constant (≤2% of growth each): compileInner (self) (0→9 ms), frontEndExecute (self) (2→8 ms), linkIR (2→6 ms), performMandatoryEarlyInlining (0→5 ms), performForceInlining (1→4 ms), parseTranslationUnit (1→3 ms), unrollLoopsInModule (0→0 ms).
| N | compileInner | legalizeResourceTypes | linkAndOptimizeIR |
|---|---|---|---|
| 80 | 70 | 4 | 20 |
| 160 | 130 | 16 | 48 |
| 320 | 323 | 62 | 145 |
| 640 | 939 | 240 | 476 |