docs, validation: document the 16-bit and 64-bit compare oracle subset (#215)

vector-compare.md gains section 2a for the subset the reference
interpreters accept, and no longer says the reference rejects these
forms. vopc_f_t.rs stops listing the 64-bit F/T opcodes as unsupported:
the reference accepts them now, and the check passed only because v2 of
the v[1:2] pair was uninitialized.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
elforeign committed 2026-11-24 08:44:01 -06:00
1 parent d5437c1c18
commit 0b00fb378d
3 files changed
+39 -8

No files matched your search

+1
View File
@@ -15,6 +15,7 @@ remains unsupported.
- Extended the read-only RDNA2 planning CLI (`python3 -m qa rdna2`) with family/status filters, compact summaries, Codex-ready manifests under `artifacts/`, active-claim exclusion (family claims exclude those families; path-only claims block overlapping permitted files), coverage reconcile against `semantic_coverage` without inflating counts, and inventory diffs. Covered by `tests/qa/test_rdna2_plan.py`; planning only, no GPU production edits.
### Added
- Added an independent guide-derived oracle for the Wave32 16-bit (`v_cmp_{lt..ge}_{i16,u16}_e32`) and 64-bit (`v_cmp_{f..t}_{i64,u64}_e32`) integer compares in the reference and the second interpreter (6,212 lane cases, 1,192 rejections; contract in `docs/shaders/vector-compare.md` section 2a). The decoder and translator still reject these forms, and native Metal agreement is not yet shown. Part of #215.
- Added `python3 -m qa rdna2 rank` to the read-only RDNA2 planner: it groups undeclared gfx1030 forms by the piece of work that would unlock them (an encoding variant of a declared form, a new operand rule, or a new primitive, from XML identity and operand shape only) and ranks the groups by forms per estimated cost, excluding claimed scopes, with `--no-float` to leave out floating-point groups until the FP contract exists (part of #215).
- Added authoritative read-only x86-64 CPU inventory CLI (`python3 -m qa cpu-inventory`) over `crates/loader/x86/instructions.toml` via `generate_x86.load`, with opcode-map/prefix/operand summaries, native vs shared-semantic operation partitions from `dbt.rs`, fixture mnemonic evidence and a separate unsupported catalog. Does not count candidates as implemented. Covered by `tests/qa/test_cpu_inventory.py`.
- Added typed runtime inventory CLI (`python3 -m qa runtime-inventory`) over `crates/loader/runtime/services.txt`, reporting implemented/partial/stub services separately from API-set aliases and leaving independently-verified empty unless recorded. Covered by `tests/qa/test_runtime_inventory.py`.
+34 -2
View File
@@ -75,6 +75,29 @@ stream carries no wave-size declaration (the VOPC word has no wave-size field),
so every caller of the translator and the reference establishes Wave32 by
using this ABI; there is no Wave64 entry point to reject.
### 2a. 16-bit and 64-bit compares (reference interpreters only)
The reference (`crates/ref`) and the second interpreter
(`tests/validation/independent_ref.rs`) also accept the `_e32` forms
`v_cmp_{lt,eq,le,gt,ne,ge}_{i16,u16}` (opcodes 137-142, 169-174) and
`v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i64,u64}` (160-167, 224-231). The decoder and
the translator still reject them (section 4); these forms have an oracle
but no translation yet.
- 16-bit forms read bits 15:0 of each 32-bit source and ignore bits 31:16
(an inference from guide 6.2, 6.2.5 and 6.8: only SDWA selects a half).
There is no literal source.
- 64-bit forms read a pair: v[n:n+1] with n <= 254, an even-aligned
s[2k:2k+1] with k <= 52 (3.6.3), or an inline integer, which is
sign-extended to 64 bits (-1 is all ones, also for `_u64`; a reading of
Table 20). VSRC1 is v[m:m+1] with m <= 254. Literals and VCC as a 64-bit
source are rejected.
- The result, EXEC masking, VCCZ and the empty-EXEC rule are those of
sections 3 and 5.
The expectations and the guide readings are in
`tests/validation/tests/vopc_wide.rs`.
## 3. Semantics of one supported compare, Wave32
Let E = EXEC_LO before the instruction and A = the set of lanes that exist in
@@ -100,7 +123,9 @@ this wave (all 32 except in a final partial wave, see 7). As an unsigned
- V_CMPX_* (writes EXEC: divergent execution; needs its own contract).
- The VOP3 encoding of any compare (arbitrary SGPR destination, modifiers).
- SDWA and DPP forms; 16-bit, 64-bit and float compares; v_cmp_class.
- SDWA and DPP forms; float compares; v_cmp_class.
- 16-bit and 64-bit compares in the decoder and translator (the reference
interpreters accept the subset in 2a).
- SRC0 inline float constants (240-248), SGPRs other than s0-s106, TTMPs,
M0, EXEC_LO/HI, VCC_HI, SCC/VCCZ/EXECZ selectors, LDS direct.
- A normal-SGPR SRC0 without a known value, when EXEC_LO != 0.
@@ -226,6 +251,11 @@ programs, plus 2 mask-chain programs (252 in all), and the F/T fixture (253) mat
(`vector_compare_native_metal_known_answers`, run by `scripts/test-gpu.sh`). The F/T oracle's own native Metal cases
run in `vopc_f_t_match_the_guide_on_native_metal`.
The 16-bit and 64-bit oracle (`tests/validation/tests/vopc_wide.rs`) checks
6,212 lane cases on both reference interpreters, plus 1,192 rejections and the
13 neighbouring opcodes. Its native Metal test stays ignored until the
translator implements these forms.
A deliberately broken copy of each implementation fails these tests: the
reference with unsigned-only compares or with the EXEC test removed; the
second interpreter with unsigned-only compares or with no empty-EXEC rule;
@@ -238,7 +268,9 @@ locally on Apple M5 Pro. It is not agreement with RDNA 2 or Xbox hardware.
## 10. Limitations
- Wave32 only. No `v_cmpx`, VOP3, SDWA, DPP, 16-bit, 64-bit or float compares.
- Wave32 only. No `v_cmpx`, VOP3, SDWA, DPP or float compares. 16-bit and
64-bit compares exist only in the reference interpreters (2a); native Metal
agreement for them is not shown.
- A lane-derived VCC_LO cannot reach EXEC or any scalar instruction, so there
is no divergent execution. That needs its own contract.
- The skipped region of a runtime `s_cbranch_vccz` holds only integer vector
+4 -6
View File
@@ -666,16 +666,14 @@ fn vopc_f_t_outside_the_contract_are_rejected() {
#[test]
fn other_constant_compares_stay_unsupported() {
// F and T/TRU of the float, 64-bit and v_cmpx groups (Table 61):
// F and T/TRU of the float and v_cmpx groups (Table 61):
// V_CMP_F_F32 0, V_CMP_TRU_F32 15, V_CMPX_F_F32 16, V_CMPX_TRU_F32 31,
// V_CMP_F_I64 160, V_CMP_T_I64 167, V_CMPX_F_I64 176, V_CMPX_T_I64 183,
// V_CMP_F_U64 224, V_CMP_T_U64 231, V_CMPX_F_U64 240, V_CMPX_T_U64 247.
// V_CMPX_F_I64 176, V_CMPX_T_I64 183, V_CMPX_F_U64 240, V_CMPX_T_U64 247.
// The 64-bit V_CMP_F/T (160, 167, 224, 231) are covered by vopc_wide.rs.
let setup = vmov(3, 7);
// Also the neighbours of the two 32-bit integer groups: 127 and 191 (not
// in Table 61), 136 V_CMP_CLASS_F32 and 200 V_CMP_F_F16.
for op in [
0, 15, 16, 31, 127, 136, 160, 167, 176, 183, 191, 200, 224, 231, 240, 247,
] {
for op in [0, 15, 16, 31, 127, 136, 176, 183, 191, 200, 240, 247] {
let (code, offset) = program(&setup, None, &[vopc(op, vgpr(1), 3)], &[]);
assert_rejected_at(&format!("opcode {op}"), &code, offset, &lanes());
}