Shaders: half-local cross-lane operations run for wave64 on 32-lane hosts (FIND-7) #3115
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!3115
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3115"
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?
@Creaa on GitHub · 2026-11-26 08:38 UTC · original
Creaa:shaders/wave64-half-local-cross-lane→main· +429 −21 · 15 files · 4 commits · openStacked on #2176; only the top commit (
be8c887) belongs here. Claimed as FIND-7 in #1633.On a host of 32-lane waves, #2176 refuses every cross-lane operation that is not quad-local as "a cross-half operation on a 32-lane host". DPP rows (16 lanes), DPP8 (8 lanes),
ds_swizzle_b32in its group-of-32 mode andds_bpermute_b32(each 32-lane half on its own, RDNA2 ISA 10.4.4, as the code's own comment says) only read lanes of their own half, which one host wave holds whole. They now run.What is in it
crates/victory-shader/src/emit/lower.rs:cross_lanegetscross_lanes_within(quad, lanes), the size of the group an operation reads in; refused only when the host wave is smaller than that group, quad operations included (their DPP row mask still numbers the wave's rows; found by @fuzeofficlal in review). Swizzle and bpermute pass 32, DPP8 8, DPP rows 16 when the row write mask has the same bits for both halves (0xF, 0x5, 0xA, 0x0), else the wave: the mask numbers the wave's four rows, and a 32-lane host wave sees only rows 0 and 1 of its half.v_readlane/v_writelane/v_mbcntand other cross-lane paths are unchanged.crates/victory-shader/src/emit/crosslane_tests.rs:half_local_cross_lane_ops_of_wave64_match_rdna2_on_a_wave32_hostruns a wave64 program of 64 threads, translated for a 32-lane host, on a hardware device and checks all 64 lanes against RDNA2 forrow_ror:4,row_mirror,row_share:3, DPP8,ds_swizzle_b32SWAP(16) andds_bpermute_b32, and with only the even lanes active (v_cmpx) forrow_ror:4withfi:0andds_bpermute_b32(inactive sources read 0). The wave32 builder and dispatch were split intoshader_ofanddispatch_lanes::<N>for it; the existing wave32 tests use them unchanged.crates/victory-shader/src/emit/mod.rs:wave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_half:row_shr:1with row masks 0xF and 0x5 emits, 0x1 is refused as cross-half;quad_permwith 0xF emits, with 0x1 is refused.Tested
fb99078.lower.rsreverted both fail with "a cross-half operation on a 32-lane host". The existing cross-lane GPU tests (DPP16 18, DPP8 5, swizzle 6 cases) pass.cargo test -q --locked -p victory-shader --lib -- --skip heap_direct_texture_reads_mark_their_heap_index: 302 passed, 3 failed, 3 ignored; #2176 alone: 300 passed, the same 3 failed (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, the hardware failures of #1744). The skipped test kills the process on this card on #2176's base (#2571, fixed onmainby #2596/#2587).cargo test --workspace --locked --no-fail-fast: the other crates 565 passed, 2 failed (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views: the capped-heap failures #2461 fixes), 7 ignored.cargo clippy --workspace --all-targets --locked -- -D warningsand with--all-features: clean.cargo xtask policy: 190 files ok.victory translate --listof the title's shader pack withhost_wave32on (a one-line local change to the translate command to pass it, not in this PR): "a cross-half operation on a 32-lane host" 69 -> 51 programs; compute emitted 2291 -> 2309. The 18: the 2D and array mip-chain programs of levels 2-3 (16), a cascade-shadow min/max and a trail-map mip program.VICTORY_SKIP_PIPELINES), with and without this commit: programs refused as cross-half while playing 28 -> 23, no new refusals, no errors and no device removal in either run; frame rate the same (median about 1.3-1.4 fps there).Not tested
v_readlaneof another half and the like); not changed here.AI use
🤖 Generated with Claude Code
@fuzeofficlal on GitHub · 2026-11-26 08:51 UTC · original · requested changes
Verified on a 32-lane NVIDIA GPU (RTX 5090, Windows 11):
emit::crosslane_tests::half_local_cross_lane_ops_of_wave64_match_rdna2_on_a_wave32_host: all 6 cases (dpp16 row_ror:4,row_mirror,row_share:3,dpp8,ds_swizzle_b32 bitmode SWAP(16),ds_bpermute_b32) passed on hardware.emit::crosslane_tests::(6/6), the three wave32-host refusal tests, andvictory-gpushader_cache::(4/4) all passed;cargo clippy -p victory-shader -p victory-gpu -p victory --all-targets -- -D warnings(default and--all-features) andcargo xtask policyare clean.One correctness edge case in
crates/victory-shader/src/emit/lower.rs:Asymmetric
row_maskon a DPPquad_perm(ctrl: 0..=0xFF) bypasses the cross-half refusalIn
dpp():And in
cross_lanes_within():When a wave64 compute shader uses a DPP quad permutation (
ctrl: 0..=0xFF) with an asymmetricrow_mask(e.g.,row_mask = 0x1or0x4),reachis64, butquadistrue, so!quad &&skips the cross-half check. On a 32-lane host,lane_index()(waveGetLaneIndex) is0..31in both halves, sori = (lane >> 4) & 3evaluates to{0, 1}in both halves — silently writing to row 2 (lanes 32-47) underrow_mask = 0x1, or disabling writes for all 64 lanes underrow_mask = 0x4.Checking all
cross_lanes_withincall sites, every truly quad-local op already passeslanes <= 32(ds_swizzle_b32passes32, symmetricDpp::Rowpasses16), so dropping!quad &&from the condition (if self.host_wave() < lanes.min(self.wave())) fixes this cleanly without affecting valid quad operations. Adding aquad_perm+row_mask = 0x1case towave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_halfwould lock it down.(Optional non-blocking note: all 6 hardware cases in
half_local_cross_lane_ops_of_wave64_match_rdna2_on_a_wave32_hostrun with all 64 lanes active andfi = true. Code inspection confirmssrc_lane_active/ds_bpermute_b32work withwaveGetLaneIndex()(0..31) +waveActiveBallotlo, and adding one divergent-EXEC/fi = falsecase would cover that path on 32-lane hardware too.)@Dukestar69 on GitHub · 2026-11-26 08:51 UTC · original · approved these changes
Verified on RTX 5090 (native wave32 host) & WARP against
origin/main(63bcca4):cargo test -p victory-shader --lib emit::crosslane_tests:: -- --test-threads=1: 6/6 passed on RTX 5090 and WARP (includinghalf_local_cross_lane_ops_of_wave64_match_rdna2_on_a_wave32_host).cargo test -p victory-gpu --lib shader_cache:: -- --test-threads=1: 4/4 passed.cargo clippy -p victory-shader -p victory-gpu -p victory --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Great NVIDIA/wave32 win: cleanly enables half-local cross-lane wave64 operations on 32-lane hosts and keys the shader cache accordingly.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Aniseto on GitHub · 2026-11-26 08:58 UTC · original
Ran the half-local cross-lane tests at
6f8cb55:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by
rust-toolchain.toml), MSVC 14.44.35207, debug build. Nodxil.dllon this host, so the test reports validation as skipped; the GPU comparisons still ran.The GPU test reports
[PASS]for all six forms: DPP16row_ror:4,row_mirror,row_share:3, DPP8,ds_swizzle_b32SWAP(16) andds_bpermute_b32within the half, with all 64 logical lanes matching RDNA2. The negative testwave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_halfalso passes (1/1).What this adds: the author measured on an RTX 4070 12 GB (Ada). This is a Blackwell wave32 part, exercising exactly the host configuration the PR targets, and the thread has no report from another machine.
Not tested: the full
victory-shadersuite, DXIL validation (nodxil.dll), a title run, AMD and Intel GPUs, WARP, release profile.AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
6f8cb55d0dtobe8c887c50@Creaa on GitHub · 2026-11-26 09:07 UTC · original
@fuzeofficlal thanks, right: a
quad_permwith a row mask naming one half skipped the check, since the condition only applied to non-quad operations. Fixed inbe8c887(squashed into the PR's commit) as you suggested:cross_lanes_withinnow refuses whenever the host wave is smaller than the reach the caller gives, quad operations included; every quad-local caller passes 32 or less, so valid quad operations are unaffected.wave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_halfnow also checksquad_permwith row masks 0xF (emits) and 0x1 (refused); with the old condition the 0x1 case emits and the test fails.v_cmpx),row_ror:4withfi:0andds_bpermute_b32(odd, inactive sources read 0). All 8 cases pass on an RTX 4070.victory-shaderlib: 302 passed, the same 3 hardware failures as #2176 alone; clippy (default and--all-features) clean; policy ok. The offline count is unchanged (51 programs still refused as cross-half).AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and drafted this reply.
@Aniseto on GitHub · 2026-11-26 09:13 UTC · original
Re-ran the half-local cross-lane tests at
be8c887after the head moved (66 lines added to the cross-lane test, plus changes inlower.rsandemit/mod.rs).Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned), MSVC 14.44.35207, debug build. No
dxil.dllhere, so validation is skipped; the GPU comparisons ran.The test now reports eight
[PASS]cases: DPP16row_ror:4,row_mirror,row_share:3, DPP8,ds_swizzle_b32SWAP(16),ds_bpermute_b32within the half, plus the newdpp16 row_ror:4 fi:0, even lanes activeandds_bpermute_b32 lane + 1, even lanes active (odd sources read 0). The negative testwave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_halfalso passes (1/1). This is a new report following mine at6f8cb55, not an edit.Not tested: the full
victory-shadersuite, DXIL validation, a title run, AMD and Intel GPUs, WARP, release profile.AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
@Marvisak on GitHub · 2026-11-26 09:18 UTC · original
Automated triage for the maintainers.
Needs work: stacked on #2176. The top commit
be8c887looks right.Lower::cross_lanes_within(crates/victory-shader/src/emit/lower.rs) gives each operation the size of the group it reads: 32 fords_swizzle_b32/ds_bpermute_b32, 8 for DPP8, 16 for DPP rows. None of the accepted DPP row controls (0x101–0x12F, 0x140/0x141, 0x150–0x16F) or swizzle modes reaches outside its row or 32-lane half. Refusing row masks that differ between the halves is the right conservative choice, andwave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_halfcovers it. The blocker is that the branch also carries #2176's three commits (host_wave32,emit::Options, the shader_cache and host changes), and none of them is inmain. Once #2176 lands, please rebase so that only this commit's changes tolower.rs,crosslane_tests.rsandemit/mod.rsremain. It can be reconsidered then.CI:
checkpassing.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 09:39 UTC · original · approved these changes
Re-reviewed at
be8c887c. Dropping!quad &&incross_lanes_within(crates/victory-shader/src/emit/lower.rs:2935) cleanly closes the asymmetricrow_maskbypass forquad_permwhile keeping symmetricquad_perm(row_mask = 0xF / 0x5 / 0xA,reach = 16) andds_swizzle_b32(lanes = 32) accepted — verified allcross_lane/cross_lanes_withincall sites inlower.rs. The newquad_permrefusal checks inemit/mod.rsand the two active-mask (even lanes active) wave64-on-wave32 GPU tests incrosslane_tests.rsare great additions.Verified locally on Windows 11 with a 32-lane RTX 5090 and WARP:
cargo clippy --workspace --all-targets -- -D warnings: cleancargo clippy --workspace --all-targets --all-features -- -D warnings: cleancargo xtask policy:190 files okcargo test -p victory-shader --lib -- crosslane_tests:: wave64— 14/14 passed (all 8 wave64-on-wave32 subtests including the neweven lanes activecases, plus 18 DPP16, 5 DPP8, and 6ds_swizzle_b32GPU checks)VICTORY_D3D12_WARP=1):cargo test -p victory-shader --lib -- crosslane_tests:: wave64— 14/14 passedvictory-gpu:shader_cache::4/4 passed,host::tests::12/12 passedLGTM.
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.