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.
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.
exact compiled source (N = 80); long files show the first 40 lines, the area around computeMain (±40), and the last 40 lines (gaps elided)
// 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;
// … 8 lines omitted …
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
// … 165 lines omitted …
+ 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;
}