[PR #556] [MERGED] rdna2_decode: permlane16 op_sel and exp null match llvm-mc and shader_ir (DECODE-LLVM-PARITY) #602

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

📋 Pull Request Information

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

Base: main ← Head: decode-permlane-opsel


📝 Commits (1)

  • 86da7be rdna2_decode: permlane16 op_sel and the exp null target match llvm-mc and shader_ir (DECODE-LLVM-PARITY)

📊 Changes

2 files changed (+43 additions, -2 deletions)

View changed files

📝 tests/test_rdna2_decode.py (+34 -0)
📝 tools/rdna2_decode.py (+9 -2)

📄 Description

Claimed in the coordination issue as: DECODE-LLVM-PARITY (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125590718)

What and why

tests/test_rdna2_decode.py test_parity_with_llvm_mc_on_shader_fixtures compares rdna2_decode.decode_bytes with llvm-mc over every runtime/test/shaders/*.asm. On main 1c93c869 with llvm-mc 21.1.8 it fails. It is red in CI on main as well: fiestorra found the same assertion in main's own stdlib-tests-linux job (run 45320704311, head ece4ba5b3; finding in #14), and that run's check and macos-python jobs are failures too.

Correction (edited): this description first said CI skips the test because those jobs have no llvm-mc. That was wrong, a conclusion I drew from reading ci.yml without looking at a run.

Two decoder mismatches, the second hidden behind the first:

  1. v_permlane16_b32 / v_permlanex16_b32 (cs_w32_permlane_fi.asm). These use op_sel bits 0 and 1 as FI and BOUND_CTRL. llvm-mc prints op_sel:[FI,BOUND_CTRL], and nothing when both are 0, whatever bits 2 and 3 hold. The decoder printed the generic [s0,s1,s2,dst] list, e.g. op_sel:[0,1,0,0] for op_sel:[0,1].
  2. exp null (ps_w64_a_discard.asm). shader_ir.parse_line reads the null export target as the special register (core not in ("null",) in its target rule). decode_bytes gave {"k": "target", "t": "null"}, so a decoded exp null did not equal its own printed line parsed back. It now gives the special register for null and a target for every other name.

No translator output changes that I can find: Gen.opsel_bits(mods, 2) reads the first two values either way, and the python disassembly backend goes through disasm_bytes text and shader_ir.parse_line. No contract-table row: no translation rule changes.

Tested

Windows 11 Home build 26300, Python 3.12.10, llvm-mc 21.1.8 (built by scripts\build_llvm_mc.ps1), SPIRV-Tools v2026.4. No game files.

  • python -I tests/test_rdna2_decode.py with LLVM_MC set: 19 tests OK (17 on main, 1 failing). Without LLVM_MC and with no llvm-mc on PATH: 19 OK, 1 skipped.
  • New test_permlane16_opsel_is_the_fi_bound_ctrl_pair: ten op_sel values for each of the two ops, hand-assembled words. Fails on main's decoder. Each expectation was also compared with llvm-mc -disassemble -mcpu=gfx1013 by hand: 20 of 20 equal.
  • New test_exp_null_target_matches_the_parsed_line: exp null and exp mrt0 words from llvm-mc's own encoding.
  • The 22 other standalone test files that import rdna2_decode or shader_disasm: all OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 465 files, 6107 tests, 1 file failed, test_image_cube_store_glc (FileNotFoundError in its llvm-mc round trip). It fails the same way on main without this change; #419 covers it.
  • python -m compileall -q make_game.py tools tests: exit 0. scripts/check_no_game_data.py on both files: exit 0.
  • Not tested: an llvm-mc other than 21.1.8. The parity check was not run against the llvm-mc the Linux CI job uses.

GPUs tested: n/a

AI-assisted: yes (Claude Code found the failure, wrote the change and ran the tests)

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. (n/a: no translator rule)

🤖 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/556 **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:** `decode-permlane-opsel` --- ### 📝 Commits (1) - [`86da7be`](https://github.com/ubiquitarianism/leonida/commit/86da7be469d01562982ba9e49d7bef4fa3d94849) rdna2_decode: permlane16 op_sel and the exp null target match llvm-mc and shader_ir (DECODE-LLVM-PARITY) ### 📊 Changes **2 files changed** (+43 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_rdna2_decode.py` (+34 -0) 📝 `tools/rdna2_decode.py` (+9 -2) </details> ### 📄 Description Claimed in the coordination issue as: DECODE-LLVM-PARITY (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125590718) ### What and why `tests/test_rdna2_decode.py` `test_parity_with_llvm_mc_on_shader_fixtures` compares `rdna2_decode.decode_bytes` with llvm-mc over every `runtime/test/shaders/*.asm`. On main 1c93c869 with llvm-mc 21.1.8 it fails. It is red in CI on main as well: `fiestorra` found the same assertion in main's own `stdlib-tests-linux` job (run 45320704311, head ece4ba5b3; [finding in #14](https://github.com/ubiquitarianism/leonida/issues/14)), and that run's `check` and `macos-python` jobs are failures too. *Correction (edited): this description first said CI skips the test because those jobs have no llvm-mc. That was wrong, a conclusion I drew from reading `ci.yml` without looking at a run.* Two decoder mismatches, the second hidden behind the first: 1. **`v_permlane16_b32` / `v_permlanex16_b32`** (`cs_w32_permlane_fi.asm`). These use `op_sel` bits 0 and 1 as FI and BOUND_CTRL. llvm-mc prints `op_sel:[FI,BOUND_CTRL]`, and nothing when both are 0, whatever bits 2 and 3 hold. The decoder printed the generic `[s0,s1,s2,dst]` list, e.g. `op_sel:[0,1,0,0]` for `op_sel:[0,1]`. 2. **`exp null`** (`ps_w64_a_discard.asm`). `shader_ir.parse_line` reads the `null` export target as the special register (`core not in ("null",)` in its target rule). `decode_bytes` gave `{"k": "target", "t": "null"}`, so a decoded `exp null` did not equal its own printed line parsed back. It now gives the special register for `null` and a target for every other name. No translator output changes that I can find: `Gen.opsel_bits(mods, 2)` reads the first two values either way, and the `python` disassembly backend goes through `disasm_bytes` text and `shader_ir.parse_line`. No contract-table row: no translation rule changes. ### Tested Windows 11 Home build 26300, Python 3.12.10, llvm-mc 21.1.8 (built by `scripts\build_llvm_mc.ps1`), SPIRV-Tools v2026.4. No game files. - `python -I tests/test_rdna2_decode.py` with `LLVM_MC` set: 19 tests OK (17 on main, 1 failing). Without `LLVM_MC` and with no llvm-mc on PATH: 19 OK, 1 skipped. - New `test_permlane16_opsel_is_the_fi_bound_ctrl_pair`: ten `op_sel` values for each of the two ops, hand-assembled words. Fails on main's decoder. Each expectation was also compared with `llvm-mc -disassemble -mcpu=gfx1013` by hand: 20 of 20 equal. - New `test_exp_null_target_matches_the_parsed_line`: `exp null` and `exp mrt0` words from llvm-mc's own encoding. - The 22 other standalone test files that import `rdna2_decode` or `shader_disasm`: all OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 465 files, 6107 tests, 1 file failed, `test_image_cube_store_glc` (`FileNotFoundError` in its llvm-mc round trip). It fails the same way on main without this change; #419 covers it. - `python -m compileall -q make_game.py tools tests`: exit 0. `scripts/check_no_game_data.py` on both files: exit 0. - Not tested: an llvm-mc other than 21.1.8. The parity check was not run against the llvm-mc the Linux CI job uses. GPUs tested: n/a AI-assisted: yes (Claude Code found the failure, wrote the change and ran the tests) ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator rule) 🤖 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:18:26 +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#602
No description provided.