Shaders: lower v_permlane16_b32 and v_permlanex16_b32 outside full-wave sections #3663
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3663"
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 Luislariosss on 2026-11-28T04:15:23Z.
v_permlane16_b32andv_permlanex16_b32were previously only simulated inside full-wave sections with constant selectors, causing compute shaders that invoke them outside full-wave sections (e.g.a929109552ce1e84) to fail translation.Changes
v_permlane16_b32andv_permlanex16_b32invalu_op(crates/victory-shader/src/emit/lower.rs), supporting both constant and uniform SGPR nibble selectors,fi(fetch-invalid), andbc(bound-control) across wave32 and wave64 halves.v_permlane*to theconsole_lanesdetection list so compute shaders preserve console lane numbering.crates/victory-shader/src/emit/synthetic_tests.rscovering allopsel(fi/bc) combinations, constant/SGPR/mixed selectors, partial exec masks, full-wave rows, and wave64 32-lane half isolation.Verification
cargo xtask policy(191 files ok)cargo clippy -p victory-shader --all-targets -- -D warningscargo test -p victory-shader --lib(305 passed, 0 failed, 3 ignored)Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T04:48:05Z.
Independent WARP comparison on exact
498d63bandmain63bcca43. I used the same three generated PR fixtures in both builds.v_permlanex16_b32at lowering in all three fixtures.hardwareto WARP.For a full-active wave, the HLSL used
lane = WaveGetLaneIndex()and the same source as the PR fixture:The grouped version holds
baseat 0, 4, 8, etc. in each read ofbase | (src & 3u), then selects the result forsrc & ~3u. I ran both versions with matchingWaveSizeand thread-group widths of 32 and 64. This isolates the failure to the direct wave read on this runtime and matches the failure class in #2949. #2997 has the grouped path fords_bpermute. Applying it here still needs coverage for the new opcodes' fetch-inactive and bound-control cases.If reusing the test, please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T04:55:48Z.
Two things for this PR: it's the third open one for the same instructions, and here is the NVIDIA row for all three. RTX 3070 8 GB, driver 616.56, Windows 11, hardware adapter, each PR's own new tests, 3 runs each with the same result.
v_permlanex16_b32without fetch-inactiveb2d087epermlanex_partial_exec_matches_reference1/1733f9e8permlane_rows_and_inactive_sources,permlane_fi_zero_under_divergent_exec)498d63bwave64_permlanex16_stays_within_each_32_lane_halfhas no wave64 pipeline on NVIDIA, so it ran on WARP only.On andrewpozdnakov7-jpg's WARP failure above:
permlanes_with_every_lane_live_read_across_rowspasses on this card. That fits their DXC control, which pointed at WARP 1.0.22's wave reads rather than this lowering. (The system WARP here, 10.0.26100.9711, builds no wave32 pipeline and skipped the wave32 cases, so it says nothing either way.)None of the three links the others. #3587 also covers
v_permlane16_b32and the FI/BC flags, and it has the most rejection tests. #3560 ispermlanex16only. One should land and the other two be closed or rebased onto it.AI-assisted (Claude Code, Claude Opus 5.5 built the three heads and ran their tests on this card).
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T07:07:14Z.
Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head
498d63bon63bcca4. WARP has no pipeline for a wave of 32 and skips every case here, so this is the first physical coverage:permlanes_pick_lanes_by_nibble_with_fetch_and_bound_control,permlanes_with_every_lane_live_read_across_rowsandwave64_permlanex16_stays_within_each_32_lane_half.victory-shader --lib --features host: 305 passed, 0 failed, 3 ignored.#3587 lowers the same two instructions; it was verified on a Radeon 780M there.
AI use: Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T07:15:04Z.
I cross-ran the two PRs' synthetic fixtures on
498d63b(#3663) and733f9e8(#3587).WARP readback. With app-local WARP 1.0.22 and Agility 1.620.2, both heads dispatched the same three #3663 fixtures. Their output words matched one another exactly. The first failing readback in each fixture had 9/32 incorrect lanes (FI/BC matrix), 16/32 (all-active Wave32), and 32/64 (all-active Wave64). In this run the forced software adapter also handled the rows that the helper labels
hardware. These counts are separate from the RX 5700 XT result above.Fetch-inactive translation. I also ran the six CPU-only #3587 participation tests against both heads. Both accepted the three positive controls. #3587 refused the three negative cases as expected. #3663 translated and validated all three, so the refusal assertions fail. The cases are divergent EXEC, a scalar phi from a divergent branch, and a lane returned by the loop limit. This check covers translation and validation only.
The NEW-342 claim already covers adapting #2997's four-lane WARP path. The two test results above can help compare the current alternatives independently of that work.
Please retain the original Git authors if you reuse either PR's fixtures. For any contribution from this follow-up folded into another commit, please retain:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T21:55:46Z.
AMD Radeon 780M (RDNA3, runs both wave sizes) + WARP, Windows 11, head
498d63b. Before (main63bcca4+ this PR's tests): all three tests fail on main's lowering. After: 3/3 pass, 5 of 5 runs, the wave32 and wave64 cases on the 780M itself (system WARP skips both sizes). Full suite: 554 passed. AI-assisted (Claude).Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-29T14:03:34Z.
Comparison of the four open
v_permlanex16_b32PRs on AMD Radeon 780M (RDNA3, wave32 + wave64, driver 32.0.13022.3006), each head on its own tree, its own tests with--nocapture, then the whole victory-shader lib:kilolimaVI/VIctoryintegration/shader-10So the hardware does not separate them; all four lower the instruction correctly for what their tests cover. Per fiestorra's census on #201 one program on main is refused for
v_permlanex16_b32. Which of these four the title's program needs (FI, BOUND_CTRL, inside or outside a whole-wave section) is the open question for choosing one.AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.