rdna2_decode: align DS single-offset and ds_swizzle_b32 ROTATE/FFT formatting with LLVM (DECODE-DS-PARITY) #1524
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1524"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by jarvixaiassistant-glitch on 2026-11-25T03:25:33Z.
Claimed in the coordination issue as: DECODE-DS-PARITY
What and why
Closes all 19 remaining mismatches in
tools/rdna2_decode.pyagainst LLVM 21.1.8'sgfx10_ds.txtDS disassembler test vectors (bringing DS parity to 1,708/1,708 exact):ds_condxchg32_rtn_b64single-offset formatting (6 vectors):_decode_onechecked2_ in name or 2st64_ in nameto detect dual-offset DS instructions, which falsely matched32_inds_condxchg32_rtn_b64and emittedoffset0:/offset1:instead of a single 16-bitoffset:. Restricted dual-offset detection toname.startswith((ds_read2, ds_write2, ds_wrxchg2)).ds_swizzle_b32swizzle formatting (13 vectors): Updated_format_ds_swizzleto match LLVMAMDGPUInstPrinter::printSwizzle:offset16 == 0: omit theoffset:modifier entirely (instead of emittingoffset:swizzle(BITMASK_PERM,00000)).0xC000..0xDFFF: emitoffset:swizzle(ROTATE,dir,size)wheredir = (offset16 >> 10) & 1andsize = (offset16 >> 5) & 0x1F.0xE000..0xFFFF: emitoffset:swizzle(FFT,mask)wheremask = offset16 & 0x1F.tests/test_rdna2_decode.pycoveringds_condxchg32_rtn_b64single 16-bit offset,ds_swizzle_b32zero/ROTATE/FFT/existing bitmask modes, and preservation ofds_read2_b32/ds_write2st64_b64dual-offset printing.Tested
All synthetic CPU/stdlib/docs/CI checks on Windows 11 x64, Python 3.12.14, Khronos SPIRV-Tools (
LEONIDA_REQUIRE_SPIRV_TOOLS=1), no game data, nollvm-mcinstalled locally:python -I tests/test_rdna2_decode.py -v— 21/21 passed (1 skipped:llvm-mcnot installed)python -I tests/test_shader_disasm.py— 31/31 passedpython -I tests/test_ci_registration.py— 16/16 passedpython -I scripts/check_no_game_data.py— passedpython -m compileall -q tools/rdna2_decode.py tests/test_rdna2_decode.py— passedgfx10_ds.txtvectors: 1,708/1,708 exact (was 19 mismatches)GPUs tested: n/a (pure-Python ISA binary decoder only)
AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek V4 Flash + NVIDIA NIM Nemotron-3.5-Lightning & Nemotron-3-Ultra-550B)
Checklist
main(1cfc29af7) and merges cleanly.docs/design.md, with how it was confirmed. (N/A — pure-Python DS disassembler formatting parity with LLVM; no translator rule changed.)Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:34:00Z.
[KEEP]
tools/rdna2_decode.pynarrows dual-offset detection tods_read2/ds_write2/ds_wrxchg2(fixing the32_false match onds_condxchg32_rtn_b64) and_format_ds_swizzlegains the zero/ROTATE/FFT cases, with targeted tests intests/test_rdna2_decode.py.tools/rdna2_decode.py(#633, #637, #1525), so a rebase may be needed depending on merge order; no conflicts are reported right now.llvm-mcwas not available to the author.Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T03:52:28Z.
Review: APPROVED
Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Checked against LLVM's ds_swizzle encoding: FFT is 0xE000 | n, ROTATE is 0xC000 | dir << 10 | size << 5, and offset 0 prints nothing; the two-address test now matches ds_read2/ds_write2/ds_wrxchg2 by prefix instead of any "2_" in the name.
AI-assisted (Claude).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:44:06Z.
Windows 11 +
llvm-mc(gfx1030) Parity Verification (b7f1371c05)Verified
b7f1371c0524a1c4a4eb1758e2ddf1b8662e82d4merged cleanly ontomain(adfb3821a) on native Windows 11 (10.0.26200, CPython3.12.10,LLVM_MCactive with AMDGPUgfx1030target), with zero game data.main):ds_condxchg32_rtn_b64([0x04, 0x00, 0xF8, 0xD9, 0x01, 0x02, 0x00, 0x05]) was misclassified as a 2-address DS instruction because"2_"matched"32_", emitting['offset0:4']instead of['offset:4'].ds_swizzle_b32formatted0xC000..0xDFFFand0xE000..0xFFFFas raw decimal offsets (['offset:49152'],['offset:57360']) rather than LLVM'sswizzle(ROTATE,...)andswizzle(FFT,...)syntax, and did not omitoffset:whenoffset16 == 0.main + #1524):LLVM_MC=<llvm-mc> python -I tests/test_rdna2_decode.py -v:24/24 OK(36.120s, including livetest_parity_with_llvm_mc_on_shader_fixtures).llvm-mc -triple=amdgcn -mcpu=gfx1030 --disassemblestring parity across all11binary test encodings (ds_condxchg32_rtn_b64offset:4/offset:65535/gds,ds_read2_b32offset0:4 offset1:8, andds_swizzle_b320,ROTATE(0,0),ROTATE(1,1),ROTATE(1,31),FFT(0),FFT(16),FFT(31) gds):11/11exact disassembly string matches (and10/10canonical encodings re-assemble byte-identically viallvm-mc --show-encoding;0xFFFFcanonicalizes to0xE01Fas in LLVM'sprintSwizzle& 0x1Fmask).check_no_game_data.py,test_ci_registration.py,test_docs_encoding.py, andtest_text_write_line_endings.pyallOK.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:17:12Z.
Tested
b7f1371c0merged (no commit) withmain829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_rdna2_decode.py, 24 tests pass.tools/rdna2_decode.pyback tomain, 10 failures (e.g.['offset:65535', 'gds'] != ['offset:swizzle(FFT,31)', 'gds']).No blocker from my side.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:17:51Z.
Ready for testing: merges cleanly with
main3535eb5c4. Not inmainyet:git cherryfinds 1 commit(s) not there, and 2 of the 43 lines it adds are already present. No duplicate found: its claimDECODE-DS-PARITYappears in no other open pull request and in nomaincommit.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T15:19:53Z.
RUN of #1524 (red/green,
python -I, no build, no game, no GPU)Heads tested: PR head
b7f1371c0524, current origin/main91bab934d7ee; merged = main + PR head,git merge --no-ff, local only (merged cleanly, merge commit8babb3ce30ba).Commands, one process each, from the worktree root:
python -I tests/test_rdna2_decode.pyRelated (they import
tools/rdna2_decode.py):tests/test_fspx_unpack.py,tests/test_shader_stage_resume.py,tests/semantic/test_dpp_compare.py,test_library_compute_forms.py,test_wave64_sdst_pair_fixture.py, andtest_image_sample_bias_nonps.py(see the note).tools/rdna2_decode.pywith the PR's tests; no new API, so this is a behavioural red, not a build failure):FAILED (failures=10)of 23 tests, all intest_ds_condxchg32_single_offset_and_swizzle_modes_match_llvm. Main printsoffset0:4/offset0:255 offset1:255where LLVM printsoffset:4/offset:65535for single-offset DS ops, prints a BROADCAST swizzle fords_swizzle_b32with offset 0 where LLVM prints none, and prints rawoffset:49152instead ofswizzle(ROTATE,..)/swizzle(FFT,..). The tests fail for the reason the PR fixes.test_rdna2_decode.pyRan 23, OK; all related files OK.test_rdna2_decode.pyRan 24 (main added one), OK; all related files OK. Nothing fails merged that passes on main.tests/semantic/test_image_sample_bias_nonps.pyfails underpython -IwithModuleNotFoundError: No module named 'support'(isolated mode does not put the script folder on sys.path). Pre-existing on main, not touched by the PR; run aspython tests/semantic/test_image_sample_bias_nonps.pyit passes (7 tests OK at PR head and merged).Machine: NVIDIA GeForce RTX 3090 (not used), Windows 11 Pro 10.0.26300, CPython 3.13.12.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T19:49:13Z.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS, Python 3.12.16, spirv-tools + llvm-mc, main
0e8737f2a(merges cleanly; does not force a rebase of #2566 atcfd12b24f), PR headb7f1371c0: red 10 failures / green 24 OK, 0 skippedtests/test_rdna2_decode.pychanged on main (79a5d7838) since the PR base, so red = the merged test file against main's code.scripts/run_semantic_tests.py tests/semantic) and the CI translator-tests pytest selection on main and on the merge: identical to main (main: onlytest_interp_computed_ij_fallbackx2; translator-tests 2047 OK / 19 skipped). No new failure..asmfixture /docs/design.mdrow needed.is_2addrkeys on theds_read2/ds_write2/ds_wrxchg2prefixes instead of searching "2_";offset16 == 0no longer emits a swizzle modifier. No game data.Verdict: READY
AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T10:16:55Z.
@jarvixaiassistant-glitch could you merge current
maininto this branch (a merge, no rebase or force-push) so CI runs again?The red/green from TheGeogeo, OreoFR and others is on the current head
b7f1371c0. What is in the way is CI on that head, which is red on macos-python, check, stdlib-tests-linux, linux-gpu-tools and macos and ran on an older base. Onmainat4014af7f, CI was green exceptmacos. I have not checked whether each red here comes frommainor from this PR, so the new run should tell.The merge changes the head, so the red/green will need to be run again on the new one.
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by jarvixaiassistant-glitch on 2026-11-30T14:12:31Z.
@MoonEyes Merged current
main(f44904d21) intofix/decode-ds-llvm-parityas merge commitaa0687837(no rebase / no force-push, clean zero-conflict merge) so CI runs fresh against currentmain.Local verification on
aa0687837(Windows 11, Python 3.12, CPU-only, no game data):python -I tests/test_rdna2_decode.py: 24 ran, OK (1 skipped without localllvm-mc)python -I tests/test_fspx_unpack.py: 37 OK (1 skipped)python -I tests/test_shader_stage_resume.py: 47 OKpython -I tests/test_docs_cli_flags.py: 4 OKpython -I tests/test_ci_registration.py: 18 OKpython -I tests/test_text_write_line_endings.py: 3 OKpython -I scripts/check_no_game_data.py: clean (exit 0)AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T07:55:11Z.
Verified by MoonEyes (another person than the author) on head
aa0687837merged withmain501b3e6c5: Windows 11, Python 3.14, nollvm-mcin use here.tests/test_rdna2_decode.py: 24 tests, 23 OK and 1 error,test_parity_with_llvm_mc_on_shader_fixtures(it does not findllvm-mcon this machine, and the same test errors onmain). Red: withtools/rdna2_decode.pyback tomain, 10 failures plus that same error. Neighbourstest_fspx_unpack,test_rdna2_isa_tablesandtest_shader_disasmOK.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T08:39:27Z.
Merging. Head
aa0687837merges cleanly withmaincd73ddab7and does not force a rebase of #2566. CI green on this head and on main. Red/green by TheGeogeo, OreoFR, enlight3d and zmasi on an earlier head with the same change; I ran it on this head merged with main (Windows, Python 3.14, no llvm-mc here): 23 of 24 OK, 10 failures without the change, the one error is llvm-mc missing and the same on main. A decoder tool and its test. Merged by MoonEyes.AI-assisted (Claude Code).