§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]>
63 lines
4.2 KiB
Markdown
63 lines
4.2 KiB
Markdown
# Other formats: conformance
|
|
|
|
Programs in QIR and jeff, each with what the engine's readers and writers
|
|
(`wai_quantum::engine::formats`, [docs](../../wai-quantum/docs/formats.md))
|
|
must do with it: read it to the program a reference gives, give the outcomes
|
|
it must give, write it back to its own format and read it again unchanged,
|
|
or refuse it with a code and its place. OpenQASM sources are written to each
|
|
format and read back.
|
|
|
|
| Path | What |
|
|
|---|---|
|
|
| `qir/` | QIR modules: the specification's two example programs (the base profile's Bell pair and the adaptive profile's teleport chain, MIT, as the specification publishes its code), every intrinsic the reader takes, a Clifford+T module, a QIR 1 module with typed pointers from the crate's earlier writer, computation the module flags declare, and a module that names no profile. `*.ref.qasm` are the references, written by hand. |
|
|
| `qir/refuse/` | A module for each thing a profile forbids, each capability declared and not taken, a stale read, an unknown intrinsic, a qubit past its count, an unknown profile, QIR 3, and text that is not LLVM: each with its code and line. |
|
|
| `jeff/` | jeff modules built field by field from the schema (not by the writer): well-known gates with their controls after their targets, custom gates named as standard gates, a Pauli-product rotation; `refuse/` the refusals. A unit test (`engine::formats::tests::the_conformance_set_holds_these_modules`) makes them and holds the files to them. |
|
|
| `jeff/upstream/` | The jeff project's own structured benchmarks (GHZ, QFT, QPE, Grover, teleportation, iterative QFT and QPE, multiplexer, QFT adders, a controlled modular multiplier: loops over registers, switches on measured bits, several segments) and its examples, unchanged (Apache-2.0), from the jeff repository at commit `97f73829caa2de0b6fbf925d1f97f9eb10c158ad`; the examples renamed by what they show. `*.ref.qasm` are references written by hand from each benchmark's source. Those the readers cannot hold exactly are refused with their codes. |
|
|
| `qasm/` | OpenQASM sources written to QIR and jeff and read back: every gate of the language, Clifford+T, a branching program, a measurement in the middle with a reset, and timing neither format holds. The QIR written is pinned by its BLAKE3, the same bytes natively and under wasm32-wasip2. |
|
|
| `manifest.json` | Each case: its file, its format, what it covers, its reference, and its expectations (the manifest's `expectations` says what each kind means). |
|
|
| `bundle.json` | The manifest's cases with each file inline (text, or base64 for jeff), for builds that read no files. |
|
|
|
|
## Native
|
|
|
|
```sh
|
|
cd wai/wai-quantum
|
|
cargo test --release --features full --test formats_conformance
|
|
cargo test --release --features full --lib engine::formats
|
|
```
|
|
|
|
Two tests: every case against its expectations, and the bundle held equal to
|
|
the files. After changing a file or the manifest, write the bundle:
|
|
|
|
```sh
|
|
WAI_FORMATS_BUNDLE_WRITE=1 cargo test --release --features full --test formats_conformance the_bundle_is_the_corpus
|
|
```
|
|
|
|
and after changing the hand-built jeff modules,
|
|
`WAI_FORMATS_VECTORS_WRITE=1 cargo test --release --features full --lib the_conformance_set_holds_these_modules`.
|
|
|
|
The same files are the seed of the hostile-input test: every QIR and jeff
|
|
file mutated (bits flipped, cut short, spliced with another, and every
|
|
length, count, offset and 32-bit field inflated), 45 153 inputs from a fixed
|
|
seed, each converted or refused with a code within 20 s and 1 GiB:
|
|
|
|
```sh
|
|
cargo test --release --features full --test formats_mutation -- --nocapture
|
|
```
|
|
|
|
## 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 formats_conformance
|
|
```
|
|
|
|
The cases come from the bundle compiled into the test. The hostile-input
|
|
test runs there too, as a release build with overflow checks on:
|
|
|
|
```sh
|
|
CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS=true CARGO_TARGET_WASM32_WASIP2_RUNNER='wasmtime run -W nan-canonicalization=y -W relaxed-simd-deterministic=y' \
|
|
cargo test --release --target wasm32-wasip2 --features full --test formats_mutation
|
|
```
|
|
|
|
CI: `wai-quantum-formats.yml` (the readers' and writers' unit tests, and the
|
|
set natively and under wasm32-wasip2).
|