Selene · Runtime · Frontier02 / 13
← Frontier index
RuntimeVerified

Dynamic qubit allocation across windows

Use explicit discard + re-`qubit()` so a k-window sieve runs in O(log N) live qubits, not O(log N)·k.

Results · real Selene shots

recycling_verified

Selene ran the full k ∈ {1, 2, 4} schedule with n_qubits = 6 throughout; collision statistics match the G2 reference within ~0.001.

worst |Δ| vs G2 reference0.0015
JSONsrc/data/demos/nadarasa_g5.json

Why this matters

G2 today holds n+1 qubits live for the entire shot. With explicit discard between windows the same logical schedule could run in O(log N) live qubits. We've never asked Selene to recycle a qubit slot inside a single shot, and the difference matters once N gets larger than the wind-tunnel scale.

What the repo already has

G2 with n_qubits = n + 1 held live across all k windows. The skill's selene-runtime.md notes that `measure()` releases the slot, but no kernel actually exploits it.

What's missing

A G2 variant where each window allocates its own ancilla via `qubit()`, measures it, and discards it before the next window allocates.

Smallest experiment

Build it or kill it

Qubits

n + 1 live (n = 5 for N = 32), regardless of k ∈ {1, 2, 4}

Ancilla pattern

k sequential single-ancilla windows; each ancilla allocated, used, measured, dropped.

Shots

800 shots × 3 k-values × N = 32

Predicted outcome

Selene reports peak-live-qubit-count = n + 1 across all k. Shot statistics match the baseline G2 numbers from src/data/demos/nadarasa_g2.json within Monte-Carlo error.

Refutation criterion

If peak-live-qubit-count grows with k, the runtime is not actually recycling; the card moves to 'partial' and we file a Guppy compiler issue.

Kernel sketch

Untested — sketch only
@guppy
def recycled_two_window() -> None:
    data = array_qubit(5)
    for q in data: h(q)
    for w in range(K):
        a = qubit()             # fresh ancilla each window
        h(a)
        for j in range(5):
            cphase_on(a, data[j], theta_w_j)
        h(a)
        result(f"a{w}", measure(a))  # ancilla released here
    for j, q in enumerate(data):
        h(q); result(f"y{j}", measure(q))

Host pipeline

Parse Selene's per-shot live-qubit trace; assert peak ≤ 6 across all k.

Related

Files in this repo

  • · quantum/nadarasa_g5.py
  • · quantum/nadarasa_g5_lib.py
  • · src/data/demos/nadarasa_g5.json
  • · quantum/nadarasa_g2.py

More in Runtime

2 cards