Files
betterxen/docs/status.toml
T
elforeign 0749330868 shader: Wave32 VOPC integer compares with VCC/EXEC rules
Adds v_cmp_{lt,eq,le,gt,ne,ge}_{i32,u32}_e32 across the chain: opcodes
generated from the pinned AMD XML, one typed VectorCompare instruction
(relation + signedness, table-driven decode), the reference interpreter,
the independent semantic-review interpreter, typed IR and MSL.

Rules (RDNA 2 ISA guide 3.9, 2.1, 3.3; contract in
docs/shaders/vector-compare.md): VCC_LO[n] = EXEC_LO[n] & test(lane n),
always fully written, so empty EXEC gives 0 and reads no source; VCC_HI
becomes unknown; EXEC, SCC and VGPRs are unchanged. A lane-derived
VCC_LO may feed only s_cbranch_vccz, v_mov_b32 vN, vcc_lo and another
compare's SRC0, so EXEC never becomes data-dependent. A runtime
s_cbranch_vccz is wave-uniform: the skipped code may hold only integer
vector ALU instructions with initialized destinations, checked whether
or not it is taken, and lowers to selects at the join.

The Metal kernel makes no SIMD-group, threadgroup or barrier assumption:
each thread rebuilds its RDNA wave's mask by recomputing the 32 lanes'
operands from their input words, bounded by threads_per_grid. The
reference now runs lockstep Wave32 waves; absent lanes of a final
partial wave contribute 0.

Verified with an original LLVM-assembled fixture and 251 programs
(every form on 10 boundary values in both operand orders, partial and
empty EXEC, both runtime branch edges in one dispatch, mask chains,
32 pinned rejections) against exact integer definitions. Translator,
reference and second interpreter agree on CPU; all 252 programs match
on native Metal with validation; LLVM agrees on every encoding.
Breaking any implementation (signedness, EXEC masking, empty EXEC,
absent-lane bound, join polarity or uniformity) fails the tests.

Fixes #186

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 02:22:19 -06:00

550 lines
19 KiB
TOML

schema_version = 1
phase = 1
release_ready = false
[[feature]]
id = "native-compute"
implementation = "implemented"
correctness = "initial-native-suite-passed"
hardware_verification = "verified"
hardware_target = "Apple M5"
claims = ["CLAIM-METAL-M5-NATIVE-SUITE"]
architecture = "arm64 macOS"
semantics = "Native Metal work submissions with bounded resources"
metal_mapping = "Native compute kernels and an original offscreen render test"
limitations = "Trusted MSL with bounded word buffers and an original native offscreen rendering test on Apple M5."
test = "scripts/test-gpu.sh"
[[feature]]
id = "synthetic-gfx1030"
implementation = "three-fixture-demo-implemented"
correctness = "three-way-output-passed"
hardware_verification = "verified"
hardware_target = "Apple M5"
claims = ["CLAIM-METAL-M5-RDNA-DEMO", "CLAIM-RDNA2-ADD-NO-CARRY", "CLAIM-RDNA2-SOPP-BRANCH-DISPLACEMENT"]
architecture = "gfx1030 Wave32"
semantics = "Original gfx1030 compute code under the synthetic fixture ABI"
metal_mapping = "One lane-indexed MSL compute invocation per word"
limitations = "Synthetic memory contract, statically resolved forward control flow, exact positive normal FP32 only."
test = "scripts/demo.sh"
[[feature]]
id = "xbox-execution"
implementation = "unsupported"
correctness = "untested"
hardware_verification = "unverified"
claims = ["CLAIM-XBOX-ISA-ABI"]
architecture = "Xbox Series X|S"
semantics = "Console-specific GPU and guest execution contracts remain unknown"
metal_mapping = "Unresolved"
limitations = "Game execution, proprietary guest containers and full guest execution-mask divergence are unsupported. The console launch ABI is unknown."
[[instruction]]
form = "buffer_load_dword"
encoding = "MUBUF, VGPR data/index, four normal SGPRs, `idxen`, zero offsets and remaining flags"
representation = "8 B"
lowering = "MSL load"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_waitcnt vmcnt(0)"
encoding = "SOPP, exact immediate `0x3f70`; other counters disabled by their maximum values"
representation = "4 B"
lowering = "verified load wait"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_mov_b32_e32"
encoding = "VOP1, VGPR destination, VGPR, normal SGPR (wave-uniform, known during translation), vcc_lo (known or a compare mask) or inline integer or literal source, plus the inline bit pattern for +1.0f"
representation = "4 or 8 B"
lowering = "constant or register value"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_add_nc_u32_e64"
encoding = "VOP3, VGPR destination and two VGPR inputs, modifier fields clear, third source field encoded as inline zero"
representation = "8 B"
lowering = "MSL unsigned add"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "buffer_store_dword"
encoding = "MUBUF, VGPR data/index, four normal SGPRs, `idxen`, zero offsets and remaining flags"
representation = "8 B"
lowering = "MSL store"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_waitcnt_vscnt null, 0"
encoding = "SOPK, exact null source and zero immediate"
representation = "4 B"
lowering = "verified store wait"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_endpgm"
encoding = "SOPP, zero immediate"
representation = "4 B"
lowering = "verified termination"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_mov_b32"
encoding = "Normal SGPR or EXEC/VCC half destination and normal SGPR, inline integer or literal source"
representation = "`BE880387`"
lowering = "resolved scalar state"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_cmp_eq_u32"
encoding = "Normal SGPR or integer operands, with at most one source selecting a literal"
representation = "`BF068708`"
lowering = "resolved SCC"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_add_u32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = carry-out"
representation = "`80088308`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_sub_u32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = borrow"
representation = "`808A8180`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_add_i32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = signed overflow"
representation = "`8110C109`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_sub_i32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = signed overflow"
representation = "`8191C110`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_addc_u32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; adds SCC; SCC = carry-out"
representation = "`820980FF 7FFFFFFF`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_subb_u32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; subtracts SCC; SCC = borrow"
representation = "`828B0809`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_and_b32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = result != 0"
representation = "`870D090C`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_or_b32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = result != 0"
representation = "`880ED00D`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_xor_b32"
encoding = "SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = result != 0"
representation = "`890C0A0B`"
lowering = "resolved scalar state and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_lt_i32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (signed S0 < S1), fully written"
representation = "`7D020701`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_eq_i32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (signed S0 == S1), fully written"
representation = "`7D040280`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_le_i32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (signed S0 <= S1), fully written"
representation = "`7D060208`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_gt_i32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (signed S0 > S1), fully written"
representation = "`7D0802D0`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_ne_i32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (signed S0 != S1), fully written"
representation = "`7D0A0301`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_ge_i32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (signed S0 >= S1), fully written"
representation = "`7D0C02FF 80000001`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_lt_u32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (unsigned S0 < S1), fully written"
representation = "`7D820701`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_eq_u32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (unsigned S0 == S1), fully written"
representation = "`7D8402FF 80000000`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_le_u32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (unsigned S0 <= S1), fully written"
representation = "`7D860208`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_gt_u32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (unsigned S0 > S1), fully written"
representation = "`7D8802C0`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_ne_u32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (unsigned S0 != S1), fully written"
representation = "`7D8A026A`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_cmp_ge_u32_e32"
encoding = "VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & (unsigned S0 >= S1), fully written"
representation = "`7D8C0D01`"
lowering = "per-thread Wave32 mask over the dispatch's own 32 lanes; runtime s_cbranch_vccz as a join select"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_cbranch_scc0"
encoding = "Nonnegative signed dword displacement"
representation = "`BF840002`"
lowering = "resolved conditional branch"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_branch"
encoding = "Nonnegative signed dword displacement"
representation = "`BF820001`"
lowering = "resolved branch"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_and_b32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`36020702`"
lowering = "MSL bitwise AND"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_xor_b32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`3A020702`"
lowering = "MSL bitwise XOR"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_add_f32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`06020702`"
lowering = "MSL FP32 add"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_mul_f32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`10020702`"
lowering = "MSL FP32 multiply"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_or_b32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`3803FF01`"
lowering = "MSL bitwise OR"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified on Apple M5"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_lshlrev_b32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`34020501`"
lowering = "MSL logical left shift with a five-bit count"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified on Apple M5"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_lshrrev_b32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`2DFFFF01`"
lowering = "MSL logical right shift with a five-bit count"
reference = "implemented"
cpu = "fixture verified"
gpu = "fixture verified on Apple M5"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "v_ashrrev_i32_e32"
encoding = "Two VGPR sources and one VGPR destination"
representation = "`31FFFF01`"
lowering = "MSL signed right shift with a five-bit count"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_cbranch_execz"
encoding = "Nonnegative signed dword displacement"
representation = "`BF880001`"
lowering = "resolved Wave32 EXEC_LO zero check"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[[instruction]]
form = "s_cbranch_vccz"
encoding = "Nonnegative signed dword displacement"
representation = "`BF860001`"
lowering = "resolved Wave32 VCC_LO zero check, or a wave-uniform join select after a vector compare"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
[guest_milestones]
X1 = "accepted"
X2 = "accepted"
X3 = "accepted"
X4 = "accepted"