wai-quantum 0.4.1: the fabric's WebGPU member — one WGSL kernel, certified bit-exact on every adapter #218
Loading…
Reference in a new issue
No description provided.
Delete branch "wai-quantum-webgpu"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The fabric contract (0.3.41) defines members, parity against the CPU reference, certificates and placement. So far its only members are CPUs. This adds the first accelerator member: one WGSL kernel that runs the circuit core's gates on Metal, Vulkan and DX12 natively, and on a browser's WebGPU. It is certified bit-exact against the CPU reference on each adapter it finds.
Integer-first numerics are what make that provable. The kernel is a line-for-line transcription of the fabric's 32-bit-lane gate kernel (
lanes), which already reproduces the i64 fixed-point core bit for bit natively and under wasm32. WGSL has no i64 and no f64, so the kernel uses only u32 values holding i32 bit patterns.What
Stage 0: CPU groundwork (no new dependency)
Certification(an incremental certificate builder) andCorpus.lanes::{GateWords, apply_words, simulate_checked, horizon}.planmodule with a CPU executor.Stage 1: the kernel and its checker
src/quantum_fabric/lanes32.wgsluses:lanes::horizonproves how many gates a valid circuit can run before a refusal is possible: tens of thousands at 26 qubits, far more at fewer.quantum_fabric::wgslprovides:wai/tools/quantum-wgsl-check(unpublished) checks the shader. It walks naga's IR for the rules above and translates the shader to MSL, SPIR-V and HLSL; the SPIR-V must passspirv-val.Stage 2: the native member (feature
quantum_fabric_webgpu, opt-in, not infull, absent on wasm32-wasip2)Unsuitablelisting.noneis a declaration too, so an adapter-less run fails instead of passing.Stage 3: CI and release
scripts/wai-quantum-webgpu-member.shfails unless all of these hold:.github/workflows/wai-quantum-webgpu.ymlhas four jobs:wai_quantum_vectors verify --webgpuruns the whole conformance corpus through the member.fulland every existing pin are unchanged.Review
An independent review of stages 0–3 found no input on which the member returns different bits from the reference. It modelled the kernel's arithmetic exactly and ran the full wide suite, up to 26 qubits, on Metal. It upheld seven smaller findings, now fixed:
hashbrownwith a version, because a second version now coexists. No version moved.Checked locally
On the Metal adapter:
verify --webgpupasses the vector, reject and accept trees.The CI script fails as intended:
The checker fails as intended on a planted signed local, a planted variable shift and planted workgroup memory.
Both wai-quantum gates pass, natively and under wasm32-wasip2. The publish dry-run passes, and the package carries the shader.
First CI run
Some facts can only be confirmed by the first run. Each fails loudly rather than passing:
🤖 Generated with Claude Code