- #452 review S6, S7. The adapters claimed are those the forge's run 10236 (job 46928) of wai-ops-gpu.yml shows on this revision's kernel text: Metal on an arm64 desktop (macOS 27.0.1) and Chromium 148's WebGPU on that GPU. The Linux and Windows Vulkan, DX12 and software adapters were hand runs with no record committed, and G1's 0x1002 adapter ran the kernel text before the shift masks; none is claimed now. Committing their report lines would publish adapter product names, so the claims are narrowed instead. The §6 row and summary cite the forge run (N13). - #452 review S5. Item 6 says what a claim names where the backend reports no PCI identity and no driver (Metal, a browser's WebGPU). - #452 review S2. The rules check holds items 1, 2 and 4 and item 3's atomic and barrier parts; write-once and in-bounds rest on the host's indexing and wgpu's bounds checks, which the checked module creation keeps on. - #452 review S4. The suite covers every integer operation a kernel may use (rule 7), not every one WGSL defines: in §5, wgsl-conformance/README.md. - The corrections: SPIR-V's signed remainder is guarded even with the checks off; HLSL also writes integer `clamp` as `clamp` (spec and semantics::UNGUARDED); DX12 goes through FXC; semantics.rs cites WGSL §8.8 and §8.10; its intra-doc links name `Op::guarded_case` and `Op::ShlU32`, which exist (N5). - The subsection now opens with the conditions in general form for any accelerator, and states that the items are their GPU instance, so G2's NPU text (#440) can reuse it rather than write a parallel rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2.3 KiB
wgsl-conformance — WGSL's integer semantics on a GPU
The vectors an adapter passes before it runs a graph of a decode at decode-equivalence
(extensions/determinism-tiers.md §5, Claiming
the tier on a GPU, item 5): every integer operation a kernel may use (the rules check's
rule 7 keeps the kernels inside the suite), on i32, u32 and two-component vectors of
them where a kernel uses those, at the cases WGSL defines at run time and the languages it
is translated into leave open — wrapping addition, subtraction, multiplication and
negation; division and remainder by zero and of the most negative i32 by −1; shift
amounts from 0 to 40 and past them; clamp with its bounds in and out of order;
abs, sign, the bit counts and positions; bit fields at and past the word; the
conversions between i32, u32 and bool.
Provenance. Written by wai/wai-ops-gpu's wai-wgsl-vectors binary from
wai_ops_gpu::semantics::reference, which states each result from the text of WGSL
(W3C Candidate Recommendation Draft, 21 October 2026, §8.8, §8.10, §17.5), not from a
shader. No case comes from a device.
Layout
integer.jsonl— one JSON object per operation, in the order of itscode:op, its name;code, the operation's number inwai-ops-gpu/src/wgsl/semantics.wgsl;wgsl, the expression evaluated, witha,b,c,dthe operands asu32andia…idtheir bits asi32; andcases, each[a, b, c, d, result]as eight lowercase hexadecimal digits, followed by"unguarded"for a case the module of item 4 never reaches (a shift amount of 32 or more,clampbounds out of order). A vector operation's result is its two components folded into one word,x ^ (y × 0x9E3779B9)modulo 2^32.
Equivalence
An adapter conforms when, for every case not marked unguarded, the word it computes
for the operation on the operands, read from memory at run time, is result. Results on
unguarded cases are reported, and do not decide conformance.
The file is checked against the reference natively (wai-ops-gpu/tests/semantics.rs),
under Node (wai-ops-gpu/browser/semantics_reference.mjs) and in a browser page
(wai-ops-gpu/browser/run.mjs), the last two running the reference compiled to wasm32.