Repository navigation
Translator: v_movrelsd_2_b32 with separate M0 source/destination fields - #541
Merged
ItsNotRexed merged 1 commit intoNov 22, 2026
Merged
Conversation
VGPR[D + M0[25:16]] = VGPR[S0 + M0[9:0]] (RDNA2 ISA VOP1 opcode 72; same fields in the RDNA3 ISA). It raised Unsupported before (noted in ProjectLeonida#496). - tools/rdna2spirv.py: masks M0 per side on the existing movrel path. - tests/semantic/test_alu_movrelsd_2.py: 7 hand-computed cases through the translator and the interpreter, including ignored M0 bits set, the _e32 spelling and a check that it differs from v_movrelsd_b32. - runtime/test/shaders/cs_movrelsd_2.asm: GPU test (wave32 dump) with the ISA's own example; registered in check.py and run_gpu_tests.py. - docs/design.md: contract row for the v_movrel* forms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Tested 737735a on RTX 5070 (Blackwell, subgroup 32..32), NVIDIA 616.56, Windows 11 Pro 26200: pass.
Tools: llvm-mc 21.1.8 (WSL), Vulkan SDK 1.4.363.0, MSVC 19.50, Python 3.13. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New SHADER item (claimed in #374), follow-up to #496, which notes that
v_movrelsd_2_b32is not handled by the translator yet.What
v_movrelsd_2_b32(VOP1 opcode 72):VGPR[D + M0[25:16]] = VGPR[S0 + M0[9:0]]. Unlikev_movrelsd_b32, each side has its own 10-bit M0 field and the other M0 bits are ignored. Source: the RDNA2 ISA opcode description (§12.8) and the RDNA3 ISA, which give the same fields. The RDNA2 §6.6 summary table printsM0[7:0]for the source; no test relies on a source offset above 255, so they hold either way.tools/rdna2spirv.py: the existing movrel path masks M0 per side for this opcode (it raisedUnsupportedbefore).tests/semantic/test_alu_movrelsd_2.py: 7 hand-computed cases through the translator and the mini interpreter: M0 = 0, source-only, destination-only, different offsets, v0 as the source, ignored M0 bits set (0xFC00FC00), and the ISA's example. Also the_e32spelling and a check that the result differs fromv_movrelsd_b32. Without the translator change these fail (Unsupported).runtime/test/shaders/cs_movrelsd_2.asm: wave32 dump test with the ISA's example (v25 ← v17, M0 = (20 << 16) | 10) and a set-ignored-bits case;v15would be written by a translator that used M0[9:0] on both sides. Registered incheck.pyandrun_gpu_tests.pylikecs_w32_lane_wrap.docs/design.md: contract row for thev_movrel*forms, including what is not modelled (the hardware range check: out-of-range source reads VGPR0, out-of-range write is dropped; same as the other movrel forms today).When #496 lands, its docstring line saying
v_movrelsd_2_b32raises Unsupported will be stale; it has no assertion on it, so nothing breaks.Tested
Linux 7.3.5 (CachyOS),
python -I scripts/run_gpu_tests.py --build runtime/build/linux, each GPU pinned withVK_LOADER_DRIVERS_SELECT(device line checked),VK_LOADER_LAYERS_DISABLE=~implicit~, on91b36cf+ this commit:LEONIDA_W64_EMULATE=1: 72/72cs_movrelsd_2:11 33 33 55 1717 77 1515 1717on all three runsunittest discover -s tests/semanticOK;pytest tests --ignore=tests/semanticand the plaintests/test_*.py: the only failures (test_make_game_dry_run, 2 intest_swizzle_search) fail identically onmainon LinuxNo game files used. AI-assisted (Claude Code).
🤖 Generated with Claude Code