diff --git a/docs/neutral_atom/benchmark_suite.md b/docs/neutral_atom/benchmark_suite.md index ff7c4ed0..9b1e77b1 100644 --- a/docs/neutral_atom/benchmark_suite.md +++ b/docs/neutral_atom/benchmark_suite.md @@ -2,7 +2,8 @@ A compact benchmark suite for reconfigurable neutral-atom QEC compiler work. The suite makes compiler tradeoffs visible across QEC memory, logical -measurement, logical entanglement, and (placeholder) non-Clifford workloads. +measurement, logical entanglement, and non-Clifford (magic-state T/CCZ) +workloads. ## Assumptions @@ -19,7 +20,8 @@ only** — not sampled data and not threshold claims (ADR-0020). | Surface d=3 measure | `samples/neutral-atom/benchmarks/surface_d3_measure.qn` | One memory round then logical X measure | | Surface d=3 CX | `samples/neutral-atom/benchmarks/surface_d3_cx.qn` | Lattice-surgery logical CX between two surface-code blocks | | Surface d=3 GHZ | `samples/neutral-atom/benchmarks/surface_d3_ghz.qn` | Three-block GHZ-style prep-measure with two logical CX gates | -| Non-Clifford (placeholder) | `samples/neutral-atom/benchmarks/surface_d3_t_placeholder.qn` | Still a placeholder — #283 landed magic-state-consuming `logical_t`/`logical_ccz` at the QEC-workload IR / resource-report layer, but source-level `.qn` syntax for these ops isn't wired into the frontend yet (#311), so a source-driven T/CCZ benchmark can't compile through `quonc` yet | +| Surface d=3 T | `samples/neutral-atom/benchmarks/surface_d3_t.qn` | Magic-state-consuming logical T on one surface-code block (`t_count`) | +| Surface d=3 CCZ | `samples/neutral-atom/benchmarks/surface_d3_ccz.qn` | Magic-state-consuming logical CCZ on three surface-code blocks (`ccz_count`) | ## Compile commands @@ -35,6 +37,11 @@ quonc samples/neutral-atom/benchmarks/surface_d3_memory.qn \ quonc samples/neutral-atom/benchmarks/surface_d3_cx.qn \ --target targets/neutral_atom/generic_rna_v0.json \ --emit-resource-report - + +# Non-Clifford (magic-state) benchmark +quonc samples/neutral-atom/benchmarks/surface_d3_t.qn \ + --target targets/neutral_atom/generic_rna_v0.json \ + --emit-resource-report - ``` ## Emitted artifacts @@ -50,6 +57,7 @@ Each benchmark produces a resource report with comparable metrics: - **Idle time**: wait time - **Estimated cycles**: schedule layer count - **QEC-specific counts**: code family, distance, memory rounds, error budget +- **Magic-state counts** (T/CCZ only): `t_count`, `tdag_count`, `ccz_count`, `magic_state_demand` ## Interpreting results @@ -58,12 +66,11 @@ the same code distance but different workload structure (e.g. memory vs CX) will show different Rydberg stage counts, rearrangement steps, and estimated cycles — these are the compiler tradeoffs the suite makes visible. -Non-Clifford benchmarks remain a placeholder. Issue #283 landed -magic-state-*consuming* logical T/CCZ as a QEC-workload IR / resource-report -model — see -[`docs/neutral_atom/magic_state_operations.md`](./magic_state_operations.md) -and `examples/na_qec/surface_d3_t.qn` / `surface_d3_ccz.qn` — but that work -did not wire `logical_t` / `logical_tdag` / `logical_ccz` into the frontend -typechecker, so those example programs do not yet compile through `quonc` -(`error: type checking failed: unbound variable`). A surface d=3 T/CCZ -benchmark will be added to this suite once #311 lands that frontend wiring. +The non-Clifford (T/CCZ) benchmarks are magic-state-*consuming* operations: +`logical_t` / `logical_tdag` / `logical_ccz` bind as source identifiers in the +frontend prelude (issue #311, landed via #354) and compile end-to-end through +`quonc`. They are a compiler model of magic-state consumption — not a validated +distillation factory or threshold claim. T/CCZ are recorded as resource-report +metadata (`t_count` / `ccz_count` / `magic_state_demand`) rather than expanded +to physical CNOT/measure/reset rounds; see +[`docs/neutral_atom/magic_state_operations.md`](./magic_state_operations.md). diff --git a/docs/neutral_atom/magic_state_operations.md b/docs/neutral_atom/magic_state_operations.md index d61bf1c6..a8101ce0 100644 --- a/docs/neutral_atom/magic_state_operations.md +++ b/docs/neutral_atom/magic_state_operations.md @@ -17,6 +17,10 @@ All three are surface-code only. Type checking enforces: - Correct operation arity - Distinct logical ids (for CCZ) +These operations bind as source identifiers in the frontend prelude (#311, +landed via #354) and compile end-to-end through `quonc`; see +`samples/neutral-atom/benchmarks/surface_d3_t.qn` and `surface_d3_ccz.qn`. + ## Resource reports Resource reports include: @@ -42,10 +46,3 @@ distillation factory. diagnostics. - **Not a threshold claim**: magic-state consumption is modeled for resource accounting, not for claiming fault-tolerant performance. -- **Not yet reachable from `.qn` source**: `logical_t`, `logical_tdag`, and - `logical_ccz` exist as `WorkloadBuilder` methods (`quon_qec/src/workload.rs`) - with expansion (`quon_qec/src/expand.rs`) and resource-report wiring, but - the frontend typechecker/prelude was not updated to bind them as source - identifiers. `examples/na_qec/surface_d3_t.qn` and `surface_d3_ccz.qn` sketch - the intended syntax but do not currently compile through `quonc` - (`unbound variable`); tracked in #311. diff --git a/samples/catalog.yaml b/samples/catalog.yaml index de8657b3..61d54738 100644 --- a/samples/catalog.yaml +++ b/samples/catalog.yaml @@ -483,6 +483,34 @@ entries: artifacts: [] ci: smoke + - id: neutral-atom/bench-surface-d3-t + path: samples/neutral-atom/benchmarks/surface_d3_t.qn + tags: [neutral-atom, qec, benchmark, surface-code, magic-state, non-clifford, t, pack-284] + difficulty: advanced + quonc_args: + [ + "--target", + "targets/neutral_atom/generic_rna_v0.json", + "--emit-resource-report", + "-", + ] + artifacts: [] + ci: smoke + + - id: neutral-atom/bench-surface-d3-ccz + path: samples/neutral-atom/benchmarks/surface_d3_ccz.qn + tags: [neutral-atom, qec, benchmark, surface-code, magic-state, non-clifford, ccz, pack-284] + difficulty: advanced + quonc_args: + [ + "--target", + "targets/neutral_atom/generic_rna_v0.json", + "--emit-resource-report", + "-", + ] + artifacts: [] + ci: smoke + # ── Creative / games pack (#200) ─────────────────────────────────────── - id: creative/quantum-dice path: samples/creative/quantum_dice.qn diff --git a/samples/neutral-atom/benchmarks/surface_d3_ccz.qn b/samples/neutral-atom/benchmarks/surface_d3_ccz.qn new file mode 100644 index 00000000..741d1c40 --- /dev/null +++ b/samples/neutral-atom/benchmarks/surface_d3_ccz.qn @@ -0,0 +1,19 @@ +-- Benchmark: non-Clifford logical CCZ on three surface-code blocks. +-- Three surface-code blocks, one memory round each, magic-state-consuming +-- logical CCZ, then logical Z measurement of all three blocks. +-- Tests the magic-state-consuming CCZ resource-report path (ccz_count). +-- Compiler model of magic-state consumption — not a distillation factory or +-- threshold claim. + +fn surface_d3_ccz_bench(): Q = run { + a <- surface_code<3>() + b <- surface_code<3>() + c <- surface_code<3>() + a <- memory_round(a) + b <- memory_round(b) + c <- memory_round(c) + (a, b, c) <- logical_ccz(a, b, c) + _ <- measure_logical_z(a) + _ <- measure_logical_z(b) + measure_logical_z(c) +} diff --git a/samples/neutral-atom/benchmarks/surface_d3_t.qn b/samples/neutral-atom/benchmarks/surface_d3_t.qn new file mode 100644 index 00000000..ed7de7f6 --- /dev/null +++ b/samples/neutral-atom/benchmarks/surface_d3_t.qn @@ -0,0 +1,14 @@ +-- Benchmark: non-Clifford logical T on a surface-code block. +-- One surface-code block, one memory round, magic-state-consuming logical T, +-- then a second memory round and logical Z measurement. +-- Tests the magic-state-consuming T resource-report path (t_count). +-- Compiler model of magic-state consumption — not a distillation factory or +-- threshold claim. + +fn surface_d3_t_bench(): Q = run { + a <- surface_code<3>() + a <- memory_round(a) + a <- logical_t(a) + a <- memory_round(a) + measure_logical_z(a) +} diff --git a/samples/neutral-atom/benchmarks/surface_d3_t_placeholder.qn b/samples/neutral-atom/benchmarks/surface_d3_t_placeholder.qn deleted file mode 100644 index f8b24255..00000000 --- a/samples/neutral-atom/benchmarks/surface_d3_t_placeholder.qn +++ /dev/null @@ -1,14 +0,0 @@ --- Benchmark: non-Clifford logical T (PLACEHOLDER). --- --- This benchmark is a placeholder until logical non-Clifford operations --- (magic-state-consuming T/Tdag/CCZ) are implemented (issue #283). --- It is skipped in CI smoke tests and not included in the catalog until --- #283 lands. --- --- Expected form after #283: --- fn surface_d3_t_bench(): Q = run { --- a <- surface_code<3>() --- a <- memory_round(a) --- a <- logical_t(a) --- measure_logical_z(a) --- } diff --git a/website/src/content/docs/guides/na-ft-demo.mdx b/website/src/content/docs/guides/na-ft-demo.mdx index c436ef18..3a6e3692 100644 --- a/website/src/content/docs/guides/na-ft-demo.mdx +++ b/website/src/content/docs/guides/na-ft-demo.mdx @@ -318,18 +318,15 @@ This demo is deliberately scoped. What it does **not** do: neutral-atom descriptor [`generic_rna_v0.json`](https://github.com/arniber21/quon/blob/main/targets/neutral_atom/generic_rna_v0.json), not any vendor's calibrated device model. -- **Non-Clifford logical operations are a resource-accounting model, not yet - compiler-reachable from source.** Magic-state-*consuming* logical `T`, - `T†`, and `CCZ` exist at the QEC-workload layer (issue #283): a - `WorkloadBuilder` API, expansion into magic-state rounds, resource-report - fields (`t_count`, `tdag_count`, `ccz_count`, `magic_state_demand`), and QEC - experiment / Stim-comment emission. This is strictly *consumption* — magic - states are assumed already available and are never produced. There is no - distillation factory, and T/CCZ are recorded as metadata rather than - expanded to physical gates. The frontend typechecker does not yet bind - `logical_t` / `logical_tdag` / `logical_ccz` as source identifiers, so - `quonc` cannot compile a `.qn` program that uses them end-to-end yet - (tracked in #311). The logical operation demonstrated on this page +- **Non-Clifford logical operations are a resource-accounting model.** + Magic-state-*consuming* logical `T`, `T†`, and `CCZ` compile end-to-end + from `.qn` source through `quonc` (issue #311, landed via #354; see + `samples/neutral-atom/benchmarks/surface_d3_t.qn` and `surface_d3_ccz.qn`). + This is strictly *consumption* — magic states are assumed already available + and are never produced. There is no distillation factory, and T/CCZ are + recorded as metadata (`t_count` / `tdag_count` / `ccz_count` / + `magic_state_demand` in the resource report) rather than expanded to + physical gates. The logical operation demonstrated on this page (`logical_cx`) remains Clifford. ## Where this fits