shader: lower v_permlanex16_b32 #404
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/404"
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-24T02:57:37Z.
Summary
v_permlanex16_b32invalu_op: each lane readssrc0of a lane in the other row of 16 of its 32-lane half, the pick taken from nibbleiof the{src2, src1}selector — the same mathwave.rsalready uses to model the op, built through thecross_lane/read_lanemachineryv_writelane_b32uses.v_permlane16_b32(same row, PR #98's wave.rs model) stays refused; a follow-up can share this arm's index math.console_lanesdetector now covers thev_permlanefamily so a compute program using the op gets console lane relabeling.opsel != 0is rejected rather than silently ignored.v_permlanex16_b32feeding an LDS store); it failed on main with the write missing and passes now.Test plan
cargo test -p victory-shader— 57 passed (was 56 + 1 failing before the fix)cargo clippy -p victory-shader— cleancargo fmt --check— cleanAI-assisted change (Devin). Verified against the lane math already in
emit/wave.rs; no game shaders were used.Generated with Devin
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T05:53:02Z.
Review: APPROVED
Tested
d505b0eon Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (265 passed, 0 failed).victory translate <title exe> --validate --pipelinesgives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. The 12 embedded programs are vertex and pixel only, so they don't use this op.iis(i & 15) * 4bits into{src2, src1}, and& 31after picking the word gives the right shift for nibbles 8–15.(lane & ~31) | ((lane & 16) ^ 16) | pickaddresses the other row of the same 32-lane half.op_sel != 0is the right call. For permlane, op_sel[0] and op_sel[1] are FI and BOUND_CTRL, which this lowering does not model.vdston hardware, butread_lanereturns the inactive lane's value. That only matters for partially active waves.run_casestest invalu_tests.rswith a non-identity selector would also check the lanes on hardware and WARP.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:32:39Z.
Thanks @NolanCotter for adding
v_permlanex16_b32lowering. I tested headd505b0e4c5e3d29a7d027e639d70651386f71b2awith:Result: 1 passed, 0 failed (69 filtered out). The synthetic wave test verifies the instruction reads the selected lane from the other 16-lane row. It checks the lowering model, not behavior in an executing title.
Imported from Marvisak/VIctory. Originally posted by Lyrnc on 2026-11-24T06:02:25Z.
RDNA2 hardware check of the lane rule: matches.
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_permlanex16_b32 vD, v4, s20, s21with laneiholdingi + 1. There are 16 selectors (identity, reverse, all-0, all-F, a pair swap, 11 random), in wave32 and wave64 kernels, withoutop_sel, all lanes active. RDNA2 desktop silicon, not the console's. No game data.Lane
ireads lane(i & ~31) | ((i & 16) ^ 16) | nibble_(i & 15)({src2, src1}), that is, the other row of its own 32-lane half: 16/16 selectors in wave32 and 16/16 in wave64. The same run checkedv_permlane16_b32(own row) for #576, also 32/32.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:35Z.
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 MichaelSmithAI on 2026-11-24T10:52:53Z.
We ran the DXIL emitted by
d505b0eon an RTX 4090 under Wine/vkd3d-proton 3.2. For an all-active Wave32 guest, laneiheld29 + iand the two selector words were0x5312e4b0and0x98fc6ad7. All 32 output words matched the cross-row rule measured on RDNA2 above. For example, lanes 0 and 16 returned 45 and 29, and lanes 1 and 17 returned 56 and 40. Microsoft DXV accepted the emitted shader.A separate 64-thread Wave64 guest fixture also validated, but the emitted shader requested
WaveSize=64. This adapter advertises only 32, so pipeline creation was refused and no Wave64 result was recorded. These controls used synthetic inputs; the single newly validated title program in the RX 9070 report has no pixel or buffer readback here.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T13:19:33Z.
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:02:35Z.
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1014. v_permlanex16_b32 through waveReadLaneAt; #1014 lowers it and v_permlane16_b32 with the same lane math in one change, without the three-PR stack.
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