← all workloads

existential_aggregate

An interface-typed *field* inside a struct (`Scene { IMat m; ... }`), with n implementations selected at runtime through a switch. Unlike `dynamic_dispatch` (a bare local existential), boxing the existential in an aggregate forces `legalizeExistentialTypeLayout` to float the existential field out and recompute the parent layout, and feeds specializeModule a witness-table-per-case blowup. Stresses specializeModule + legalizeExistentialTypeLayout + the downstream simplifyIR. Scales by breadth (number of implementations / switch cases).

bucket: dynamic_dispatch  ·  compile mode: target  ·  flags: -target spirv -emit-spirv-directly  ·  default N: 100

Phase composition across releases

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.

existential_aggregate — full phase breakdown across releases (median ms) existential_aggregate 1.52× 0.0 114 227 daily → 25.14 25.15 25.16 25.17 25.18 25.19 25.20 25.21 25.22 25.23 25.24 26.1 26.2 26.3 26.4 26.5 26.7 26.8 26.9 26.10 26.11 06-25 06-26 existential_aggregate — parseTranslationUnit existential_aggregate — SemanticChecking existential_aggregate — generateIR existential_aggregate — frontEndExecute (self) existential_aggregate — specializeModule existential_aggregate — simplifyIR existential_aggregate — linkIR existential_aggregate — unrollLoopsInModule existential_aggregate — legalizeResourceTypes existential_aggregate — legalizeExistentialTypeLayout existential_aggregate — performMandatoryEarlyInlining existential_aggregate — performForceInlining existential_aggregate — linkAndOptimizeIR (self) existential_aggregate — generateOutput (self) existential_aggregate — compileInner (self) phase buckets parseTranslationUnit SemanticChecking generateIR frontEndExecute (self) specializeModule simplifyIR linkIR unrollLoopsInModule legalizeResourceTypes legalizeExistentialTypeLayout performMandatoryEarlyInlining performForceInlining linkAndOptimizeIR (self) emitEntryPointsSourceFromIR generateOutput (self) compileInner (self)

Compiled Slang source

exact compiled source (N = 100); long files show the first 40 lines, the area around computeMain (±40), and the last 40 lines (gaps elided)

existential_aggregate.slang

// AUTO-GENERATED by perf-suite/workloads.py — do not edit by hand.
RWStructuredBuffer<float> outBuf;

[anyValueSize(16)]
interface IMat { float shade(float x); }

struct M0 : IMat { float shade(float x) { return x * 1.0 + 0.0 + sin(x * 1.0); } }
struct M1 : IMat { float shade(float x) { return x * 2.0 + 1.0 + sin(x * 2.0); } }
struct M2 : IMat { float shade(float x) { return x * 3.0 + 2.0 + sin(x * 3.0); } }
struct M3 : IMat { float shade(float x) { return x * 4.0 + 3.0 + sin(x * 4.0); } }
struct M4 : IMat { float shade(float x) { return x * 5.0 + 4.0 + sin(x * 5.0); } }
struct M5 : IMat { float shade(float x) { return x * 6.0 + 5.0 + sin(x * 6.0); } }
struct M6 : IMat { float shade(float x) { return x * 7.0 + 6.0 + sin(x * 7.0); } }
struct M7 : IMat { float shade(float x) { return x * 8.0 + 7.0 + sin(x * 1.0); } }
struct M8 : IMat { float shade(float x) { return x * 9.0 + 8.0 + sin(x * 2.0); } }
struct M9 : IMat { float shade(float x) { return x * 10.0 + 9.0 + sin(x * 3.0); } }
struct M10 : IMat { float shade(float x) { return x * 11.0 + 10.0 + sin(x * 4.0); } }
struct M11 : IMat { float shade(float x) { return x * 12.0 + 11.0 + sin(x * 5.0); } }
struct M12 : IMat { float shade(float x) { return x * 13.0 + 12.0 + sin(x * 6.0); } }
struct M13 : IMat { float shade(float x) { return x * 14.0 + 13.0 + sin(x * 7.0); } }
struct M14 : IMat { float shade(float x) { return x * 15.0 + 14.0 + sin(x * 1.0); } }
struct M15 : IMat { float shade(float x) { return x * 16.0 + 15.0 + sin(x * 2.0); } }
struct M16 : IMat { float shade(float x) { return x * 17.0 + 16.0 + sin(x * 3.0); } }
struct M17 : IMat { float shade(float x) { return x * 18.0 + 17.0 + sin(x * 4.0); } }
struct M18 : IMat { float shade(float x) { return x * 19.0 + 18.0 + sin(x * 5.0); } }
struct M19 : IMat { float shade(float x) { return x * 20.0 + 19.0 + sin(x * 6.0); } }
struct M20 : IMat { float shade(float x) { return x * 21.0 + 20.0 + sin(x * 7.0); } }
struct M21 : IMat { float shade(float x) { return x * 22.0 + 21.0 + sin(x * 1.0); } }
struct M22 : IMat { float shade(float x) { return x * 23.0 + 22.0 + sin(x * 2.0); } }
struct M23 : IMat { float shade(float x) { return x * 24.0 + 23.0 + sin(x * 3.0); } }
struct M24 : IMat { float shade(float x) { return x * 25.0 + 24.0 + sin(x * 4.0); } }
struct M25 : IMat { float shade(float x) { return x * 26.0 + 25.0 + sin(x * 5.0); } }
struct M26 : IMat { float shade(float x) { return x * 27.0 + 26.0 + sin(x * 6.0); } }
struct M27 : IMat { float shade(float x) { return x * 28.0 + 27.0 + sin(x * 7.0); } }
struct M28 : IMat { float shade(float x) { return x * 29.0 + 28.0 + sin(x * 1.0); } }
struct M29 : IMat { float shade(float x) { return x * 30.0 + 29.0 + sin(x * 2.0); } }
struct M30 : IMat { float shade(float x) { return x * 31.0 + 30.0 + sin(x * 3.0); } }
struct M31 : IMat { float shade(float x) { return x * 32.0 + 31.0 + sin(x * 4.0); } }
struct M32 : IMat { float shade(float x) { return x * 33.0 + 32.0 + sin(x * 5.0); } }
struct M33 : IMat { float shade(float x) { return x * 34.0 + 33.0 + sin(x * 6.0); } }

// … 33 lines omitted …

struct M67 : IMat { float shade(float x) { return x * 68.0 + 67.0 + sin(x * 5.0); } }
struct M68 : IMat { float shade(float x) { return x * 69.0 + 68.0 + sin(x * 6.0); } }
struct M69 : IMat { float shade(float x) { return x * 70.0 + 69.0 + sin(x * 7.0); } }
struct M70 : IMat { float shade(float x) { return x * 71.0 + 70.0 + sin(x * 1.0); } }
struct M71 : IMat { float shade(float x) { return x * 72.0 + 71.0 + sin(x * 2.0); } }
struct M72 : IMat { float shade(float x) { return x * 73.0 + 72.0 + sin(x * 3.0); } }
struct M73 : IMat { float shade(float x) { return x * 74.0 + 73.0 + sin(x * 4.0); } }
struct M74 : IMat { float shade(float x) { return x * 75.0 + 74.0 + sin(x * 5.0); } }
struct M75 : IMat { float shade(float x) { return x * 76.0 + 75.0 + sin(x * 6.0); } }
struct M76 : IMat { float shade(float x) { return x * 77.0 + 76.0 + sin(x * 7.0); } }
struct M77 : IMat { float shade(float x) { return x * 78.0 + 77.0 + sin(x * 1.0); } }
struct M78 : IMat { float shade(float x) { return x * 79.0 + 78.0 + sin(x * 2.0); } }
struct M79 : IMat { float shade(float x) { return x * 80.0 + 79.0 + sin(x * 3.0); } }
struct M80 : IMat { float shade(float x) { return x * 81.0 + 80.0 + sin(x * 4.0); } }
struct M81 : IMat { float shade(float x) { return x * 82.0 + 81.0 + sin(x * 5.0); } }
struct M82 : IMat { float shade(float x) { return x * 83.0 + 82.0 + sin(x * 6.0); } }
struct M83 : IMat { float shade(float x) { return x * 84.0 + 83.0 + sin(x * 7.0); } }
struct M84 : IMat { float shade(float x) { return x * 85.0 + 84.0 + sin(x * 1.0); } }
struct M85 : IMat { float shade(float x) { return x * 86.0 + 85.0 + sin(x * 2.0); } }
struct M86 : IMat { float shade(float x) { return x * 87.0 + 86.0 + sin(x * 3.0); } }
struct M87 : IMat { float shade(float x) { return x * 88.0 + 87.0 + sin(x * 4.0); } }
struct M88 : IMat { float shade(float x) { return x * 89.0 + 88.0 + sin(x * 5.0); } }
struct M89 : IMat { float shade(float x) { return x * 90.0 + 89.0 + sin(x * 6.0); } }
struct M90 : IMat { float shade(float x) { return x * 91.0 + 90.0 + sin(x * 7.0); } }
struct M91 : IMat { float shade(float x) { return x * 92.0 + 91.0 + sin(x * 1.0); } }
struct M92 : IMat { float shade(float x) { return x * 93.0 + 92.0 + sin(x * 2.0); } }
struct M93 : IMat { float shade(float x) { return x * 94.0 + 93.0 + sin(x * 3.0); } }
struct M94 : IMat { float shade(float x) { return x * 95.0 + 94.0 + sin(x * 4.0); } }
struct M95 : IMat { float shade(float x) { return x * 96.0 + 95.0 + sin(x * 5.0); } }
struct M96 : IMat { float shade(float x) { return x * 97.0 + 96.0 + sin(x * 6.0); } }
struct M97 : IMat { float shade(float x) { return x * 98.0 + 97.0 + sin(x * 7.0); } }
struct M98 : IMat { float shade(float x) { return x * 99.0 + 98.0 + sin(x * 1.0); } }
struct M99 : IMat { float shade(float x) { return x * 100.0 + 99.0 + sin(x * 2.0); } }

struct Scene { IMat m; float w; }

float shadeScene(Scene sc, float x) { return sc.m.shade(x) * sc.w; }

[shader("compute")]
[numthreads(64,1,1)]
void computeMain(uint3 tid : SV_DispatchThreadID)
{
    float acc = 0.0;
    int base = int(tid.x);
    for (int i = 0; i < 100; ++i)
    {
        Scene sc;
        switch ((base + i) % 100)
        {
        case 0: sc.m = M0(); break;
        case 1: sc.m = M1(); break;
        case 2: sc.m = M2(); break;
        case 3: sc.m = M3(); break;
        case 4: sc.m = M4(); break;
        case 5: sc.m = M5(); break;
        case 6: sc.m = M6(); break;
        case 7: sc.m = M7(); break;
        case 8: sc.m = M8(); break;
        case 9: sc.m = M9(); break;
        case 10: sc.m = M10(); break;
        case 11: sc.m = M11(); break;
        case 12: sc.m = M12(); break;
        case 13: sc.m = M13(); break;
        case 14: sc.m = M14(); break;
        case 15: sc.m = M15(); break;
        case 16: sc.m = M16(); break;
        case 17: sc.m = M17(); break;
        case 18: sc.m = M18(); break;
        case 19: sc.m = M19(); break;
        case 20: sc.m = M20(); break;
        case 21: sc.m = M21(); break;
        case 22: sc.m = M22(); break;
        case 23: sc.m = M23(); break;
        case 24: sc.m = M24(); break;
        case 25: sc.m = M25(); break;
        case 26: sc.m = M26(); break;
        case 27: sc.m = M27(); break;
        case 28: sc.m = M28(); break;
        case 29: sc.m = M29(); break;
        case 30: sc.m = M30(); break;
        case 31: sc.m = M31(); break;

// … 35 lines omitted …

        case 67: sc.m = M67(); break;
        case 68: sc.m = M68(); break;
        case 69: sc.m = M69(); break;
        case 70: sc.m = M70(); break;
        case 71: sc.m = M71(); break;
        case 72: sc.m = M72(); break;
        case 73: sc.m = M73(); break;
        case 74: sc.m = M74(); break;
        case 75: sc.m = M75(); break;
        case 76: sc.m = M76(); break;
        case 77: sc.m = M77(); break;
        case 78: sc.m = M78(); break;
        case 79: sc.m = M79(); break;
        case 80: sc.m = M80(); break;
        case 81: sc.m = M81(); break;
        case 82: sc.m = M82(); break;
        case 83: sc.m = M83(); break;
        case 84: sc.m = M84(); break;
        case 85: sc.m = M85(); break;
        case 86: sc.m = M86(); break;
        case 87: sc.m = M87(); break;
        case 88: sc.m = M88(); break;
        case 89: sc.m = M89(); break;
        case 90: sc.m = M90(); break;
        case 91: sc.m = M91(); break;
        case 92: sc.m = M92(); break;
        case 93: sc.m = M93(); break;
        case 94: sc.m = M94(); break;
        case 95: sc.m = M95(); break;
        case 96: sc.m = M96(); break;
        case 97: sc.m = M97(); break;
        case 98: sc.m = M98(); break;
        case 99: sc.m = M99(); break;
        default: sc.m = M0(); break;
        }
        sc.w = float(i);
        acc += shadeScene(sc, outBuf[0] + float(i));
    }
    outBuf[0] = acc;
}