Real feed-forward, not measure-and-reset glue
Branch a Guppy gate on a mid-circuit measurement outcome instead of faking it with measure-and-reset.
Results · real Selene shots
feed_forward_verifiedGuppy `if measured_bit: rz(...)` fires inside one compiled shot — observed branch-split tracks sin²(θ/2) within 0.02 across five θ values.
Why this matters
G2's two-window kernel fakes the inter-window classical channel by measuring the ancilla and re-preparing the data register. Real H-series hardware exposes a conditional-on-classical-bit gate path that Selene also models. We've never asked Selene to actually take that path; every kernel in this repo is a one-shot circuit followed by a terminal measurement (with G2's one mid-circuit measure as the only exception, and even that one is followed by reset, not branching).
What the repo already has
quantum/nadarasa_g2.py — one mid-circuit measure on the parity ancilla, then a classical reset. The control flow lives in the host driver, not in the @guppy kernel.
What's missing
A Guppy kernel that calls `measure(a)` mid-circuit, stores the result in a classical bit, and applies a downstream gate conditioned on that bit — all inside the same compiled program, with no host round-trip.
Smallest experiment
Build it or kill itQubits
4 data + 1 parity ancilla
Ancilla pattern
Single ancilla, mid-circuit measure, classical bit feeds an `if`-conditioned `rz` kickback on a chosen data qubit.
Shots
2000 shots × 2 input states (with and without the conditional kickback)
Predicted outcome
The two versions produce identical readout when the conditional gate is off, and a fixed phase offset when it's on. Histogram of the final measurement should show a single bimodal split exactly matching the classical bit's marginal.
Refutation criterion
If the conditional gate fails to fire (output looks like the no-op version), or if Selene rejects the construct at compile time, the 'real feed-forward' card is downgraded from untouched to blocked-by-runtime.
Kernel sketch
Untested — sketch only# pseudocode — not yet compiled
@guppy
def cond_kickback() -> None:
d0, d1, d2, d3 = qubit(), qubit(), qubit(), qubit()
a = qubit()
for q in (d0, d1, d2, d3): h(q)
h(a); cx(a, d0); h(a)
b = measure(a) # classical bit
if b: # Guppy conditional, evaluated at runtime
rz(d2, angle(math.pi / 2))
for j, q in enumerate((d0, d1, d2, d3)):
h(q); result(f"y{j}", measure(q))
result("b", b)Host pipeline
Decode `b` and y-bits per shot; split histogram by `b`; verify the phase-shifted branch matches the analytic prediction.
Related
Files in this repo
- · quantum/nadarasa_g4.py
- · quantum/nadarasa_g4_lib.py
- · src/data/demos/nadarasa_g4.json
- · quantum/nadarasa_g2.py
- · .workspace/skills/quantinuum/references/selene-runtime.md