Repository navigation
[qec] Move lattice-surgery Stim rounds behind StimRoundEmitter - #525
Conversation
Each lattice-surgery round kind now emits through a StimRoundEmitter impl. lattice_round_emitter is the only match that selects one. Checked-in Stim gold stays byte-identical. Issue 473 stays open. Single-block memory Stim is still one function, and the lattice-surgery builder is still over 80 lines. Co-authored-by: Arnab Ghosh <ag2583@cornell.edu>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| /// Select the impl for `kind`. | ||
| /// | ||
| /// This match is the registry. Emit logic for a kind lives on its impl. | ||
| pub(crate) fn lattice_round_emitter(kind: RoundKind) -> &'static dyn StimRoundEmitter { |
There was a problem hiding this comment.
Approve. I would merge this slice.
lattice_round_emitter is a registry: each arm returns a different StimRoundEmitter impl, and emit_stim_lattice_surgery_cx calls emit on that &dyn StimRoundEmitter. Construct, memory, measure-logical, rough merge, smooth merge, split, ancilla measure, frame update, and magic consumption each have an impl. The schedule walk does not match on RoundKind.
stim_structure_matches_checked_in_gold locks repetition d=3, surface d=3 Z, surface d=3 X, and lattice-surgery CX against the checked-in files. The registry test covers every RoundKind, and MarkerEmit appends through the trait. This file has no unwrap or expect outside #[cfg(test)]. The PR body and commit say issue 473 stays open; there is no Fixes/Closes/Resolves keyword.
Left on 473, as this PR already says: emit_stim_single_block_memory is still 172 lines and does not use the trait, and emit_stim_lattice_surgery_cx is still 156 lines because the header, reset, and observable assembly stay in the builder. A new RoundKind is still one arm in this function.
Summary
Partial slice of #473. Lattice-surgery Stim rounds move out of the
matchinsideemit_stim_lattice_surgery_cxand behindStimRoundEmitter.lattice_round_emitteris the only match that selects an impl. A new round kind is a new impl plus one registry arm.Issue 473 stays open.
emit_stim_single_block_memoryis still about 170 lines.emit_stim_lattice_surgery_cxis still about 155 lines: the header, reset, and observable assembly stay in the circuit builder.Behavior
Out of scope