wai-quantum: OpenQASM 3 generators, one program for a family of circuits #466

Merged
dcharlot merged 1 commit from wai/quantum-qasm-generators into main 2026-10-25 17:54:00 -04:00

2026-10-25

Transaction Science
wai-quantum: OpenQASM 3 generators, one program for a family of circuits
All checks were successful
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Successful in 16s
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Successful in 18s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 2m11s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 4m31s
wai-quantum command line / command line · macos (pull_request) Successful in 30s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 14s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Successful in 3m32s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m10s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 28s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 4m39s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 5m46s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 19s
wai-quantum service / service · macos (pull_request) Successful in 39s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 10s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 2m15s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 16s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 13s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 3m33s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 16s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 11s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 26s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m26s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 1m22s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m39s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 7m3s
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Successful in 23s
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Successful in 26s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 17s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 14m51s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 42m2s
The reader refused loops, so a family of circuits (a GHZ state on n qubits,
the QFT, an adder) had to be written out once per size. It now reads
generators, the first piece of the specification-and-evaluator workbench,
whose proposers evolve exactly such programs and whose evaluator checks
them across n.

- qasm::parse_with and qasm::parse_lines_with read a program at given
  integer inputs; qasm::inputs lists the inputs it declares. `input int`,
  `input uint`, `const int|uint`, and `for` over [a:b], [a:step:b] (both ends
  included) and {a, b, c}, nested, are unrolled on reading. Indices and sizes
  take integer arithmetic with C's truncating division, `%`, `**`,
  comparisons and `&& || !`. An `if` on integers alone is decided on reading;
  one on bits stays classical control. Unrolled gates keep the lines of
  their loop's body.
- qasm::instantiate writes the circuit at given inputs out as plain
  OpenQASM, which reads back as the same program, gate for gate.
- Bounded: at most 20 million tokens, checked integer arithmetic, and a
  name an integer would shadow (a register, a gate's parameter or qubit, a
  word of the language) is refused with its line. A loop variable may still
  share a gate's name, such as the identity `i`, since an integer is only
  substituted where it is not starting a statement.
- The lexer reads `% < > <= >= && ||`.
- The CLI takes `--input NAME=VALUE` on every command, and `instance`
  prints a generator written out.

A program with no input, const or for reads exactly as before: the
unrolling pass returns its tokens untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 14:31:59 -04:00