Skip to content

TEST-1010: rdna2_decode: exp null is a special operand, as shader_ir parses it - #4697

Open
MichaelL401 wants to merge 1 commit into
ItsNotRexed:mainfrom
MichaelL401:rdna2-decode-exp-null
Open

MichaelL401 wants to merge 1 commit into
ItsNotRexed:mainfrom
MichaelL401:rdna2-decode-exp-null

Conversation

@MichaelL401

@MichaelL401 MichaelL401 commented Nov 23, 2026 •

Copy link
Copy Markdown

TEST-1010 (claim: #4571 (comment)): the llvm-mc parity test of tools/rdna2_decode.py fails on main.

What changed and why

tests/test_rdna2_decode.py::test_parity_with_llvm_mc_on_shader_fixtures fails on main (7b7d73f8) whenever llvm-mc is installed:

AssertionError: Lists differ: [('target', 'null', False, False), ...] != [('special', 'null', False, False), ...]
: runtime/test/shaders/ps_w64_a_discard.asm: exp

decode_bytes returned the export target null (EXP target 9) as {"k": "target", "t": "null"}. tools/shader_ir.py operand() (line 113, if m and core not in ("null",)) deliberately reads llvm-mc's exp null as {"k": "special", "t": "null", ...}, and the decoder's docstring promises shader_ir-compatible dicts. ps_w64_a_discard.asm (cc4231d) is the first fixture with exp null, so the mismatch showed up only now.

  • tools/rdna2_decode.py: target 9 is emitted as the same special-operand dict shader_ir.operand("null") returns. Every other target is unchanged. The disassembly text from disasm_bytes is unchanged (exp null off, off, off, off done vm), and rdna2spirv's export() already accepts both kinds, so translation output does not change.
  • tests/test_rdna2_decode.py: test_exp_null_target_matches_shader_ir decodes exp null ... done vm and exp mrt0 ... done vm (hand-written encodings, checked against llvm-mc) and compares the target operand with shader_ir.operand(). It needs no llvm-mc, so it runs in CI's standard-library job.

Why CI did not catch this: the standard-library job has no llvm-mc, so the parity test skips there, and the translator-tests job (which installs llvm-mc 21) runs only pytest-style files. I posted that separately as a finding (#4683 (comment)) and do not change CI here.

Tests

Linux (Ubuntu), Python 3.13.18 (python -I), llvm-mc 18.1.3 (Ubuntu). No GPU, no game files.

Command Before (7b7d73f8) After
python -I tests/test_rdna2_decode.py FAILED (failures=1: llvm-mc parity on ps_w64_a_discard.asm); with the new test added and the fix reverted: failures=2 OK, 10 tests (parity test ran, not skipped)
python -m compileall -q make_game.py tools tests exit 0 exit 0
python -I make_game.py --help exit 0 exit 0
every standard-library tests/test_*.py under python -I (340 files; 30 pytest-style files not run) 1 failing (test_rdna2_decode.py) all 340 pass
python -m unittest discover -s tests/semantic 6245 run: 3 failures, 3 errors, 13 skipped identical: the same 3 failures and 3 errors (test_loop_ballot_barrier wave64-emulate cases and test_vcmp16_opsel.test_spirv_val_compliance), so they predate this change and are not touched by it

AI Assisted

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at 1e7749b0d on Windows 11: tests/test_rdna2_decode.py -> 10 tests, OK (1 skipped); git diff --check clean.

exp null is now decoded as the special operand form shader_ir already parses (a null export target), with the added cases covering the accepted form and the near-miss that must stay invalid. No blocking issue.

decode_bytes returned the export target null (EXP target 9) as
{"k": "target"}, while shader_ir.operand() reads llvm-mc's `exp null`
as {"k": "special"}. The llvm-mc parity test in tests/test_rdna2_decode.py
failed on runtime/test/shaders/ps_w64_a_discard.asm, the first fixture
with `exp null`. The disassembly text is unchanged; rdna2spirv's export()
accepts both kinds.

Adds a regression test that needs no llvm-mc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MichaelL401
MichaelL401 force-pushed the rdna2-decode-exp-null branch from 1e7749b to 8bb9a8b Compare November 23, 2026 04:21
@Atomic258

Copy link
Copy Markdown

Tested 8bb9a8b8 on Windows 11, Python 3.15.2: pass.

  • python -I tests/test_rdna2_decode.py: 10 tests, OK (1 skipped — the llvm-mc parity test, not available on this box).
  • Control — PR test file against main's tool: the new exp null case fails ({'k': 'target', 't': 'null'} instead of the special operand), pinning the fix.
  • git diff --check + python -I scripts/check_no_game_data.py: clean.

No game files. AI-assisted (Devin).

@theswiss24

Copy link
Copy Markdown

Tested 8bb9a8b8 (merged onto main 98fa503f) on Linux (Ubuntu 24.04.5 / Mint 22.3), Python 3.12.3: pass.

  • python3 -I tests/test_rdna2_decode.py: 10 tests, OK (1 skipped) (main's copy: 9, OK, the same 1 skipped).

No game files.

Tested and written by Claude (Claude Code), posting from @theswiss24's account.

@justr4mzi

Copy link
Copy Markdown
Contributor

Verified commit 8bb9a8b8 on Windows 11 x64 (Python 3.14) with llvm-mc 21.1.8 enabled (0 skipped):

  • llvm-mc -triple=amdgcn--amdpal -mcpu=gfx1013 -show-encoding (both assemble and -disassemble) confirms exp null off, off, off, off done vm matches [0x90,0x18,0x00,0xf8,0x00,0x00,0x00,0x00].
  • python -I tests/test_rdna2_decode.py -v (0 skipped): 9/10 passed (including test_exp_null_target_matches_shader_ir).
    • The 1 failure (test_parity_with_llvm_mc_on_shader_fixtures on runtime/test/shaders/ps_sdwa_f16_const.asm: 'f9a00a7ef2148500' != 'f9a00a7eff148500003c0000') is pre-existing and unrelated to this PR — verified on clean upstream/main (98fa503f), which fails identically (8/9 passed, same assertion on ps_sdwa_f16_const.asm).
  • python -I -m py_compile tools/rdna2_decode.py tests/test_rdna2_decode.py, python -I scripts/check_no_game_data.py, and git diff --check: all exit 0.

Reviewed the diff (tools/rdna2_decode.py, tests/test_rdna2_decode.py); the exp null change looks clean.

AI-assisted (Gemini, Antigravity).

@junaydirfan

Copy link
Copy Markdown

Tested 8bb9a8b8 merged into main 98fa503f, on Linux (CachyOS) with llvm-mc 23.1.5 on PATH (the newest LLVM checked so far; the earlier runs had none, or 21.1.8): pass.

  • python3 -I tests/test_rdna2_decode.py: 10 tests OK, 0 skipped. The llvm-mc parity test runs over every GPU fixture and passes, including ps_w64_a_discard.asm's exp null.
  • Control (this PR's test file against main's tools/rdna2_decode.py): 2 failures, test_exp_null_target_matches_shader_ir and test_parity_with_llvm_mc_on_shader_fixtures. So both tests catch the bug, and the parity failure reproduces on LLVM 23 as well as 21.
  • The decoder's other users still pass on the merge: tests/test_shader_disasm.py OK, and tests/test_shader_ir*.py 37 passed.

No game files. AI-assisted (Claude Code).

@memorypressure

memorypressure commented Nov 23, 2026 •

Copy link
Copy Markdown

Reproduced and fixed, here too: on the stacked tree the llvm-mc parity test fails exactly at "exp null" in ps_w64_a_discard.asm (target vs special), and at your head all 10 tests pass against a real llvm-mc (LLVM 23 here; the target/special split is old behaviour so CI's LLVM 21 should agree). The llvm-mc-free regression test is a nice touch. The blocker is the base: the head carries the round-43 stack that reverts 11 merged PRs and deletes ~33 merged semantic tests (spot-checked: test_alu_dot2_f16.py present on main, deleted on the stack), and rdna2_decode does not exist on main at all — please rebase so the five-line fix can move independently of the triage decisions. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

Correction (2026-11-23): the base/rebase paragraph above was based on a stale main ref — wrong. The head contains current main and merge-trees cleanly; moreover, tests/test_rdna2_decode.py fails on main itself at the exp-null case today, so this fix is needed to turn main green. Please merge it.

bobcatchris added a commit to bobcatchris/Leonida that referenced this pull request Nov 23, 2026
tests/test_rdna2_decode.py's parity check is red on main at
ps_w64_a_discard.asm's `exp` null operand until ItsNotRexed#4697 merges, so listing
it in the new leg would fail CI. Run the other gated stdlib test now; the
registration test still detects the parity file and holds it in
LLVM_MC_BLOCKED, so it cannot be forgotten when ItsNotRexed#4697 lands.

AI-assisted.
@junaydirfan

Copy link
Copy Markdown

@memorypressure, I don't think the rebase blocker applies. Against ItsNotRexed/Leonida main (98fa503f), this PR is one commit (8bb9a8b8), 2 files, +22/-1, and its base is 98fa503f:

  • tools/rdna2_decode.py exists on main; the parity test above ran against it.
  • tests/semantic/test_alu_dot2_f16.py isn't on main or on this head, so nothing is deleted here.

It looks like the comparison was against a different branch. (Same on #4716, which is one commit on main too.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants