Skip to content

[qec] Route single-block memory Stim through StimRoundEmitter - #529

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/single-block-stim-emitter-9f6a
Oct 1, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/single-block-stim-emitter-9f6a

Conversation

@arniber21

Copy link
Copy Markdown
Owner

Summary

Partial slice of #473. emit_stim_single_block_memory now walks the schedule through the same StimRoundEmitter registry as lattice surgery. Construct, memory, and measure-logical implement emit_single_block. Surgery-only kinds stay silent on this path, which is what the single-block builder already did.

Issue 473 stays open. The single-block builder is still about 155 lines: the header, reset, and observable assembly stay there. emit_stim_lattice_surgery_cx is unchanged and still over 80 lines.

Behavior

  • Checked-in Stim gold for repetition d=3, surface d=3 (Z and X), and lattice-surgery CX d=3 stays byte-identical.
  • The first construct's locals are still emitted before memory rounds. A later construct in the walk does not emit again.
  • The final MZ/MX, closing detectors, and OBSERVABLE_INCLUDE still run after the walk. The measure-logical impl only records the first round.

Out of scope

  • Shrinking either Stim builder under about 80 lines
  • Changing lattice-surgery instruction text
Open in Web Open in Cursor 

emit_stim_single_block_memory walks the schedule with the same
lattice_round_emitter registry. Construct, memory, and measure-logical
use emit_single_block. Surgery-only kinds stay silent on this path.
Checked-in Stim gold stays byte-identical.

Issue 473 stays open. The single-block builder is still about 155 lines
because the header, reset, and observable assembly stay in place.

Co-authored-by: Arnab Ghosh <ag2583@cornell.edu>
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
quon Ready Ready Preview Oct 1, 2026 6:45am UTC

emit_local_ops(&mut ctx.out, &prep);
}
for round in &expanded.rounds {
stim_emit::lattice_round_emitter(round.kind).emit_single_block(&mut ctx, round)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. I would merge this slice.

The schedule walk calls StimRoundEmitter::emit_single_block on the impl lattice_round_emitter returns. MemoryRoundEmit writes the MR line and detectors; ConstructEmit emits the first construct's locals and skips a later one; MeasureLogicalEmit records the first round and does not emit MZ here. Surgery-only kinds keep the trait's empty default, which is what this builder already did.

stim_structure_matches_checked_in_gold still locks repetition d=3, surface d=3 Z/X, and lattice-surgery CX. New tests cover one-shot construct, the first memory-round detector line, measure-logical recording, and silent surgery kinds. The new library code 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: this function is still 154 lines because the header, reset, X-init fallback, and observable assembly stay here, and emit_stim_lattice_surgery_cx is still over 80 lines.

@cursor
cursor Bot marked this pull request as ready for review October 1, 2026 06:48
@cursor
cursor Bot merged commit fc03317 into main Oct 1, 2026
22 of 23 checks passed

This branch was successfully deployed

1 active deployment
Preview — 55c941ee Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants