[PR #957] [MERGED] rdna2spirv, shader_disasm: VOPC compares in DPP form (SHADER-VOPC-DPP) #997

Closed
opened 2026-11-26 20:19:44 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/957
Author: @quartz-heron-58
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: vopc-dpp


📝 Commits (1)

  • d046559 rdna2spirv, shader_disasm: VOPC compares in DPP form (SHADER-VOPC-DPP)

📊 Changes

9 files changed (+407 additions, -4 deletions)

View changed files

📝 docs/design.md (+1 -0)
📝 runtime/test/shaders/check.py (+3 -1)
➕ runtime/test/shaders/cs_dpp_cmp.asm (+22 -0)
📝 scripts/run_gpu_tests.py (+16 -2)
➕ tests/semantic/fixtures/disasm/cs_dpp_cmp.s (+14 -0)
➕ tests/semantic/test_dpp_compare.py (+230 -0)
📝 tools/rdna2_decode.py (+25 -0)
📝 tools/rdna2spirv.py (+16 -1)
📝 tools/shader_disasm.py (+80 -0)

📄 Description

Claimed in the coordination issue as: SHADER-VOPC-DPP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136080089)

Depends on: conflicts with #281 in tools/shader_disasm.py (both split disasm into run_mc plus a second pass over the words llvm-mc rejected; whichever merges second needs a small rebase). Builds on none.

What and why

Three of the 2,684 pipeline-library compute programs of 1.0.2.1 hold a VOPC compare whose src0 field is a DPP marker: 4 v_cmp_gt_f32 each, with quad_perm:[1,0,3,2], quad_perm:[2,3,0,1], row_ror:8 (all bound_ctrl:1, masks 0xF) and dpp8:[4,5,6,7,0,1,2,3], beside v_min/max_f32_dpp and v_mov_b32_dpp on the same lanes. llvm-mc (LLVM 21.1.8, gfx1013) rejects the first word, so the listing dropped 7 words per program and the translator refused all three (fall-through into undecodable words). The retail boot asks for these pipelines at device slot 67.

These are the three small programs still refused with #674 + #647 + #593 + #583 applied (2,672 of 2,684 translate then, measured for the first three and counted from the header census for #583; the other 9 are the large vcc-tuple family). This change needs none of them.

  • tools/shader_disasm.py: a rejected VOPC word with a DPP src0 is decoded with its first word turned into v_max_f32 into v0, which takes the same DPP second word, so llvm-mc prints the two sources and the DPP controls; the line then gets the compare's name, a vcc_lo destination and the real encoding back (with_vopc_dpp). A word that does not come out as the stand-in at an instruction boundary is left as it was.
  • tools/rdna2_decode.py: decodes the pair directly. Before, it printed the DPP marker as an operand.
  • tools/rdna2spirv.py (Gen.dpp_insn): a compare takes src0 through the existing DPP lane selection and writes its mask as the plain compare does. Only the forms where every lane writes its bit are translated: row_mask and bank_mask 0xF and either bound_ctrl 1 or DPP8. Any other form, and v_cmpx, is refused (DPP compare with lanes that keep their mask bit).
  • scripts/run_gpu_tests.py: llvm-mc does not assemble the form either (dpp variant of this instruction is not supported), so a .asm can carry a marker line that passes its text through as the listing, the way regen_fixtures.py writes fixtures. cs_dpp_cmp.asm is the only one.
  • docs/design.md: the contract row "DPP on a VOPC compare".

Not measured on hardware. The rule follows from the encoding, LLVM's GFX11 definition of the same form and the VOP2 DPP rules already measured; tools/crosslane_fuzz.py --dpp-sweep --oracle hw does not cover compares and I have no Linux AMD machine for it. That is why the forms that leave a lane unwritten are refused rather than guessed. If someone with the oracle rig can run the four forms above, the row should say so.

Tested

  • The three programs, from an own 1.0.2.1 copy, with this branch alone: 0 invalid words each, 4 compare lines each, 3 of 3 translate and pass spirv-val (--wave64-emulate). With main's listings and translator: 0 of 3.
  • python -I tests/semantic/test_dpp_compare.py: 9 pass. Lane values for 3 compares x 8 forms x 3 EXEC cases in the SPIR-V interpreter against a reference; refusals; both printers give the same line for 5 synthetic pairs (the llvm-mc cases skip without LLVM_MC).
  • python -I scripts/run_semantic_tests.py tests/semantic: 466 files, 6,117 tests, 1 file fails (test_image_cube_store_glc), which also fails on main here.
  • tests/test_rdna2_decode.py, tests/test_shader_disasm.py, tests/semantic/test_dpp_eager_subgroup.py, tests/test_run_gpu_tests*.py, tests/semantic/regen_fixtures.py --check, tests/test_docs_design_rows.py, tests/test_docs_repo_paths.py, tests/test_docs_table_rows.py: pass.
  • scripts/run_gpu_tests.py --filter cs_dpp: cs_dpp_cmp passes (3 2 3 2 1 0 1 0) on all three runs below, with the other cs_dpp* unchanged.
  • Translated shader counts for the main corpus were not re-measured: none of its 26,503 listings holds the form (all translate on main).

GPUs tested: NVIDIA GeForce RTX 4080 (driver 621.24, Windows 11 26300), native 9/10 with cs_dpp_w64 skipped (no 64-wide subgroup) and LEONIDA_W64_EMULATE=1 10/10; AMD Radeon integrated graphics (PCI 1002:13C0, driver 32.0.21042.62, same machine), native 10/10.

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/957 **Author:** [@quartz-heron-58](https://github.com/quartz-heron-58) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `vopc-dpp` --- ### 📝 Commits (1) - [`d046559`](https://github.com/ubiquitarianism/leonida/commit/d046559435c22f1dc834001b1e117a992358f89e) rdna2spirv, shader_disasm: VOPC compares in DPP form (SHADER-VOPC-DPP) ### 📊 Changes **9 files changed** (+407 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) 📝 `runtime/test/shaders/check.py` (+3 -1) ➕ `runtime/test/shaders/cs_dpp_cmp.asm` (+22 -0) 📝 `scripts/run_gpu_tests.py` (+16 -2) ➕ `tests/semantic/fixtures/disasm/cs_dpp_cmp.s` (+14 -0) ➕ `tests/semantic/test_dpp_compare.py` (+230 -0) 📝 `tools/rdna2_decode.py` (+25 -0) 📝 `tools/rdna2spirv.py` (+16 -1) 📝 `tools/shader_disasm.py` (+80 -0) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-VOPC-DPP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136080089) Depends on: conflicts with #281 in `tools/shader_disasm.py` (both split `disasm` into `run_mc` plus a second pass over the words llvm-mc rejected; whichever merges second needs a small rebase). Builds on none. ### What and why Three of the 2,684 pipeline-library compute programs of 1.0.2.1 hold a VOPC compare whose src0 field is a DPP marker: 4 `v_cmp_gt_f32` each, with `quad_perm:[1,0,3,2]`, `quad_perm:[2,3,0,1]`, `row_ror:8` (all `bound_ctrl:1`, masks 0xF) and `dpp8:[4,5,6,7,0,1,2,3]`, beside `v_min/max_f32_dpp` and `v_mov_b32_dpp` on the same lanes. llvm-mc (LLVM 21.1.8, `gfx1013`) rejects the first word, so the listing dropped 7 words per program and the translator refused all three (`fall-through into undecodable words`). The retail boot asks for these pipelines at device slot 67. These are the three small programs still refused with #674 + #647 + #593 + #583 applied (2,672 of 2,684 translate then, measured for the first three and counted from the header census for #583; the other 9 are the large vcc-tuple family). This change needs none of them. - `tools/shader_disasm.py`: a rejected VOPC word with a DPP src0 is decoded with its first word turned into `v_max_f32` into `v0`, which takes the same DPP second word, so llvm-mc prints the two sources and the DPP controls; the line then gets the compare's name, a `vcc_lo` destination and the real encoding back (`with_vopc_dpp`). A word that does not come out as the stand-in at an instruction boundary is left as it was. - `tools/rdna2_decode.py`: decodes the pair directly. Before, it printed the DPP marker as an operand. - `tools/rdna2spirv.py` (`Gen.dpp_insn`): a compare takes src0 through the existing DPP lane selection and writes its mask as the plain compare does. Only the forms where every lane writes its bit are translated: `row_mask` and `bank_mask` 0xF and either `bound_ctrl` 1 or DPP8. Any other form, and `v_cmpx`, is refused (`DPP compare with lanes that keep their mask bit`). - `scripts/run_gpu_tests.py`: llvm-mc does not assemble the form either (`dpp variant of this instruction is not supported`), so a `.asm` can carry a marker line that passes its text through as the listing, the way `regen_fixtures.py` writes fixtures. `cs_dpp_cmp.asm` is the only one. - `docs/design.md`: the contract row "DPP on a VOPC compare". **Not measured on hardware.** The rule follows from the encoding, LLVM's GFX11 definition of the same form and the VOP2 DPP rules already measured; `tools/crosslane_fuzz.py --dpp-sweep --oracle hw` does not cover compares and I have no Linux AMD machine for it. That is why the forms that leave a lane unwritten are refused rather than guessed. If someone with the oracle rig can run the four forms above, the row should say so. ### Tested - The three programs, from an own 1.0.2.1 copy, with this branch alone: 0 invalid words each, 4 compare lines each, 3 of 3 translate and pass `spirv-val` (`--wave64-emulate`). With `main`'s listings and translator: 0 of 3. - `python -I tests/semantic/test_dpp_compare.py`: 9 pass. Lane values for 3 compares x 8 forms x 3 EXEC cases in the SPIR-V interpreter against a reference; refusals; both printers give the same line for 5 synthetic pairs (the llvm-mc cases skip without `LLVM_MC`). - `python -I scripts/run_semantic_tests.py tests/semantic`: 466 files, 6,117 tests, 1 file fails (`test_image_cube_store_glc`), which also fails on `main` here. - `tests/test_rdna2_decode.py`, `tests/test_shader_disasm.py`, `tests/semantic/test_dpp_eager_subgroup.py`, `tests/test_run_gpu_tests*.py`, `tests/semantic/regen_fixtures.py --check`, `tests/test_docs_design_rows.py`, `tests/test_docs_repo_paths.py`, `tests/test_docs_table_rows.py`: pass. - `scripts/run_gpu_tests.py --filter cs_dpp`: `cs_dpp_cmp` passes (`3 2 3 2 1 0 1 0`) on all three runs below, with the other `cs_dpp*` unchanged. - Translated shader counts for the main corpus were not re-measured: none of its 26,503 listings holds the form (all translate on `main`). GPUs tested: NVIDIA GeForce RTX 4080 (driver 621.24, Windows 11 26300), native 9/10 with `cs_dpp_w64` skipped (no 64-wide subgroup) and `LEONIDA_W64_EMULATE=1` 10/10; AMD Radeon integrated graphics (PCI 1002:13C0, driver 32.0.21042.62, same machine), native 10/10. AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:44 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#997
No description provided.