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 · compile mode: target · flags: -target spirv -emit-spirv-directly · default N: 80
Full sub-counter decomposition of compileInner — named leaf timers plus (self) residuals (a parent's time not covered by a named child, e.g. the autodiff transform in linkAndOptimizeIR (self)). Topmost band traces compileInner; hover a band for its phase.
Overall compileInner: 46.1 → 43.7 ms -5.3% (2026-07-30 7c58a326b → 2026-08-29 28c755b09)
Contributors — the mutually-exclusive phase buckets (named leaves + (self) residuals) that tile compileInner; the pp column sums to the overall %. Buckets moving the total by ≥0.2% are listed, the rest fold into the remainder row. Below them, every other reported counter (nested/overlapping, e.g. serialized-module reads — own change only):
| counter | Δ | own % | of total |
|---|---|---|---|
| linkAndOptimizeIR (self) | -1.1 ms | -30.4% | -2.4pp |
| generateOutput (self) | -0.6 ms | -6.7% | -1.3pp |
| SemanticChecking | +0.3 ms | +2.5% | +0.7pp |
| compileInner (self) | -0.3 ms | -13.4% | -0.6pp |
| frontEndExecute (self) | -0.2 ms | -10.2% | -0.4pp |
| legalizeResourceTypes | -0.2 ms | -13.5% | -0.4pp |
| generateIR | -0.2 ms | -3.3% | -0.3pp |
| simplifyIR | -0.1 ms | -4.1% | -0.3pp |
| legalizeExistentialTypeLayout | -0.1 ms | -16.2% | -0.2pp |
| (remaining 6 buckets) | -0.0 ms | – | -0.0pp |
| loadBuiltinModule | -3.3 ms | -3.1% | – |
| readSerializedModuleAST | -2.2 ms | -6.5% | – |
| readSerializedModuleIR | -1.6 ms | -3.0% | – |
Largest day steps (≥5% of the previous day, both directions; bisect with git log <c0>..<c1> -- source/):
| boundary | % vs prev day | commits | top buckets (own %) |
|---|---|---|---|
| none | |||
Run from the slang repo root. This regenerates the sources below and re-runs this workload's measurement; --gen-dir keeps the generated files (they go to a tempdir and are deleted otherwise).
python3 tools/compile-perf/bench.py --slangc /path/to/slangc --only resource_aggregate --label repro --gen-dir repro-resource_aggregate
the complete compiled source (N = 80), shown in full
// AUTO-GENERATED by perf-suite/workloads.py - do not edit by hand.
struct ResBundle { Texture2D<float4> albedo; Texture2D<float4> normal; SamplerState samp; StructuredBuffer<float> coeffs; }
ResBundle bundle_0;
ResBundle bundle_1;
ResBundle bundle_2;
ResBundle bundle_3;
ResBundle bundle_4;
ResBundle bundle_5;
ResBundle bundle_6;
ResBundle bundle_7;
ResBundle bundle_8;
ResBundle bundle_9;
ResBundle bundle_10;
ResBundle bundle_11;
ResBundle bundle_12;
ResBundle bundle_13;
ResBundle bundle_14;
ResBundle bundle_15;
ResBundle bundle_16;
ResBundle bundle_17;
ResBundle bundle_18;
ResBundle bundle_19;
ResBundle bundle_20;
ResBundle bundle_21;
ResBundle bundle_22;
ResBundle bundle_23;
ResBundle bundle_24;
ResBundle bundle_25;
ResBundle bundle_26;
ResBundle bundle_27;
ResBundle bundle_28;
ResBundle bundle_29;
ResBundle bundle_30;
ResBundle bundle_31;
ResBundle bundle_32;
ResBundle bundle_33;
ResBundle bundle_34;
ResBundle bundle_35;
ResBundle bundle_36;
ResBundle bundle_37;
ResBundle bundle_38;
ResBundle bundle_39;
ResBundle bundle_40;
ResBundle bundle_41;
ResBundle bundle_42;
ResBundle bundle_43;
ResBundle bundle_44;
ResBundle bundle_45;
ResBundle bundle_46;
ResBundle bundle_47;
ResBundle bundle_48;
ResBundle bundle_49;
ResBundle bundle_50;
ResBundle bundle_51;
ResBundle bundle_52;
ResBundle bundle_53;
ResBundle bundle_54;
ResBundle bundle_55;
ResBundle bundle_56;
ResBundle bundle_57;
ResBundle bundle_58;
ResBundle bundle_59;
ResBundle bundle_60;
ResBundle bundle_61;
ResBundle bundle_62;
ResBundle bundle_63;
ResBundle bundle_64;
ResBundle bundle_65;
ResBundle bundle_66;
ResBundle bundle_67;
ResBundle bundle_68;
ResBundle bundle_69;
ResBundle bundle_70;
ResBundle bundle_71;
ResBundle bundle_72;
ResBundle bundle_73;
ResBundle bundle_74;
ResBundle bundle_75;
ResBundle bundle_76;
ResBundle bundle_77;
ResBundle bundle_78;
ResBundle bundle_79;
RWStructuredBuffer<float> outBuf;
[shader("compute")]
[numthreads(8,8,1)]
void computeMain(uint3 tid : SV_DispatchThreadID)
{
float acc = 0.0;
float2 uv = float2(tid.xy) * 0.01;
acc += bundle_0.albedo.SampleLevel(bundle_0.samp, uv, 0).x
+ bundle_0.normal.SampleLevel(bundle_0.samp, uv, 0).y
+ bundle_0.coeffs[tid.x % 16];
acc += bundle_1.albedo.SampleLevel(bundle_1.samp, uv, 0).x
+ bundle_1.normal.SampleLevel(bundle_1.samp, uv, 0).y
+ bundle_1.coeffs[tid.x % 16];
acc += bundle_2.albedo.SampleLevel(bundle_2.samp, uv, 0).x
+ bundle_2.normal.SampleLevel(bundle_2.samp, uv, 0).y
+ bundle_2.coeffs[tid.x % 16];
acc += bundle_3.albedo.SampleLevel(bundle_3.samp, uv, 0).x
+ bundle_3.normal.SampleLevel(bundle_3.samp, uv, 0).y
+ bundle_3.coeffs[tid.x % 16];
acc += bundle_4.albedo.SampleLevel(bundle_4.samp, uv, 0).x
+ bundle_4.normal.SampleLevel(bundle_4.samp, uv, 0).y
+ bundle_4.coeffs[tid.x % 16];
acc += bundle_5.albedo.SampleLevel(bundle_5.samp, uv, 0).x
+ bundle_5.normal.SampleLevel(bundle_5.samp, uv, 0).y
+ bundle_5.coeffs[tid.x % 16];
acc += bundle_6.albedo.SampleLevel(bundle_6.samp, uv, 0).x
+ bundle_6.normal.SampleLevel(bundle_6.samp, uv, 0).y
+ bundle_6.coeffs[tid.x % 16];
acc += bundle_7.albedo.SampleLevel(bundle_7.samp, uv, 0).x
+ bundle_7.normal.SampleLevel(bundle_7.samp, uv, 0).y
+ bundle_7.coeffs[tid.x % 16];
acc += bundle_8.albedo.SampleLevel(bundle_8.samp, uv, 0).x
+ bundle_8.normal.SampleLevel(bundle_8.samp, uv, 0).y
+ bundle_8.coeffs[tid.x % 16];
acc += bundle_9.albedo.SampleLevel(bundle_9.samp, uv, 0).x
+ bundle_9.normal.SampleLevel(bundle_9.samp, uv, 0).y
+ bundle_9.coeffs[tid.x % 16];
acc += bundle_10.albedo.SampleLevel(bundle_10.samp, uv, 0).x
+ bundle_10.normal.SampleLevel(bundle_10.samp, uv, 0).y
+ bundle_10.coeffs[tid.x % 16];
acc += bundle_11.albedo.SampleLevel(bundle_11.samp, uv, 0).x
+ bundle_11.normal.SampleLevel(bundle_11.samp, uv, 0).y
+ bundle_11.coeffs[tid.x % 16];
acc += bundle_12.albedo.SampleLevel(bundle_12.samp, uv, 0).x
+ bundle_12.normal.SampleLevel(bundle_12.samp, uv, 0).y
+ bundle_12.coeffs[tid.x % 16];
acc += bundle_13.albedo.SampleLevel(bundle_13.samp, uv, 0).x
+ bundle_13.normal.SampleLevel(bundle_13.samp, uv, 0).y
+ bundle_13.coeffs[tid.x % 16];
acc += bundle_14.albedo.SampleLevel(bundle_14.samp, uv, 0).x
+ bundle_14.normal.SampleLevel(bundle_14.samp, uv, 0).y
+ bundle_14.coeffs[tid.x % 16];
acc += bundle_15.albedo.SampleLevel(bundle_15.samp, uv, 0).x
+ bundle_15.normal.SampleLevel(bundle_15.samp, uv, 0).y
+ bundle_15.coeffs[tid.x % 16];
acc += bundle_16.albedo.SampleLevel(bundle_16.samp, uv, 0).x
+ bundle_16.normal.SampleLevel(bundle_16.samp, uv, 0).y
+ bundle_16.coeffs[tid.x % 16];
acc += bundle_17.albedo.SampleLevel(bundle_17.samp, uv, 0).x
+ bundle_17.normal.SampleLevel(bundle_17.samp, uv, 0).y
+ bundle_17.coeffs[tid.x % 16];
acc += bundle_18.albedo.SampleLevel(bundle_18.samp, uv, 0).x
+ bundle_18.normal.SampleLevel(bundle_18.samp, uv, 0).y
+ bundle_18.coeffs[tid.x % 16];
acc += bundle_19.albedo.SampleLevel(bundle_19.samp, uv, 0).x
+ bundle_19.normal.SampleLevel(bundle_19.samp, uv, 0).y
+ bundle_19.coeffs[tid.x % 16];
acc += bundle_20.albedo.SampleLevel(bundle_20.samp, uv, 0).x
+ bundle_20.normal.SampleLevel(bundle_20.samp, uv, 0).y
+ bundle_20.coeffs[tid.x % 16];
acc += bundle_21.albedo.SampleLevel(bundle_21.samp, uv, 0).x
+ bundle_21.normal.SampleLevel(bundle_21.samp, uv, 0).y
+ bundle_21.coeffs[tid.x % 16];
acc += bundle_22.albedo.SampleLevel(bundle_22.samp, uv, 0).x
+ bundle_22.normal.SampleLevel(bundle_22.samp, uv, 0).y
+ bundle_22.coeffs[tid.x % 16];
acc += bundle_23.albedo.SampleLevel(bundle_23.samp, uv, 0).x
+ bundle_23.normal.SampleLevel(bundle_23.samp, uv, 0).y
+ bundle_23.coeffs[tid.x % 16];
acc += bundle_24.albedo.SampleLevel(bundle_24.samp, uv, 0).x
+ bundle_24.normal.SampleLevel(bundle_24.samp, uv, 0).y
+ bundle_24.coeffs[tid.x % 16];
acc += bundle_25.albedo.SampleLevel(bundle_25.samp, uv, 0).x
+ bundle_25.normal.SampleLevel(bundle_25.samp, uv, 0).y
+ bundle_25.coeffs[tid.x % 16];
acc += bundle_26.albedo.SampleLevel(bundle_26.samp, uv, 0).x
+ bundle_26.normal.SampleLevel(bundle_26.samp, uv, 0).y
+ bundle_26.coeffs[tid.x % 16];
acc += bundle_27.albedo.SampleLevel(bundle_27.samp, uv, 0).x
+ bundle_27.normal.SampleLevel(bundle_27.samp, uv, 0).y
+ bundle_27.coeffs[tid.x % 16];
acc += bundle_28.albedo.SampleLevel(bundle_28.samp, uv, 0).x
+ bundle_28.normal.SampleLevel(bundle_28.samp, uv, 0).y
+ bundle_28.coeffs[tid.x % 16];
acc += bundle_29.albedo.SampleLevel(bundle_29.samp, uv, 0).x
+ bundle_29.normal.SampleLevel(bundle_29.samp, uv, 0).y
+ bundle_29.coeffs[tid.x % 16];
acc += bundle_30.albedo.SampleLevel(bundle_30.samp, uv, 0).x
+ bundle_30.normal.SampleLevel(bundle_30.samp, uv, 0).y
+ bundle_30.coeffs[tid.x % 16];
acc += bundle_31.albedo.SampleLevel(bundle_31.samp, uv, 0).x
+ bundle_31.normal.SampleLevel(bundle_31.samp, uv, 0).y
+ bundle_31.coeffs[tid.x % 16];
acc += bundle_32.albedo.SampleLevel(bundle_32.samp, uv, 0).x
+ bundle_32.normal.SampleLevel(bundle_32.samp, uv, 0).y
+ bundle_32.coeffs[tid.x % 16];
acc += bundle_33.albedo.SampleLevel(bundle_33.samp, uv, 0).x
+ bundle_33.normal.SampleLevel(bundle_33.samp, uv, 0).y
+ bundle_33.coeffs[tid.x % 16];
acc += bundle_34.albedo.SampleLevel(bundle_34.samp, uv, 0).x
+ bundle_34.normal.SampleLevel(bundle_34.samp, uv, 0).y
+ bundle_34.coeffs[tid.x % 16];
acc += bundle_35.albedo.SampleLevel(bundle_35.samp, uv, 0).x
+ bundle_35.normal.SampleLevel(bundle_35.samp, uv, 0).y
+ bundle_35.coeffs[tid.x % 16];
acc += bundle_36.albedo.SampleLevel(bundle_36.samp, uv, 0).x
+ bundle_36.normal.SampleLevel(bundle_36.samp, uv, 0).y
+ bundle_36.coeffs[tid.x % 16];
acc += bundle_37.albedo.SampleLevel(bundle_37.samp, uv, 0).x
+ bundle_37.normal.SampleLevel(bundle_37.samp, uv, 0).y
+ bundle_37.coeffs[tid.x % 16];
acc += bundle_38.albedo.SampleLevel(bundle_38.samp, uv, 0).x
+ bundle_38.normal.SampleLevel(bundle_38.samp, uv, 0).y
+ bundle_38.coeffs[tid.x % 16];
acc += bundle_39.albedo.SampleLevel(bundle_39.samp, uv, 0).x
+ bundle_39.normal.SampleLevel(bundle_39.samp, uv, 0).y
+ bundle_39.coeffs[tid.x % 16];
acc += bundle_40.albedo.SampleLevel(bundle_40.samp, uv, 0).x
+ bundle_40.normal.SampleLevel(bundle_40.samp, uv, 0).y
+ bundle_40.coeffs[tid.x % 16];
acc += bundle_41.albedo.SampleLevel(bundle_41.samp, uv, 0).x
+ bundle_41.normal.SampleLevel(bundle_41.samp, uv, 0).y
+ bundle_41.coeffs[tid.x % 16];
acc += bundle_42.albedo.SampleLevel(bundle_42.samp, uv, 0).x
+ bundle_42.normal.SampleLevel(bundle_42.samp, uv, 0).y
+ bundle_42.coeffs[tid.x % 16];
acc += bundle_43.albedo.SampleLevel(bundle_43.samp, uv, 0).x
+ bundle_43.normal.SampleLevel(bundle_43.samp, uv, 0).y
+ bundle_43.coeffs[tid.x % 16];
acc += bundle_44.albedo.SampleLevel(bundle_44.samp, uv, 0).x
+ bundle_44.normal.SampleLevel(bundle_44.samp, uv, 0).y
+ bundle_44.coeffs[tid.x % 16];
acc += bundle_45.albedo.SampleLevel(bundle_45.samp, uv, 0).x
+ bundle_45.normal.SampleLevel(bundle_45.samp, uv, 0).y
+ bundle_45.coeffs[tid.x % 16];
acc += bundle_46.albedo.SampleLevel(bundle_46.samp, uv, 0).x
+ bundle_46.normal.SampleLevel(bundle_46.samp, uv, 0).y
+ bundle_46.coeffs[tid.x % 16];
acc += bundle_47.albedo.SampleLevel(bundle_47.samp, uv, 0).x
+ bundle_47.normal.SampleLevel(bundle_47.samp, uv, 0).y
+ bundle_47.coeffs[tid.x % 16];
acc += bundle_48.albedo.SampleLevel(bundle_48.samp, uv, 0).x
+ bundle_48.normal.SampleLevel(bundle_48.samp, uv, 0).y
+ bundle_48.coeffs[tid.x % 16];
acc += bundle_49.albedo.SampleLevel(bundle_49.samp, uv, 0).x
+ bundle_49.normal.SampleLevel(bundle_49.samp, uv, 0).y
+ bundle_49.coeffs[tid.x % 16];
acc += bundle_50.albedo.SampleLevel(bundle_50.samp, uv, 0).x
+ bundle_50.normal.SampleLevel(bundle_50.samp, uv, 0).y
+ bundle_50.coeffs[tid.x % 16];
acc += bundle_51.albedo.SampleLevel(bundle_51.samp, uv, 0).x
+ bundle_51.normal.SampleLevel(bundle_51.samp, uv, 0).y
+ bundle_51.coeffs[tid.x % 16];
acc += bundle_52.albedo.SampleLevel(bundle_52.samp, uv, 0).x
+ bundle_52.normal.SampleLevel(bundle_52.samp, uv, 0).y
+ bundle_52.coeffs[tid.x % 16];
acc += bundle_53.albedo.SampleLevel(bundle_53.samp, uv, 0).x
+ bundle_53.normal.SampleLevel(bundle_53.samp, uv, 0).y
+ bundle_53.coeffs[tid.x % 16];
acc += bundle_54.albedo.SampleLevel(bundle_54.samp, uv, 0).x
+ bundle_54.normal.SampleLevel(bundle_54.samp, uv, 0).y
+ bundle_54.coeffs[tid.x % 16];
acc += bundle_55.albedo.SampleLevel(bundle_55.samp, uv, 0).x
+ bundle_55.normal.SampleLevel(bundle_55.samp, uv, 0).y
+ bundle_55.coeffs[tid.x % 16];
acc += bundle_56.albedo.SampleLevel(bundle_56.samp, uv, 0).x
+ bundle_56.normal.SampleLevel(bundle_56.samp, uv, 0).y
+ bundle_56.coeffs[tid.x % 16];
acc += bundle_57.albedo.SampleLevel(bundle_57.samp, uv, 0).x
+ bundle_57.normal.SampleLevel(bundle_57.samp, uv, 0).y
+ bundle_57.coeffs[tid.x % 16];
acc += bundle_58.albedo.SampleLevel(bundle_58.samp, uv, 0).x
+ bundle_58.normal.SampleLevel(bundle_58.samp, uv, 0).y
+ bundle_58.coeffs[tid.x % 16];
acc += bundle_59.albedo.SampleLevel(bundle_59.samp, uv, 0).x
+ bundle_59.normal.SampleLevel(bundle_59.samp, uv, 0).y
+ bundle_59.coeffs[tid.x % 16];
acc += bundle_60.albedo.SampleLevel(bundle_60.samp, uv, 0).x
+ bundle_60.normal.SampleLevel(bundle_60.samp, uv, 0).y
+ bundle_60.coeffs[tid.x % 16];
acc += bundle_61.albedo.SampleLevel(bundle_61.samp, uv, 0).x
+ bundle_61.normal.SampleLevel(bundle_61.samp, uv, 0).y
+ bundle_61.coeffs[tid.x % 16];
acc += bundle_62.albedo.SampleLevel(bundle_62.samp, uv, 0).x
+ bundle_62.normal.SampleLevel(bundle_62.samp, uv, 0).y
+ bundle_62.coeffs[tid.x % 16];
acc += bundle_63.albedo.SampleLevel(bundle_63.samp, uv, 0).x
+ bundle_63.normal.SampleLevel(bundle_63.samp, uv, 0).y
+ bundle_63.coeffs[tid.x % 16];
acc += bundle_64.albedo.SampleLevel(bundle_64.samp, uv, 0).x
+ bundle_64.normal.SampleLevel(bundle_64.samp, uv, 0).y
+ bundle_64.coeffs[tid.x % 16];
acc += bundle_65.albedo.SampleLevel(bundle_65.samp, uv, 0).x
+ bundle_65.normal.SampleLevel(bundle_65.samp, uv, 0).y
+ bundle_65.coeffs[tid.x % 16];
acc += bundle_66.albedo.SampleLevel(bundle_66.samp, uv, 0).x
+ bundle_66.normal.SampleLevel(bundle_66.samp, uv, 0).y
+ bundle_66.coeffs[tid.x % 16];
acc += bundle_67.albedo.SampleLevel(bundle_67.samp, uv, 0).x
+ bundle_67.normal.SampleLevel(bundle_67.samp, uv, 0).y
+ bundle_67.coeffs[tid.x % 16];
acc += bundle_68.albedo.SampleLevel(bundle_68.samp, uv, 0).x
+ bundle_68.normal.SampleLevel(bundle_68.samp, uv, 0).y
+ bundle_68.coeffs[tid.x % 16];
acc += bundle_69.albedo.SampleLevel(bundle_69.samp, uv, 0).x
+ bundle_69.normal.SampleLevel(bundle_69.samp, uv, 0).y
+ bundle_69.coeffs[tid.x % 16];
acc += bundle_70.albedo.SampleLevel(bundle_70.samp, uv, 0).x
+ bundle_70.normal.SampleLevel(bundle_70.samp, uv, 0).y
+ bundle_70.coeffs[tid.x % 16];
acc += bundle_71.albedo.SampleLevel(bundle_71.samp, uv, 0).x
+ bundle_71.normal.SampleLevel(bundle_71.samp, uv, 0).y
+ bundle_71.coeffs[tid.x % 16];
acc += bundle_72.albedo.SampleLevel(bundle_72.samp, uv, 0).x
+ bundle_72.normal.SampleLevel(bundle_72.samp, uv, 0).y
+ bundle_72.coeffs[tid.x % 16];
acc += bundle_73.albedo.SampleLevel(bundle_73.samp, uv, 0).x
+ bundle_73.normal.SampleLevel(bundle_73.samp, uv, 0).y
+ bundle_73.coeffs[tid.x % 16];
acc += bundle_74.albedo.SampleLevel(bundle_74.samp, uv, 0).x
+ bundle_74.normal.SampleLevel(bundle_74.samp, uv, 0).y
+ bundle_74.coeffs[tid.x % 16];
acc += bundle_75.albedo.SampleLevel(bundle_75.samp, uv, 0).x
+ bundle_75.normal.SampleLevel(bundle_75.samp, uv, 0).y
+ bundle_75.coeffs[tid.x % 16];
acc += bundle_76.albedo.SampleLevel(bundle_76.samp, uv, 0).x
+ bundle_76.normal.SampleLevel(bundle_76.samp, uv, 0).y
+ bundle_76.coeffs[tid.x % 16];
acc += bundle_77.albedo.SampleLevel(bundle_77.samp, uv, 0).x
+ bundle_77.normal.SampleLevel(bundle_77.samp, uv, 0).y
+ bundle_77.coeffs[tid.x % 16];
acc += bundle_78.albedo.SampleLevel(bundle_78.samp, uv, 0).x
+ bundle_78.normal.SampleLevel(bundle_78.samp, uv, 0).y
+ bundle_78.coeffs[tid.x % 16];
acc += bundle_79.albedo.SampleLevel(bundle_79.samp, uv, 0).x
+ bundle_79.normal.SampleLevel(bundle_79.samp, uv, 0).y
+ bundle_79.coeffs[tid.x % 16];
outBuf[tid.x] = acc;
}