Repository navigation
shader: lower v_permlane16_b32 - #576
NolanCotter wants to merge 4 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>
Each signed i16 half of src0 saturates to an unsigned byte, packed into the destination's low 16 bits; the register's high half is kept (the GFX10 partial write, as v_cvt_f16_f32 — LLVM models the def as VOP1Inst_t16). src() refuses abs/neg, write_i refuses clamp/omod, and a nonzero op_sel is refused. 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 Marvisak#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>
|
RDNA2 hardware check of the lane rule: it matches, for 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 Model, as in your lowering: lane
So the same-row read (row bit kept) is right. In wave64 both stay inside each 32-lane half, as your Not covered: the FI and BOUND_CTRL bits, and inactive lanes. Your lowering refuses 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 fde38b3 (with #499 and the M0-split movrel commit underneath) on Windows 11, RTX 5070, MSVC: cargo test -p victory-shader -- --test-threads=1 72 passed, and cargo clippy -p victory-shader --all-targets is clean. victory translate --validate --pipelines on 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).- The underlying commits check out too:
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. - The new tests only check that the programs lower (
lowers_lds). A value check throughrun_casesfor permlane16 with a non-identity selector would catch a wrong nibble order.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catminou4
left a comment
There was a problem hiding this comment.
Test-merge with current main (ffe310e) conflicts — needs a rebase. Main moved recently (PR #566 waterfall loops touched lower.rs/resource.rs/valu_tests.rs), so shader PRs opened before it need rebasing. I'll re-review once it merges cleanly.
…anes and read back Conflict in emit/lower.rs (console_lanes): this PR's spill filter plus the fork's v_permlane entry (Marvisak#576). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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. |
…r launch From open pull requests of fxceless/victory-gta6, each reviewed, applied with its tests and fitted to this tree: - Marvisak#756: one sampler written into a program and used with and without a comparison is two static samplers; a comparison sampler with a minimum or maximum reduction stays a comparison. - Marvisak#714: a mesh program that allocates in every lane keeps its LDS barriers; scalar reads of unordered views; both edges of a branch to one block; the first lane of an offset that is held per lane. With the early-start bias of this tree's raw views on the unordered ones too. - Marvisak#576, in part: a loop with two empty latches, and the double flag of a program that lost its doubles. Not its block-local handles: 1,507 of 1,516 compute programs of a local cache make host pipelines here as they are, and the nine others ask for waves of 64 lanes (older translations). - Marvisak#646, in part: `DispatchX` counts threads where its flag says so. They ran as groups. - Marvisak#676, in part: a new view of a texture already on the card needs no room; two views of a placed texture that differ in its filler words (the title's stack, another in every launch) are of one texture. - Marvisak#481, in part: no barrier for a window of indirect arguments that this draw did not clamp. - Marvisak#591: the parts of a host copy a submission asks for, not the span between them. Marvisak#522: table constants that flights write are filled on the card. - Marvisak#745: samplers with modes the host does not know. Added: an ignored test that makes a host pipeline from every compute translation of a local cache; the staging pool's test waits for other tests' submissions. AI-assisted. GPU (170), shader (226) and format unit tests pass. Not run with the title. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 Shaders: model v_permlane16_b32 in whole-wave sections #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 shader: lower v_permlanex16_b32 #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