Repository navigation
shader: lower v_movrelsd_2_b32 and v_swaprel_b32 - #498
NolanCotter wants to merge 2 commits into
Conversation
Each lane reads src0 of a lane in the other row of 16 of its 32-lane
half, the pick taken from nibble i of the {src2, src1} selector. The
lowering mirrors the whole-wave model wave.rs already uses for the op,
through the same cross_lane/read_lane machinery as v_writelane_b32, and
the console_lanes detector now covers the v_permlane family so host
lanes are relabeled where the op appears.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Both M0-relative VGPR moves the IR already enumerates but the emitter refused. movrelsd_2 and swaprel split M0 in two fields — the source's offset is M0[9:0], the destination's M0[25:16] (the RDNA2 ISA's opcode description) — where the other movrel forms use the whole register for both. The existing select chains factor into read_at/write_at closures. A swap writes both operand ranges, so a register can carry two write tokens: write_at picks the first or the last and reads the value an earlier chain left, which also keeps the swap a no-op when both sides name the same register. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
LAKSHYA-cmd-tech
left a comment
There was a problem hiding this comment.
Verified on Windows 11 D3D12:
- All 71 tests in \�ictory-shader\ pass, including \m0_split_relative_moves.
- Relative VGPR addressing with M0 source/dest field splits matches RDNA2 ISA opcode specifications.
- \cargo clippy -p victory-shader\ clean with zero warnings.
- \cargo xtask policy\ passes (151 files checked, zero asset policy violations).
|
RDNA2 hardware measurement of the M0 split: it matches this PR. Setup. AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. A HIP kernel (assembled by the AMD driver's amd_comgr) fills
For reference, in the same runs AI use: Claude Code (Claude Opus 5.5) wrote the probes, ran them on the GPU above and drafted this comment; the numbers come from the hardware run. |
|
Measured on the full retail shader pack (26,503 containers) with CS 1441 / 1418 (+1 validated); VS/PS and MS unchanged. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 4f48c59 on Windows 11, RTX 5070, MSVC: cargo test -p victory-shader -- --test-threads=1 passes as part of the #576 stack (72 passed), including m0_split_relative_moves. cargo clippy -p victory-shader --all-targets is clean. This commit is on mercuryVM/VIctory main via #576.
- The M0 split is right per the RDNA2 ISA: the source offset is
M0[9:0]and the destinationM0[25:16]for bothv_movrelsd_2_b32andv_swaprel_b32. The other movrel forms keep the full M0. - Overlap: #627 (now updated, and also correct) lowers the same two VOP1 forms plus
s_movrelsd_2_b32. Only one should land. If this one goes first, #627 shrinks to the SOP1 form.
AI-assisted (Claude Code).
|
Triage note: this overlaps #627, which implements the same instructions ( |
|
I reran the dynamic-M0 readback fixture from #775 on this PR’s head (
|
|
Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head
|
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
|
I extracted the
If you adopt the readback in a combined commit, please retain |
Depends on #404 (shares the
lowers_ldstest helper; rebases to one commit once it lands).Summary
v_movrelsd_2_b32andv_swaprel_b32— the two M0-relative VGPR ops the IR already enumerates (ir.rs marks both(true, true)andv_swaprel_b32's src range as a write) but the emitter refused atinteger()'s fallthrough.read_at/write_atclosures and the plain movrel forms keep the whole-M0 index.v_swaprel_b32writes both operand ranges, so a register can carry two write tokens (reads resolve to the last):write_atpicks first/last token and seeds the old value from what an earlier chain wrote, which also makes a swap of equal indices a no-op.m0_split_relative_moveshand-encodesv[5+20] = v[1+10]/v[5+20] <-> v[1+10]with M0 = (20 << 16) | 10 feeding an LDS store; refused on main, lowers now.Test plan
cargo test -p victory-shader— 58 passedcargo clippy -p victory-shader— cleancargo fmt --check— cleanAI-assisted (Devin). Field split verified against the RDNA2 ISA opcode description (source M0[9:0], destination M0[25:16]); no game files used.
Generated with Devin