shader: lower v_permlane16_b32 #576
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!576
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/576/head"
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?
@NolanCotter on GitHub · 2026-11-24 05:11 UTC · original
NolanCotter:permlane16→main· +284 −27 · 1 files · 4 commits · closed without mergingDepends 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
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>The same-row sibling of v_permlanex16_b32: each lane reads src0 of the lane picked by its nibble of {src2, src1}, in its own row of 16 of the 32-lane half — the shared arm just skips the row flip. IR-modeled in ir.rs and whole-wave-modeled in wave.rs (open PR #98) but refused at valu_op's fallthrough on main. Smoke test runs the identity-pick selector program through opcode 0x377 (the same-row form) feeding an LDS store. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>@Lyrnc on GitHub · 2026-11-24 05:58 UTC · original
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.
@slint6614-dev on GitHub · 2026-11-24 10:42 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 00:25 UTC · original
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