One interface, n implementations, called through an existential whose concrete type is chosen at runtime (defeats static specialization, forcing witness-table dynamic dispatch). Stresses dispatch lowering / specializeModule.
bucket: dynamic_dispatch · compile mode: target · flags: -target spirv -emit-spirv-directly · default N: 200
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 = 200); 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.
RWStructuredBuffer<float> outBuf;
[anyValueSize(16)]
interface IShape { float eval(float x); }
struct Shape0 : IShape { float eval(float x) { return x * 1.0 + 0.0 + sin(x * 1.0); } }
struct Shape1 : IShape { float eval(float x) { return x * 2.0 + 1.0 + sin(x * 2.0); } }
struct Shape2 : IShape { float eval(float x) { return x * 3.0 + 2.0 + sin(x * 3.0); } }
struct Shape3 : IShape { float eval(float x) { return x * 4.0 + 3.0 + sin(x * 4.0); } }
struct Shape4 : IShape { float eval(float x) { return x * 5.0 + 4.0 + sin(x * 5.0); } }
struct Shape5 : IShape { float eval(float x) { return x * 6.0 + 5.0 + sin(x * 6.0); } }
struct Shape6 : IShape { float eval(float x) { return x * 7.0 + 6.0 + sin(x * 7.0); } }
struct Shape7 : IShape { float eval(float x) { return x * 8.0 + 7.0 + sin(x * 8.0); } }
struct Shape8 : IShape { float eval(float x) { return x * 9.0 + 8.0 + sin(x * 9.0); } }
struct Shape9 : IShape { float eval(float x) { return x * 10.0 + 9.0 + sin(x * 10.0); } }
struct Shape10 : IShape { float eval(float x) { return x * 11.0 + 10.0 + sin(x * 11.0); } }
struct Shape11 : IShape { float eval(float x) { return x * 12.0 + 11.0 + sin(x * 12.0); } }
struct Shape12 : IShape { float eval(float x) { return x * 13.0 + 12.0 + sin(x * 13.0); } }
struct Shape13 : IShape { float eval(float x) { return x * 14.0 + 13.0 + sin(x * 14.0); } }
struct Shape14 : IShape { float eval(float x) { return x * 15.0 + 14.0 + sin(x * 15.0); } }
struct Shape15 : IShape { float eval(float x) { return x * 16.0 + 15.0 + sin(x * 16.0); } }
struct Shape16 : IShape { float eval(float x) { return x * 17.0 + 16.0 + sin(x * 17.0); } }
struct Shape17 : IShape { float eval(float x) { return x * 18.0 + 17.0 + sin(x * 18.0); } }
struct Shape18 : IShape { float eval(float x) { return x * 19.0 + 18.0 + sin(x * 19.0); } }
struct Shape19 : IShape { float eval(float x) { return x * 20.0 + 19.0 + sin(x * 20.0); } }
struct Shape20 : IShape { float eval(float x) { return x * 21.0 + 20.0 + sin(x * 21.0); } }
struct Shape21 : IShape { float eval(float x) { return x * 22.0 + 21.0 + sin(x * 22.0); } }
struct Shape22 : IShape { float eval(float x) { return x * 23.0 + 22.0 + sin(x * 23.0); } }
struct Shape23 : IShape { float eval(float x) { return x * 24.0 + 23.0 + sin(x * 24.0); } }
struct Shape24 : IShape { float eval(float x) { return x * 25.0 + 24.0 + sin(x * 25.0); } }
struct Shape25 : IShape { float eval(float x) { return x * 26.0 + 25.0 + sin(x * 26.0); } }
struct Shape26 : IShape { float eval(float x) { return x * 27.0 + 26.0 + sin(x * 27.0); } }
struct Shape27 : IShape { float eval(float x) { return x * 28.0 + 27.0 + sin(x * 28.0); } }
struct Shape28 : IShape { float eval(float x) { return x * 29.0 + 28.0 + sin(x * 29.0); } }
struct Shape29 : IShape { float eval(float x) { return x * 30.0 + 29.0 + sin(x * 30.0); } }
struct Shape30 : IShape { float eval(float x) { return x * 31.0 + 30.0 + sin(x * 31.0); } }
struct Shape31 : IShape { float eval(float x) { return x * 32.0 + 31.0 + sin(x * 32.0); } }
struct Shape32 : IShape { float eval(float x) { return x * 33.0 + 32.0 + sin(x * 33.0); } }
struct Shape33 : IShape { float eval(float x) { return x * 34.0 + 33.0 + sin(x * 34.0); } }
// … 341 lines omitted …
case 169: s = Shape169(); break;
case 170: s = Shape170(); break;
case 171: s = Shape171(); break;
case 172: s = Shape172(); break;
case 173: s = Shape173(); break;
case 174: s = Shape174(); break;
case 175: s = Shape175(); break;
case 176: s = Shape176(); break;
case 177: s = Shape177(); break;
case 178: s = Shape178(); break;
case 179: s = Shape179(); break;
case 180: s = Shape180(); break;
case 181: s = Shape181(); break;
case 182: s = Shape182(); break;
case 183: s = Shape183(); break;
case 184: s = Shape184(); break;
case 185: s = Shape185(); break;
case 186: s = Shape186(); break;
case 187: s = Shape187(); break;
case 188: s = Shape188(); break;
case 189: s = Shape189(); break;
case 190: s = Shape190(); break;
case 191: s = Shape191(); break;
case 192: s = Shape192(); break;
case 193: s = Shape193(); break;
case 194: s = Shape194(); break;
case 195: s = Shape195(); break;
case 196: s = Shape196(); break;
case 197: s = Shape197(); break;
case 198: s = Shape198(); break;
case 199: s = Shape199(); break;
default: s = Shape0(); break;
}
return s.eval(x);
}
float run(IShape s, float x) { return s.eval(x); }
[shader("compute")]
[numthreads(1,1,1)]
void computeMain(uint3 tid : SV_DispatchThreadID)
{
float acc = 0.0;
int base = int(tid.x);
for (int i = 0; i < 200; ++i)
acc += dispatch((base + i) % 200, outBuf[0] + float(i));
outBuf[0] = acc;
}