A force-unrolled loop of `n` iterations. Stresses loop unrolling (unrollLoopsInModule) and the downstream SSA simplify on the unrolled body. Scaling null: the unrolled output is O(n), so ideal cost is linear in n (linear in output size).
bucket: loop_unroll · compile mode: target · flags: -target spirv -emit-spirv-directly · default N: 300
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: 270.2 → 216.8 ms -19.7% (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 |
|---|---|---|---|
| legalizeResourceTypes | -13.4 ms | -98.0% | -5.0pp |
| legalizeExistentialTypeLayout | -13.3 ms | -97.9% | -4.9pp |
| specializeModule | -11.9 ms | -11.6% | -4.4pp |
| unrollLoopsInModule | -10.1 ms | -11.4% | -3.7pp |
| simplifyIR | -3.3 ms | -12.2% | -1.2pp |
| generateOutput (self) | -0.9 ms | -7.7% | -0.3pp |
| (remaining 8 buckets) | -0.5 ms | – | -0.2pp |
| readSerializedModuleAST | +1.0 ms | +3.1% | – |
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 %) |
|---|---|---|---|
| 2026-08-04 → 2026-08-05 | -19.7% | 0864e60e6..ff45b15ed | legalizeExistentialTypeLayout -98%, legalizeResourceTypes -98%, specializeModule -12% |
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 loop_unroll --label repro --gen-dir repro-loop_unroll
the complete compiled source (N = 300), shown in full
// AUTO-GENERATED by perf-suite/workloads.py - do not edit by hand.
RWStructuredBuffer<float> outBuf;
[shader("compute")]
[numthreads(1,1,1)]
void computeMain(uint3 tid : SV_DispatchThreadID)
{
float acc = outBuf[tid.x];
[ForceUnroll] for (int i = 0; i < 300; ++i)
acc = acc * 1.0009 + sin(acc + float(i)) * 0.5 - cos(acc * 0.5);
outBuf[0] = acc;
}