shader: omit WaveSize(64) for wave-invariant ds_swizzle and 32-lane DPP ops #3421
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!3421
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3421"
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?
@danielibabet on GitHub · 2026-11-27 00:20 UTC · original
danielibabet:pr/wave-invariant-swizzle-dpp→main· +360 −15 · 3 files · 3 commits · open\ds_swizzle_b32\ (4-lane quad and 32-lane group modes) and intra-32-lane GFX10 DPP modifiers (everything except \wave_shl1, \wave_rol1, \wave_shr1, \wave_ror1, and
ow_bcast31) produce identical lane indices on Wave32 and Wave64 without relabelling \ hread_id.
Keep \console_lanes = false\ and omit \WaveSize(64)\ when a Wave64 compute shader only uses those wave-invariant cross-lane ops, allowing Wave32-only GPUs (NVIDIA) to compile and run them without \WaveSize(64)\ rejections.
Verified:
@Dukestar69 on GitHub · 2026-11-27 00:27 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).WaveSize(64)whends_swizzleand 32-lane DPP ops are wave-invariant lets those shaders run on 32-lane hosts (like NVIDIA RTX) without losing correctness.cargo test -p victory-shader --lib emit::lower::tests:: -- --test-threads=1: all passed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 00:45 UTC · original
I tested the Wave64 row-mirror operation from exact head
42cc668in a synthetic 64-thread compute shader and checked all 64 GPU outputs with WARP 1.0.22. Three fresh processes gave the same result.0xC(upper rows)0x5(repeating)The upper-row result depends on wave-wide destination numbering. The repeating-mask case works at 32 but still fails with the attribute omitted, so the default-width check needs a real dispatch. The forced-width controls changed the test shader's attribute only.
The conservative candidate omits the attribute for quad-local swizzles and unmasked quad DPP. It keeps a fixed width for row, bank-masked, broader swizzle and other cross-quad operations. Both row-mask fixtures and the unmasked quad control reached 64/64 in each of three WARP processes. The 13 related tests, lowering checks, strict clippy in both configurations and asset policy passed.
@danielibabet can you check the quad-local path on the RTX 4070? The forced-32 control is also a way to check any wider policy for repeating masks. Please retain the Git author when picking the commit or add
Co-authored-by: andrewpozdnakov7-jpgif folding it.@danielibabet on GitHub · 2026-11-27 00:47 UTC · original
@andrewpozdnakov7-jpg Great catch — thank you for testing the
ow_mask/\ank_mask\ edge cases on WARP! I've fast-forwarded \pr/wave-invariant-swizzle-dpp\ to your conservative commit \
2bed12e\ (retaining your Git authorship) so only quad-local swizzles and unmasked quad DPP omit \WaveSize(64).Verified on RTX 4070 (Windows 11):
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 00:56 UTC · original
Thanks for taking
2bed12e. The row-mask test in the report explicitly selects WARP. I added a test-only follow-up that also probes the native adapter whenVICTORY_WARPis unset or 0. It dispatches the three relaxed paths, unmasked quad DPP, quad swizzle, and bit-mode swizzle within a quad. Each must return all 64 expected words.WARP passed all three vectors in three fresh processes. My native adapter could not create the SM 6.6 device, so that part was skipped. The seven cross-lane tests, strict clippy in both configurations, and asset policy passed. On the 4070,
cargo test -p victory-shader --lib wave64_quad_swizzle_and_dpp_run_on_supported_adapters -- --nocapture --test-threads=1should identify the native adapter and show all three results. If you pick up the test, please retain the Git author or addCo-authored-by: andrewpozdnakov7-jpg.@fuzeofficlal on GitHub · 2026-11-27 01:11 UTC · original · requested changes
Good direction on dropping
WaveSize(64)for genuinely quad-local cross-lane ops, andcrosslane_tests(6/6 on RTX 5090 and WARP) +wave64_*unit tests (4/4) pass. However, probing additional compute cases on RTX 5090 and WARP turned up several correctness issues that block merging as-is:2D/3D compute thread groups break quad lane pairing when
WaveSizeand lane relabeling are omitted (lower.rs:584,:2946)[8, 2, 1]workgroup follow 2D quad tiling rather than flat linearthread_id.x, so omittingconsole_lanescauseslane ^ 2to read thread8instead of thread2(reproduced 16/16 wrong outputs for both QDModeds_swizzleand DPPquad_permon RTX 5090 and WARP). Either restrict this relaxation to 1D groups (cs.threads[1] == 1 && cs.threads[2] == 1) or preserve lane relabeling.v_readfirstlane_b32is missing from theconsole_lanesscan (lower.rs:591,:6719)ds_swizzle_b32/dppinstruction keptWaveSize(64)viaconsole_laneswhen paired with a non-waterfallv_readfirstlane_b32. Now a 64-thread shader combining a quad swizzle/DPP withv_readfirstlane_b32dropsWaveSize(64), producing divergent values across the upper 32 lanes on RTX 5090 and 60/64 lanes on 4-lane WARP.quad_swizzle(lower.rs:414-417) treats RDNA2 Rotate (0xC000..=0xDFFF) and FFT (0xE000..=0xFFFF) encodings as QDModeoffset & 0x8000 != 0instead ofoffset & 0xC000 == 0x8000omitsWaveSize(64)for Rotate/FFTds_swizzle_b32modes (matching the existingoffset & 0x8000 != 0check atlower.rs:3235). On both RTX 5090 and 4-lane WARP,0xC020(rotate) produced 64/64 wrong outputs,0xE000(FFT) 60/64 wrong outputs, and0xE01F(FFT identity) 64/64 wrong outputs. (Note: the bitmask checkoffset & 0x1C == 0x1C && offset & 0x380 == 0 && offset >> 10 & 0x1F < 4is exact across all 32,768 encodings.)fi = 1onquad_permDPP (lower.rs:402,:5955)wave_invariant_dppallowsfi = true, wherelower.rs:5955skipssrc_lane_active; under a real divergent branch,WaveReadLaneAton an inactive source lane is undefined and yielded0in 8/32 lanes on RTX 5090 instead of preserving the old VGPR value.Formatting &
lower.rsfile size (524,256/524,288B)rustfmt --edition 2024 --checkfails atlower.rs:412(quad_swizzle) andcrosslane_tests.rs:1085(:1088), andlower.rsis only 32 bytes below the 512 KiB policy limit.@andrewpozdnakov7-jpg on GitHub · 2026-11-27 06:56 UTC · original
@danielibabet I put a follow-up directly on
2bed12ein c2698c3. The relaxation is now limited to 1D quad operations without a whole-wave first-lane dependency or DPP fetch-inactive. Compute quad FI still ignores guest EXEC, and now checks that the source is physically live before issuing a host wave read. Rotate and FFT swizzles with a live result are reported as unsupported instead of being lowered as quad swizzles.On the original head, the first-lane case disagreed in 60/64 words and branch FI overwrote 16 destinations. With the patch both tests passed on app-local WARP. Nine lowering tests passed, including the 2D/3D fixed-wave guards and the Rotate/FFT cases. Both strict shader Clippy builds passed. The nested DPP16 case also fails on the original head in the WARP comparison.
The
[8,2,1]runtime probe still did not give the expected results on my WARP configuration with fixed-wave lowering. Please retest multidimensional readback on an adapter supporting the fixed wave. The portable test here verifies retention of the original lane policy for those shaders.If you take the patch, please retain Git authorship when cherry-picking or rebasing. If folded into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic shaders only.
@danielibabet on GitHub · 2026-11-27 08:30 UTC · original
@andrewpozdnakov7-jpg Thanks for tightening this in \
c2698c3! I've fast-forwarded \pr/wave-invariant-swizzle-dpp\ to \c2698c3\ (retaining your Git authorship).Verified on Windows 11 / RTX 4070:
@kalberts0089-hash on GitHub · 2026-11-27 09:09 UTC · original
NVIDIA test report: RTX 4070 Ti (desktop, driver 621.01), Windows 11 Pro, rustc 1.98.1. Head
c2698c3(base main63bcca4), with the test-only follow-up2dc86b8applied on top locally (cherry-picked without committing; it applies cleanly), run on the native adapter (VICTORY_WARPunset).cargo test -p victory-shader --lib wave64_quad_swizzle_and_dpp_run_on_supported_adapters -- --exact --nocapture --test-threads=1: passed 3/3. The native adapter reportsNVIDIA GeForce RTX 4070 Ti | SM=0x68 | Wave=32-32; Wave64 guest DPP, DS quad and DS bit each matched all 64 outputs, and WARP matched all 64 too. So the quad-local pathsc2698c3still relaxes run correctly on a 32-lane card withWaveSize(64)omitted.cargo test -p victory-shader --lib --no-fail-fast, skippingheap_direct_texture_reads_mark_their_heap_index(crashes on NVIDIA, #2571): 311 passed, 3 failed, 3 ignored (main: 298 / 3 / 3). All 13 new tests pass (the 9lower::wave_tests, the 2 new crosslane tests, the row-mask test and the follow-up's test). The 3 failures are the known NVIDIA ones (a_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,gathers_at_a_level_match_the_hardware), with the same messages as on main; unrelated to this PR.fi = 1) quad DPP: exercised on the hardware.dpp_quad_fi_preserves_the_destination_when_a_host_lane_is_absentruns on the 4070 Ti and passes.v_readfirstlane_b32, Rotate/FFT swizzles: the code now keeps the fixed wave size for each (and refuses a live Rotate/FFT swizzle), and the new lowering tests for them pass, but nothing here checks them at runtime.wave64_first_lane_with_quad_swizzle_is_uniform_on_warpskips on this machine ("WARP has no 64-lane waves"), and there's no[8, 2, 1]readback in the PR.lower.rsis now 522,447 B, and the PR adds no new rustfmt diffs there.crosslane_tests.rs:1085still failsrustfmt --edition 2024 --checkatc2698c3;2dc86b8happens to rewrite those lines.Synthetic tests only, no game files. AI-assisted (Claude Code).
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 09:20 UTC · original
Thanks @kalberts0089-hash. Your RTX 4070 Ti readbacks confirm all 64 outputs for each of the three relaxed quad paths. @danielibabet I put that same test-only change directly on the current
c2698c3head in 3bb15a3.The nine cross-lane tests passed locally with WARP 1.0.22. Each relaxed path matched 64/64. This WARP setup also ran the fixed-wave quad-plus-first-lane test and matched all 64 outputs. The fixed-wave multidimensional case still needs a runtime readback. Strict all-features shader Clippy and the asset policy check passed.
Please keep Git authorship if taking the test. If you fold it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic shaders only.
@danielibabet on GitHub · 2026-11-27 09:40 UTC · original
@andrewpozdnakov7-jpg I tried to fetch/apply \3bb15a3\ (\3bb15a3976d21bea667836d4c161e350943d4c161e), and GitHub returned \Not Found\ on the commit/patch URL. Could you push it to a branch on your fork or re-check the SHA so I can fast-forward \pr/wave-invariant-swizzle-dpp?
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 09:42 UTC · original
@danielibabet I reopened the published branch and commit. The full SHA is
3bb15a3976d21bea667836d4c161e350943d8464, withc2698c3as its parent. Onpr/wave-invariant-swizzle-dppyou can use:@ColorMeBoom on GitHub · 2026-11-27 13:15 UTC · original
AMD run: RX 5700 XT (RDNA1; the driver reports 32–64 lanes, so it may pick either; no mesh shaders), driver 32.0.21045.29003, Windows 11 26200, Rust 1.98.1. The PR head was merged onto
main63bcca4, tests ran on the native adapter (VICTORY_WARPunset), no game files. I tested @andrewpozdnakov7-jpg's3bb15a3(test-only, on top of headc2698c3; it only changescrosslane_tests.rs), because its native-adapter test is the one that dispatches on hardware.wave64_quad_swizzle_and_dpp_run_on_supported_adapters, native adapterAMD Radeon RX 5700 XT | SM=0x68 | Wave=32-64: Wave64 guest DPP, DS quad and DS bit each matched all 64 outputs. The WARP half matched too.crosslane_tests: 9 passed, 0 failed. The DPP16 (18), DPP8/DPP8FI (5), DPP FI (1) andds_swizzle_b32(6) hardware cases all passed, with none skipped. The two*_on_warprow-mask tests skipped with "WARP has no 64-lane waves" on the WARP this suite loads.wave_tests: 9 passed, 0 failed. Fullvictory-shadersuite: 315 passed, 0 failed, 3 ignored.AI use: Claude Code (Claude Opus 5.5).
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.