Some checks failed
WAI breaking changes and the conformance runner / WAI breaking · does this change touch WAI (push) Waiting to run
WAI breaking changes and the conformance runner / WAI breaking · wire, record and API against main · linux (push) Blocked by required conditions
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (push) Blocked by required conditions
wai-audit collector and player integration / does this change touch it (push) Successful in 46s
wai-quantum command line / does this change touch it (push) Successful in 37s
WAI operation catalogue / does this change touch it (push) Successful in 41s
wai-audit collector and player integration / collector · linux (push) Waiting to run
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (push) Waiting to run
WAI operation catalogue / the catalogue and every door · linux (push) Waiting to run
wai-quantum wasmQ / does this change touch it (push) Waiting to run
wai-quantum wasmQ / profile, engines, reference modules, adversarial, vectors · linux (push) Blocked by required conditions
wai-quantum wasmQ / profile, engines, reference modules, adversarial, vectors · macos (push) Blocked by required conditions
wai-quantum wasmQ / the reference modules rebuild to their modules of record · linux (push) Blocked by required conditions
wai-quantum wasmQ / interpreter and vectors under wasm32-wasip2 (wasmtime) (push) Blocked by required conditions
wai-quantum command line / command line · linux (push) Waiting to run
wai-quantum command line / command line · macos (push) Waiting to run
wai-quantum for JavaScript / does this change touch it (push) Successful in 14s
wai-quantum for JavaScript / javascript · linux (push) Waiting to run
wai-quantum contract / does this change touch it (push) Successful in 1m39s
wai-quantum editors / does this change touch it (push) Successful in 1m36s
wai-quantum contract / API compatibility · linux (push) Waiting to run
wai-quantum contract / schemas and the committed tool lists · linux (push) Waiting to run
wai-quantum contract / the policy is linked, and the deprecations page reads (push) Waiting to run
wai-quantum editors / editors · linux (push) Waiting to run
wai-quantum editors / editors · macos (push) Waiting to run
wai-quantum docs, course and locales / does this change touch it (push) Successful in 1m41s
wai-quantum resource estimation / does this change touch it (push) Successful in 1m5s
wai-quantum other formats / does this change touch it (push) Successful in 1m5s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (push) Waiting to run
wai-quantum docs, course and locales / the course and the command line's languages · linux (push) Waiting to run
wai-quantum docs, course and locales / the Studio's words in every locale · linux (push) Waiting to run
wai-quantum resource estimation / estimation and calibration · linux, release (push) Waiting to run
wai-quantum other formats / readers, writers and the set · linux (push) Waiting to run
wai-quantum other formats / the set under wasm32-wasip2 (wasmtime) (push) Waiting to run
wai-quantum OpenQASM reader / does this change touch it (push) Successful in 40s
wai-quantum OpenQASM reader / reader and corpus · linux (push) Waiting to run
wai-quantum OpenQASM reader / corpus under wasm32-wasip2 (wasmtime) (push) Waiting to run
wai-quantum pulse and dynamics / does this change touch it (push) Successful in 59s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs · linux, release (push) Waiting to run
wai-quantum pulse and dynamics / the same bits · macos (push) Waiting to run
wai-quantum pulse and dynamics / reader, simulator and pulse jobs under wasm32-wasip2 (wasmtime) (push) Waiting to run
wai-quantum for Python / does this change touch it (push) Successful in 40s
wai-quantum for Python / python · linux (push) Waiting to run
wai-quantum for Python / python · macos (push) Waiting to run
wai-quantum service / does this change touch it (push) Successful in 42s
wai-quantum service / service · linux (push) Waiting to run
wai-quantum service / service · macos (push) Waiting to run
wai-quantum error correction and mitigation / does this change touch it (push) Successful in 1m16s
wai-quantum extension points / does this change touch it (push) Successful in 1m15s
wai-quantum error correction and mitigation / codes, decoders, texts and mitigation · linux, release (push) Waiting to run
wai-quantum extension points / the registry and the example · linux (push) Waiting to run
wai-quantum extension points / the registry under wasm32-wasip2 (wasmtime) (push) Waiting to run
wai-quantum service / service energy · linux packages (push) Failing after 19s
wai-quantum studio and desktop / does this change touch it (push) Successful in 1m17s
wai-quantum variational and algorithm library / does this change touch it (push) Successful in 1m12s
wai-quantum verdicts and repairs / does this change touch it (push) Successful in 1m11s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux, release (push) Waiting to run
wai-quantum studio and desktop / studio · browser (push) Waiting to run
wai-quantum studio and desktop / desktop app · macos (push) Waiting to run
wai-quantum views in agent hosts / does this change touch it (push) Successful in 55s
wai-quantum studio and desktop / desktop app · linux (push) Waiting to run
wai-quantum studio and desktop / desktop app · windows (push) Waiting to run
wai-quantum verdicts and repairs / verdicts, repairs and the intent set · linux (push) Waiting to run
wai-quantum views in agent hosts / views · the page and its engine (push) Waiting to run
wai-quantum verdicts and repairs / the intent set and the verdict under wasm32-wasip2 (wasmtime) (push) Waiting to run
wai-quantum views in agent hosts / views · a scripted host (push) Waiting to run
WAI Studio / does this change touch it (push) Successful in 54s
WAI Studio / the catalogue's actions, the unit tests and the core · linux (push) Waiting to run
WAI Studio / Studio in Chromium and Firefox · macos (push) Waiting to run
wai-sink-swift native sink package / does this change touch it (push) Successful in 54s
wai-sink-android native sink library / does this change touch it (push) Successful in 49s
WAI Studio / Studio in WebKit · linux (push) Waiting to run
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (push) Waiting to run
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (push) Waiting to run
wai-quantum pulse and dynamics / the same bits · linux-arm64 (push) Successful in 3m31s
wai-quantum extension points / the registry and the example · linux-arm64 (push) Has started running
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (push) Failing after 6m28s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux-arm64, release (push) Has started running
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (push) Has started running
Held to the 3.1 specification construct by construct, the reader read these
to another program without a word; each now reads as the specification
says, with a test that failed first (qasm::spec_tests):
- ctrl @ U(θ, φ, λ): OpenQASM 3's U is e^{iθ/2} times OpenQASM 2's
matrix (gates.rst), a phase a control sees. It read as controlled
OpenQASM 2 U, a phase θ/2 short on the control; it is now
cu(θ, φ, λ, θ/2). ctrl @ u3 and ctrl @ u2 carry e^{−i(φ+λ)/2}
(standard_library.rst). stdgates.inc's own definitions written into a
program are now its gates under ctrl @ (its x so written read as cx then
sdg on the control, overlap 0.71). Uncontrolled, nothing changes.
- A gate a program defines under a built-in name ran the built-in gate and
dropped the definition; the program's own gate now runs, noted with the
new warning Q213, unless it is the built-in gate exactly (global phase
included; up to one in OpenQASM 2), when the built-in gate stands in as
before. `gate U` and `gate gphase` are refused (Q106).
- A mutable array argument given a slice or a row lost the subroutine's
writes (subroutines.rst's own example); they are written back. A write
to a readonly array argument was read; it is refused (new code Q131).
- angle[n] / angle[n] was a float ratio; it is the uint[n] quotient of
their bits. A float cast to angle[n] exactly halfway rounded away from
zero; it rounds to even.
- pow(r) @ of a gate written in U with global phases that cancel (the
libraries' x and rx) was refused; it is the gate's principal power.
The conformance case qasm3/lang/ctrl_user.qasm held ctrl @ U(0.1, 0.2, 0.3)
to cu(0.1, 0.2, 0.3, 0), the first of these; its reference is now
cu(..., 0.05). The jeff reader writes jeff's controlled u, OpenQASM 2's U,
as cu(θ, φ, λ, 0). lang_tests' controlled-U and user-gate cases are held to
the specification's U. docs/qasm-feature-matrix.md gives every construct
with what the reader and the bit-exact path each do, the eight above
before and after, and what is refused and why; the CLI's committed docs
follow. wai-quantum-lang.yml requires the new tests by name.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
180 lines
9.4 KiB
YAML
180 lines
9.4 KiB
YAML
name: wai-quantum OpenQASM reader
|
|
|
|
# The OpenQASM reader every surface uses (wai/wai-quantum/src/qasm.rs and
|
|
# src/qasm/): its unit tests (the lexer, the parser, the elaborator, the
|
|
# diagnostic table and the page that documents it, every modifier against the
|
|
# matrix it must equal, every condition compiled to steps against every value
|
|
# of its bits), and the OpenQASM 3 conformance corpus
|
|
# (wai/quantum-conformance/qasm3/: the specification's example programs and a
|
|
# program for each construct, each with what the reader must do with it).
|
|
#
|
|
# The corpus runs natively, where a second test holds its bundle equal to its
|
|
# files, and under wasm32-wasip2 by wasmtime, where the cases come from the
|
|
# bundle the test compiles in. The browser build runs the corpus too
|
|
# (wai-web-wasm.yml, wai-web's wasm32 tests). The reader is also built without
|
|
# the lowerings (features quantum_lang and quantum_toolchain), as the edge
|
|
# component builds it.
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'wai/wai-quantum/**'
|
|
- 'wai/quantum-conformance/qasm3/**'
|
|
- 'rust-toolchain.toml'
|
|
- '.github/workflows/wai-quantum-lang.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'wai/wai-quantum/**'
|
|
- 'wai/quantum-conformance/qasm3/**'
|
|
- 'rust-toolchain.toml'
|
|
- '.github/workflows/wai-quantum-lang.yml'
|
|
|
|
jobs:
|
|
relevant:
|
|
name: does this change touch it
|
|
runs-on: gate
|
|
outputs:
|
|
run: ${{ steps.gate.outputs.run }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- id: gate
|
|
run: |
|
|
set -euo pipefail
|
|
r=$(python3 scripts/pr-touches-paths.py .github/workflows/wai-quantum-lang.yml \
|
|
"${{ github.event.pull_request.base.sha }}" \
|
|
"${{ github.event.pull_request.head.sha }}")
|
|
echo "this change touches the OpenQASM reader: $r"
|
|
echo "run=$r" >> "$GITHUB_OUTPUT"
|
|
|
|
native:
|
|
name: reader and corpus · linux
|
|
needs: relevant
|
|
if: needs.relevant.outputs.run == 'true'
|
|
runs-on: linux
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Install Rust 1.99.1
|
|
shell: bash
|
|
run: |
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
command -v rustup >/dev/null 2>&1 || \
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.99.1
|
|
rustup toolchain install 1.99.1 --profile minimal
|
|
rustup default 1.99.1
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
# A module filter is satisfied by any one test of the module, so each
|
|
# module's tests are required by name to have run.
|
|
- name: The reader's unit tests
|
|
shell: bash
|
|
working-directory: wai/wai-quantum
|
|
run: |
|
|
set -euo pipefail
|
|
cargo test --locked --release --features full --lib qasm 2>&1 | tee "$RUNNER_TEMP/qasm.log"
|
|
grep -qE '^test result: ok\. [1-9][0-9]+ passed; 0 failed' "$RUNNER_TEMP/qasm.log" || { echo "::error::the reader's tests did not pass"; exit 1; }
|
|
for m in qasm::diag qasm::lex qasm::parse qasm::value qasm::lang_tests qasm::whole_tests qasm::depth_tests qasm::spec_tests qasm::library qasm::tests quantum_toolchain::tests::qasm_round_trip; do
|
|
grep -q "^test $m.* \.\.\. ok$" "$RUNNER_TEMP/qasm.log" || { echo "::error::no test of $m ran"; exit 1; }
|
|
done
|
|
# Each construct once read wrong, held to the specification, each test by name.
|
|
for t in qasm::spec_tests::u_under_a_control_carries_its_global_phase \
|
|
qasm::spec_tests::u2_and_u3_under_a_control_carry_their_global_phase \
|
|
qasm::spec_tests::the_library_s_definitions_written_out_are_its_gates_under_control \
|
|
qasm::spec_tests::a_program_s_own_definition_of_a_built_in_name_is_the_gate_it_runs \
|
|
qasm::spec_tests::an_array_argument_is_a_reference \
|
|
qasm::spec_tests::an_angle_divided_by_an_angle_is_an_unsigned_integer \
|
|
qasm::spec_tests::a_float_to_an_angle_rounds_ties_to_even \
|
|
qasm::library::tests::every_gate_s_matrix_is_the_reader_s; do
|
|
grep -q "^test $t \.\.\. ok$" "$RUNNER_TEMP/qasm.log" || { echo "::error::$t did not run and pass"; exit 1; }
|
|
done
|
|
# A gate held whole, each test by name.
|
|
for t in qasm::whole_tests::a_whole_program_lowers_to_what_the_reader_writes \
|
|
qasm::whole_tests::every_program_of_the_reader_s_corpus_reads_alike_both_ways \
|
|
qasm::whole_tests::only_what_would_double_stands_whole \
|
|
qasm::whole_tests::past_what_standard_gates_hold_a_gate_still_reads_whole \
|
|
qasm::whole_tests::the_bit_exact_circuit_holds_a_whole_gate_under_its_controls \
|
|
qasm::whole_tests::the_whole_gate_is_nearer_the_ideal_state_than_its_expansion \
|
|
qasm::whole_tests::the_state_vector_of_a_whole_gate_is_its_expansion_s_within_rounding \
|
|
qasm::whole_tests::a_run_without_a_whole_gate_is_the_run_it_was \
|
|
qasm::whole_tests::a_lowering_that_needs_standard_gates_writes_them \
|
|
qasm::whole_tests::the_bit_exact_report_states_what_the_lowering_did \
|
|
qasm::whole_tests::a_loop_of_wide_whole_gates_is_held_to_what_a_program_may_hold; do
|
|
grep -q "^test $t \.\.\. ok$" "$RUNNER_TEMP/qasm.log" || { echo "::error::$t did not run and pass"; exit 1; }
|
|
done
|
|
- name: The conformance corpus
|
|
shell: bash
|
|
working-directory: wai/wai-quantum
|
|
run: |
|
|
set -euo pipefail
|
|
cargo test --locked --release --features full --test qasm3_conformance 2>&1 | tee "$RUNNER_TEMP/corpus.log"
|
|
grep -q 'test result: ok. 2 passed; 0 failed' "$RUNNER_TEMP/corpus.log" || { echo "::error::the corpus did not pass"; exit 1; }
|
|
- name: The reader without the lowerings
|
|
shell: bash
|
|
working-directory: wai/wai-quantum
|
|
run: |
|
|
set -euo pipefail
|
|
cargo check --locked --no-default-features --features quantum_lang --lib
|
|
cargo check --locked --no-default-features --features quantum_toolchain --lib
|
|
|
|
wasip2:
|
|
name: corpus under wasm32-wasip2 (wasmtime)
|
|
needs: relevant
|
|
if: needs.relevant.outputs.run == 'true'
|
|
runs-on: linux
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Install Rust 1.99.1 with the wasm32-wasip2 target
|
|
shell: bash
|
|
run: |
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
command -v rustup >/dev/null 2>&1 || \
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.99.1
|
|
rustup toolchain install 1.99.1 --profile minimal
|
|
rustup default 1.99.1
|
|
rustup target add --toolchain 1.99.1 wasm32-wasip2
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
# The release binary, pinned by version and SHA-256, rather than a build from source.
|
|
# Every WAI workflow that runs wasmtime pins this one version, and every run passes
|
|
# -W nan-canonicalization=y -W relaxed-simd-deterministic=y: every NaN a float
|
|
# instruction makes is the canonical one, and each relaxed SIMD instruction has one
|
|
# behaviour on every host. A stock wasmtime leaves both off. The fixed relaxed
|
|
# behaviour is the engine's own: on 50.0.1 relaxed_madd is fused (measured on arm64 and
|
|
# x86_64), where WebAssembly's deterministic profile prescribes the unfused result.
|
|
# The repository checks (scripts/check-wasmtime-pin.py) fail a workflow that pins another
|
|
# release or runs wasmtime without both settings.
|
|
- name: Install wasmtime 50.0.1
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
[ "$(uname -m)" = x86_64 ] || { echo "::error::the pinned wasmtime archive is x86_64; this host is $(uname -m)"; exit 1; }
|
|
if ! command -v xz >/dev/null 2>&1; then
|
|
SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo"
|
|
$SUDO apt-get update -qq
|
|
$SUDO apt-get install -y -qq xz-utils
|
|
fi
|
|
v=50.0.1
|
|
f="wasmtime-v$v-x86_64-linux.tar.xz"
|
|
curl --proto '=https' --tlsv1.2 -sSfL -o "$RUNNER_TEMP/$f" \
|
|
"https://github.com/bytecodealliance/wasmtime/releases/download/v$v/$f"
|
|
echo "685466455dd42a14774a86c36c8f2e45cbb9bd6d92a850139315df60a75498a5 $RUNNER_TEMP/$f" | sha256sum -c -
|
|
tar -xJf "$RUNNER_TEMP/$f" -C "$RUNNER_TEMP"
|
|
echo "$RUNNER_TEMP/wasmtime-v$v-x86_64-linux" >> "$GITHUB_PATH"
|
|
# A debug build, so integer overflow panics instead of wrapping. The test
|
|
# that reads the corpus's files has no wasip2 build; the one that runs the
|
|
# cases from the compiled-in bundle does.
|
|
- name: The conformance corpus under wasmtime
|
|
shell: bash
|
|
working-directory: wai/wai-quantum
|
|
env:
|
|
CARGO_TARGET_WASM32_WASIP2_RUNNER: wasmtime run -W nan-canonicalization=y -W relaxed-simd-deterministic=y
|
|
run: |
|
|
set -euo pipefail
|
|
cargo test --locked --target wasm32-wasip2 --features full --test qasm3_conformance 2>&1 | tee "$RUNNER_TEMP/wasip2.log"
|
|
grep -q 'test result: ok. 1 passed; 0 failed' "$RUNNER_TEMP/wasip2.log" || { echo "::error::the corpus did not pass under wasip2"; exit 1; }
|