docs: SOP2 64-bit Metal readback and the two-literal subset rule (#215)

scripts/test-gpu.sh ran the oracle's 4,432 cases on native Metal (185
programs, API and shader validation on). Review findings: the second
literal selector is a Xenora subset restriction, since the pinned XML
defines has_lit_0_has_lit_1 for these forms; the registry page no longer
says it covers nine SOP2 forms.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
elforeign committed 2026-11-24 09:47:22 -06:00
1 parent 5ffb9d58a1
commit b489d0d7b7
4 files changed
+27 -21

No files matched your search

+8 -8
View File
@@ -67,21 +67,21 @@ The wider LLVM operand matrix exercises decoding only. ABI means application bin
| `s_addc_u32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; adds SCC; SCC = carry-out | `820980FF 7FFFFFFF` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_subb_u32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; subtracts SCC; SCC = borrow | `828B0809` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_and_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = result != 0 | `870D090C` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_and_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_and_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_or_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = result != 0 | `880ED00D` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_or_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_or_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_xor_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; SCC = result != 0 | `890C0A0B` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_xor_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_xor_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_andn2_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = S0 & ~S1; SCC = result != 0 | `8A09FF08 FF00FF00` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_andn2_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_andn2_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_orn2_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = S0 \| ~S1; SCC = result != 0 | `8B0AC109` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_orn2_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_orn2_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_nand_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = ~(S0 & S1); SCC = result != 0 | `8C0B0808` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_nand_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_nand_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_nor_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = ~(S0 \| S1); SCC = result != 0 | `8D0C090B` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_nor_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_nor_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_xnor_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = ~(S0 ^ S1); SCC = result != 0 | `8E0D080C` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_xnor_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | acceptance pending |
| `s_xnor_b64` | SOP2, even SGPR pairs, inline integers or one zero-extended literal, SCC = full result != 0 | 4 B, 8 B with literal | yes | yes | three-way passed | resolved scalar pairs and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_lshl_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = S0 << S1[4:0]; SCC = result != 0 | `8F0EA40D` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_lshr_b32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = S0 >> S1[4:0], zero fill; SCC = result != 0 | `900FFF0E FFFFFFE1` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_ashr_i32` | SOP2, normal SGPR destination; normal SGPR, inline integer or literal sources with at most one literal; D = S0 >> S1[4:0], sign fill; SCC = result != 0 | `91109F0E` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
+9 -4
View File
@@ -24,7 +24,10 @@ is written, so either source pair may alias the destination.
Inline selectors 128–208 supply integers from −16 to 64 (§5.2), with negative
values represented in 64-bit two's complement. One source may use selector
255 and consume a following literal dword. The pinned AMD XML declares the
255 and consume a following literal dword. The pinned XML also defines a
`has_lit_0_has_lit_1` form, where both sources name the same literal; Xenora
does not accept it yet and rejects a second 255 selector (a subset restriction,
not a guide rule). The pinned AMD XML declares the
SOP2 logical literal operands as unsigned 64-bit values (`FMT_NUM_U64`). The
unsigned expansion rule in §6.2.1 gives them a zero high word even when bit
31 of the literal is set.
@@ -41,9 +44,11 @@ The compiler resolves pairs and SCC at translation time and emits Metal
Shading Language for the resulting vector operations. The original
`scalar-logic-b64.s` fixture uses all eight instructions and folds their
results into an XOR key. Local CPU checks cover 4,432 oracle cases and 2,608
operand rejections, and the LLVM three-way check covers fixture disassembly
and instruction boundaries. These are local checks against the guide, XML,
and LLVM. Native Metal readback and independent acceptance are pending.
operand rejections (on both interpreters and the compiler), and the LLVM
three-way check covers fixture disassembly and instruction boundaries. Through
the translator, the 4,432 cases also pass on native Metal (Apple M5, API and
shader validation on: 185 programs). These are local checks against the guide,
XML and LLVM; independent acceptance is pending.
```sh
cargo test --locked -p xenora-semantic-review --test sop2_b64
+2 -1
View File
@@ -6,7 +6,8 @@ the decoder uses. This page explains where entries live, what each field means,
how to check and regenerate the tables, and what the generator does not do for
you.
The registry covers the nine SOP2 forms listed in [SOP2 scalar ALU](scalar-alu.md).
The registry covers the forms counted in [semantic coverage](semantic-coverage.md); the SOP2
forms are listed in [SOP2 scalar ALU](scalar-alu.md) and [64-bit scalar logic](scalar-logic-b64.md).
## Files
+8 -8
View File
@@ -694,7 +694,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -718,7 +718,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -742,7 +742,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -766,7 +766,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -790,7 +790,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -814,7 +814,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -838,7 +838,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"
@@ -862,7 +862,7 @@ representation = "4 B, 8 B with literal"
lowering = "resolved scalar pairs and SCC"
reference = "implemented"
cpu = "local known-answer test passed"
gpu = "acceptance pending"
gpu = "local Apple M5 readback passed; acceptance pending"
recognized = true
decoded = true
llvm = "three-way passed"