shader: lower v_permlane16_b32 #576
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/576"
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 Marvisak/VIctory. Originally posted by NolanCotter on 2026-11-24T05:11:36Z.
Depends on #499 (the arm it extends is introduced by #404; the diff shrinks to one commit as the queue lands).
Summary
v_permlane16_b32(VOP3 0x377), refused atinteger()'s fallthrough on main. PR #98 models it in whole-wave sections (wave.rs) but does not lower it to DXIL — this complements that work.v_permlanex16_b32arm: same nibble-of-{src2,src1} pick, sameread_lane/cross_lanemachinery, but the row bit is kept (same-row read) instead of XOR-flipped (other-row read). Matches thewave.rs:411model.console_lanesdetector already covered it via thev_permlaneprefix added in #404.Test plan
cargo test -p victory-shader— 59 passedcargo clippy -p victory-shader— cleancargo fmt --check— cleanAI-assisted (Devin). Semantics from the AMD RDNA2 ISA opcode description and the repo's own
wave.rsmodel; no game files used.Generated with Devin
Imported from Marvisak/VIctory. Originally posted by Lyrnc on 2026-11-24T05:58:42Z.
RDNA2 hardware check of the lane rule: it matches, for
v_permlane16_b32and for thev_permlanex16_b32arm it shares.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) runs
v_permlane16_b32 vD, v4, s20, s21andv_permlanex16_b32 vD, v4, s20, s21with laneiholdingi + 1, so each output names its source lane. There are 16 selectors:0x76543210:0xfedcba98(identity),0x01234567:0x89abcdef(reverse), all-0, all-F, a pair swap, and 11 random. Wave32 and wave64 kernels, noop_sel(FI/BOUND_CTRL clear), all lanes active. RDNA2 desktop silicon, not the console's. No game data.Model, as in your lowering: lane
ireads lane(i & ~31) | row | nibble_(i & 15)({src2, src1}), whererow = i & 16forv_permlane16_b32and(i & 16) ^ 16forv_permlanex16_b32.v_permlane16_b32, 16 selectorsv_permlanex16_b32, 16 selectorsSo the same-row read (row bit kept) is right. In wave64 both stay inside each 32-lane half, as your
halfterm keeps them.Not covered: the FI and BOUND_CTRL bits, and inactive lanes. Your lowering refuses
op_sel, so neither is needed for it.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.
Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T10:42:29Z.
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate --pipelines(pipelines on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. Merged locally with current mainc7a5f49(main: CS 1440 / 1417).CS 1441 / 1418 (+1 validated); VS/PS and MS unchanged.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T12:01:54Z.
Review: APPROVED
Tested
fde38b3(with #499 and the M0-split movrel commit underneath) on Windows 11, RTX 5070, MSVC:cargo test -p victory-shader -- --test-threads=172 passed, andcargo clippy -p victory-shader --all-targetsis clean.victory translate --validate --pipelineson the local title executable still reports 12 of 12 programs.v_permlane16_b32reuses thepermlanex16arm and drops only the row XOR, which is the documented difference (same row of 16 versus the other row).v_sat_pk_u8_i16puts sat8(hi) in byte 1 and sat8(lo) in byte 0 and keeps the high half.v_movrelsd_2_b32/v_swaprel_b32use M0[9:0] for the source and M0[25:16] for the destination, which is the split I also asked #627 for.lowers_lds). A value check throughrun_casesfor permlane16 with a non-identity selector would catch a wrong nibble order.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T12:44:26Z.
Review: COMMENTED
Test-merge with current main (
ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touchedlower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:25:27Z.
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1014. v_permlane16_b32 on top of a three-PR stack (#404, #498, #499); #1014 has both permlane forms in 49 lines.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed