Selene · Compilation · Frontier card → /selene-frontier/kernel-fusion
[G7] Kernel
fusion
A performance experiment, not a refutation one. Two regimes are measured end-to-end: the existing G3 pipeline (render + compile + build per slope) versus a fused-host regime that compiles + builds once, then runs all shots on the same object. We also probe whether Guppy lets us pass angles as runtime entry-point args — the "true" fusion route.
Verdict
Host-level fusion · 3.47× speedup · host fusion wins
Compiling once and reusing the built runner cuts total wall-clock by 3.47× on a six-slope, 200-shot sweep. Most of the saving comes from compile-and-build amortization, not the shot loop —
build() and the per-program guppy → HUGR → LLVM pipeline dominate.Parametric entry-point blocked by runtime
The "true" fusion route — a single
@guppy program taking angles: array[float, n] as an entry-point argument and looping over slopes via a parametric runner call — is currently rejected by guppylang 0.21.16:GuppyError: EntrypointArgsError(span=Span(start=Loc(file='/tmp/nadarasa_g7_probe/nadarasa_g7_probe_e04d44.py', line=8, column=12), end=Loc(file='/tmp/nadarasa_g7_probe/nadarasa_g7_probe_e04d44.py', line=8, column=35)), _parent=None, children=[EntrypointArgsError.AlternateHint(span=None, _parent=..., function_naThat keeps the card at partial: host-side reuse works today; true in-kernel parametric fusion waits on a runtime change.Wall-clock breakdown (seconds)
Regime details
| regime | compiled kernels | compile (s) | run_shots (s) | wall (s) |
|---|---|---|---|---|
| A · per-slope (G3 baseline) | 6 | 0.89 | 3.07 | 3.96 |
| B · fused-host | 1 | 0.07 | 1.07 | 1.14 |
Kernel snippet
open in Playpond ↗
from quantum.nadarasa_g3_lib import guppy, qubit, h, measure, result, cphase_on
@guppy
def program() -> None:
lbl = qubit()
d0 = qubit()
d1 = qubit()
d2 = qubit()
d3 = qubit()
d4 = qubit()
h(lbl)
h(d0)
h(d1)
h(d2)
h(d3)
h(d4)
cphase_on(lbl, d0, 0.39269908169872414)
cphase_on(lbl, d1, 0.7853981633974483)
cphase_on(lbl, d2, 1.5707963267948966)
cphase_on(lbl, d3, -3.141592653589793)
cphase_on(lbl, d4, 0.0)
h(lbl)
result("lbl", measure(lbl))
h(d0)
result("y0", measure(d0))
h(d1)
result("y1", measure(d1))
h(d2)
result("y2", measure(d2))
h(d3)
result("y3", measure(d3))
h(d4)
result("y4", measure(d4))