wai-quantum 0.4.4: the fabric's CUDA member #243

Merged
dcharlot merged 1 commit from wai/quantum-every-processor into main 2026-10-14 08:55:18 -04:00
Owner

What

A second accelerator member for the fabric, beside the WebGPU one: the gate kernel in CUDA C. The CUDA runtime compiler builds it at run time for each device's own architecture, and each device is certified bit-exact against the CPU reference's pinned corpus digests. It is behind the feature quantum_fabric_cuda, which is opt-in and native-only. This is wai-quantum 0.4.4.

Why it is bit-exact

src/quantum_fabric/lanes64.cu transcribes lanes::exact_row and apply_words into 64-bit integers, which every CUDA device has:

  • each fx(a, b) = (a·b + 2^29) >> 30 is exact in 64 bits, and so is each row's sum;
  • the lane keeps the sum's low 32 bits;
  • a sum outside 32 bits records the gate's op-log index, and the lowest index wins;
  • each thread handles one amplitude pair and each launch is one gate, so no thread reads what another writes within a launch.

The member's probe checks the device's arithmetic before it joins. Its certificates check whole runs.

Shape

The member presents the same surface as the WebGPU member:

  • discovery, with typed refusals;
  • the arithmetic probe, whose pair generator and mismatch check now live in lanes and are shared by both members;
  • run_lanes and run_program; simulate_from and simulate_metered; certify, member and member_metered;
  • a Runner for the Fabric.

Its id is local/gpu-cuda-<12 hex>, binding the device, its UUID, PCI location, driver, compiler and memory. Its CI key is gpu-cuda-sm<major><minor>.

The driver and runtime compiler are loaded on first use, so a build with the feature runs on a host without CUDA. There it finds no member and says why (Discovery::unavailable).

Verified

On the RTX 4050 (sm_89), tests/cuda_member.rs passes 9 of 9:

Check Result
Arithmetic probe agrees on 65,536 pairs
Kernel vs run_words equal on 2,000 random states and gate words, out-of-range runs included
Pinned certificates all four reproduced: two gatesets × random-v1 and fabric-v1
Random circuits, up to 22 qubits, and QFTs equal to native
Refusals typed
Kernel mutants all 6 caught
Receipt, placement, Fabric run as expected
Repeated runs identical

On a Mac without CUDA, the same tests pass over no member.

The mutation testing caught one weak mutant of my own. A sign flip on the imaginary part of the top-left entry changes nothing, because that entry is real for every gate in the set, so it was replaced with a flip on an entry Y does have.

CI

wai-quantum-cuda.yml adds two jobs:

  • on the GPU host: all four certificates and every mutant caught are required;
  • on a runner without CUDA: the member must report that no CUDA device is present.

Lockfiles

Every lockfile that includes wai-quantum moves to 0.4.4 by its version line alone. check-lockfiles passes on all seven.

🤖 Generated with Claude Code

## What A second accelerator member for the fabric, beside the WebGPU one: **the gate kernel in CUDA C**. The CUDA runtime compiler builds it at run time for each device's own architecture, and each device is certified bit-exact against the CPU reference's pinned corpus digests. It is behind the feature `quantum_fabric_cuda`, which is opt-in and native-only. This is wai-quantum **0.4.4**. ## Why it is bit-exact `src/quantum_fabric/lanes64.cu` transcribes `lanes::exact_row` and `apply_words` into 64-bit integers, which every CUDA device has: - each `fx(a, b) = (a·b + 2^29) >> 30` is exact in 64 bits, and so is each row's sum; - the lane keeps the sum's low 32 bits; - a sum outside 32 bits records the gate's op-log index, and the lowest index wins; - each thread handles one amplitude pair and each launch is one gate, so no thread reads what another writes within a launch. The member's probe checks the device's arithmetic before it joins. Its certificates check whole runs. ## Shape The member presents the same surface as the WebGPU member: - discovery, with typed refusals; - the arithmetic probe, whose pair generator and mismatch check now live in `lanes` and are shared by both members; - `run_lanes` and `run_program`; `simulate_from` and `simulate_metered`; `certify`, `member` and `member_metered`; - a `Runner` for the `Fabric`. Its id is `local/gpu-cuda-<12 hex>`, binding the device, its UUID, PCI location, driver, compiler and memory. Its CI key is `gpu-cuda-sm<major><minor>`. The driver and runtime compiler are loaded on first use, so a build with the feature runs on a host without CUDA. There it finds no member and says why (`Discovery::unavailable`). ## Verified On the RTX 4050 (sm_89), `tests/cuda_member.rs` passes 9 of 9: | Check | Result | |---|---| | Arithmetic probe | agrees on 65,536 pairs | | Kernel vs `run_words` | equal on 2,000 random states and gate words, out-of-range runs included | | Pinned certificates | all four reproduced: two gatesets × random-v1 and fabric-v1 | | Random circuits, up to 22 qubits, and QFTs | equal to native | | Refusals | typed | | Kernel mutants | all 6 caught | | Receipt, placement, `Fabric` run | as expected | | Repeated runs | identical | On a Mac without CUDA, the same tests pass over no member. The mutation testing caught one weak mutant of my own. A sign flip on the imaginary part of the top-left entry changes nothing, because that entry is real for every gate in the set, so it was replaced with a flip on an entry `Y` does have. ## CI `wai-quantum-cuda.yml` adds two jobs: - **on the GPU host:** all four certificates and every mutant caught are required; - **on a runner without CUDA:** the member must report that no CUDA device is present. ## Lockfiles Every lockfile that includes wai-quantum moves to 0.4.4 by its version line alone. `check-lockfiles` passes on all seven. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wai-quantum 0.4.4: the fabric's CUDA member
All checks were successful
standards workspaces build + test / sense-rs (pull_request) Successful in 1m13s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m29s
tests in CI / every test file is run by a job or listed with its reason (pull_request) Successful in 3s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 4m17s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 2m17s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 14s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 9m32s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 10s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 25s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 50s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 2m2s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m20s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m14s
wai-pack / wai-pack · does this change touch it (pull_request) Successful in 4s
wai-quantum CUDA member / member · CUDA absent (linux) (pull_request) Successful in 17s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Successful in 2m42s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 1m58s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 17m24s
wai-web reach builds / wai-web reach · does this change touch it (pull_request) Successful in 4s
wai-pack / wai-pack · linux-arm64 (pull_request) Successful in 1m21s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 5m11s
workflow hygiene / every workflow supersedes its own queue (pull_request) Successful in 4s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 3m15s
wai-pack / wai-pack · macos (pull_request) Successful in 1m42s
wai-pack / wai-pack · linux (pull_request) Successful in 1m50s
wai-pack / wai-pack · the floor through a media prober (pull_request) Successful in 21s
wai-pack / wai-pack · dependency licences (pull_request) Successful in 1m25s
wai-pack / wai-pack · independent verifier (Python) (pull_request) Successful in 3m57s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m49s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 4m5s
7443ce1992
A second accelerator member beside the WebGPU one: the gate kernel in CUDA
C, compiled at run time by the CUDA runtime compiler for each device's own
architecture, certified bit-exact against the CPU reference's pinned
corpus digests. Feature `quantum_fabric_cuda`, opt-in, native targets
only.

The kernel (src/quantum_fabric/lanes64.cu) is a transcription of
lanes::exact_row and apply_words in 64-bit integers, which every CUDA
device has: each fx(a, b) = (a·b + 2^29) >> 30 is exact in 64 bits, each
row's sum too, the lane keeps the low 32 bits, and a sum outside 32 bits
records the gate's op-log index, the lowest winning. One thread per
amplitude pair, one launch per gate, so no thread reads what another
writes within a launch.

The driver and the runtime compiler are loaded when first used, so a
build with the feature runs on a host with no CUDA and finds no member,
with the reason (Discovery::unavailable).

The member mirrors the WebGPU member's surface: discovery with typed
refusals, the arithmetic probe (shared now as lanes::probe_pairs and
first_mismatch), run_lanes / run_program, simulate_from and
simulate_metered, certify, member and member_metered, a Runner for the
Fabric, with_max_qubits and with_source for tests. Its id binds the
device, UUID, PCI location, driver, compiler and memory:
local/gpu-cuda-<12 hex>, keyed in CI as gpu-cuda-sm<major><minor>.

Device tests (tests/cuda_member.rs), on the RTX 4050 (sm_89): the probe
agrees on 65,536 pairs; the kernel matches run_words on 2,000 random
states and gate words, out-of-range runs included; all four pinned
certificates reproduced; random circuits up to 22 qubits and QFTs equal
to native; typed refusals; all six kernel mutants caught; a receipt, a
placement and a Fabric run; repeated runs identical. On a host with no
CUDA the same tests pass over no member.

CI: wai-quantum-cuda.yml, on the GPU host (requires the four
certificates and every mutant caught) and on a runner with no CUDA
(requires the member to say so).

Every lockfile that includes wai-quantum moves to 0.4.4 by its version
line alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!243
No description provided.