§5 said the browser crate's SIMD validation was done by hand, "which CI does not check". Since "wai-web-wasm: the packages validate with relaxed SIMD and threads off", wai-web-wasm.yml validates both bundles and reach/record/wai_web_bg.wasm with relaxed SIMD and threads disabled. §5 now says so, and says what CI still does not check: that they hold no other SIMD instruction. The changelog gains the CI entry for this branch. The commands that reproduce CI's wasmtime legs ran a stock wasmtime: the WAI Quantum READMEs (English and Chinese), the bit_identity test's header, the WAI README's edge example, and the conformance READMEs (quantum, qasm3, formats, answers, intents). Each now passes -W nan-canonicalization=y -W relaxed-simd-deterministic=y, as CI does. The determinism-cost run scripts under wai/research keep their commands: they record runs already made. The quantum docs check could not see that drift. For a `norun=ci:` block it stripped every leading VAR=value before matching the command against the workflow, and its pattern, \S*, did not read a quoted value. It now reads a quoted or bare value, and when the workflow sets VAR (as an env: key or in a script) the documented value must be one the workflow gives it, so CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime is refused against a workflow that sets it to the flagged runner. Co-Authored-By: Claude Opus 5.5 <[email protected]>
52 lines
2.6 KiB
Markdown
52 lines
2.6 KiB
Markdown
# OpenQASM 3 conformance
|
|
|
|
OpenQASM 3 programs, each with what the reader (`wai_quantum::qasm`) must do
|
|
with it: read it to an exact result, read it to the unitary of a reference
|
|
program, or refuse it with a given diagnostic code.
|
|
|
|
| Path | What |
|
|
|---|---|
|
|
| `spec/` | The OpenQASM 3 specification's example programs, unchanged (Apache-2.0, as the specification is published). Those that run are held to their results; those that cannot be run exactly are held to the code the reader refuses them with, which names the first construct it cannot hold (an `extern`, `durationof`, a `while` on measured bits with no bound) or the example's own error (`arrays.qasm` indexes past its array; `cphase.qasm` and `defcal.qasm` are fragments that declare no qubits). |
|
|
| `lang/` | A program for each construct the reader lowers, carries, preserves or refuses, and `*.ref.qasm` references written without the construct. `stdgates.qasm` applies every standard gate once; its reference writes each in `U` and `CX` alone. |
|
|
| `manifest.json` | Each case: its file, what it covers, and its expectations (the manifest's `expectations` says what each kind means). |
|
|
| `bundle.json` | The manifest's cases with each program's text inline, for builds that read no files. |
|
|
|
|
An expectation is one or more of: `refused` (a code), `warns` (the codes of
|
|
every warning and note, sorted), `deterministic` (every shot's outcome),
|
|
`distribution` (exact outcome probabilities, within 1e-9), `expectations`
|
|
(exact Pauli expectation values), `equivalent` (the reference's unitary, up to a
|
|
global phase, within 1e-9), `exact` (the bit-exact circuit takes it, or refuses
|
|
it with a code), `outputs`, `timing` and `calibrations`.
|
|
|
|
## Native
|
|
|
|
```sh
|
|
cd wai/wai-quantum
|
|
cargo test --release --features full --test qasm3_conformance
|
|
```
|
|
|
|
Two tests: every case against its expectations, and the bundle held equal to
|
|
the files. After changing a program or the manifest, write the bundle:
|
|
|
|
```sh
|
|
WAI_QASM3_BUNDLE_WRITE=1 cargo test --release --features full --test qasm3_conformance the_bundle_is_the_corpus
|
|
```
|
|
|
|
## WASI (the edge)
|
|
|
|
```sh
|
|
CARGO_TARGET_WASM32_WASIP2_RUNNER='wasmtime run -W nan-canonicalization=y -W relaxed-simd-deterministic=y' \
|
|
cargo test --target wasm32-wasip2 --features full --test qasm3_conformance
|
|
```
|
|
|
|
The cases come from the bundle compiled into the test.
|
|
|
|
## Browser
|
|
|
|
wai-web's wasm32 tests (`--features quantum_engine`, under
|
|
`wasm-bindgen-test-runner`) read every case of the bundle through the page's
|
|
engine: each refusal's code, each program's warnings, and each program with one
|
|
outcome run to it.
|
|
|
|
CI: `wai-quantum-lang.yml` (native and wasm32-wasip2) and `wai-web-wasm.yml`
|
|
(the browser build).
|