Repository navigation
Conversation
fuzeofficlal
left a comment
There was a problem hiding this comment.
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.- Full
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_mask on a DPP quad_perm (ctrl: 0..=0xFF) bypasses the cross-half refusal
In dpp():
let quad = matches!(dpp, Dpp::Row { ctrl: 0..=0xFF, .. });
let reach = match dpp {
Dpp::Lanes { .. } => 8,
Dpp::Row { row_mask, .. } if row_mask & 3 == row_mask >> 2 => 16,
Dpp::Row { .. } => self.wave(),
};
...
self.cross_lanes_within(quad, reach)?;And in cross_lanes_within():
if !quad && self.host_wave() < lanes.min(self.wave()) {
return Err("a cross-half operation on a 32-lane host");
}When a wave64 compute shader uses a DPP quad permutation (ctrl: 0..=0xFF) with an asymmetric row_mask (e.g., row_mask = 0x1 or 0x4), reach is 64, but quad is true, so !quad && skips the cross-half check. On a 32-lane host, lane_index() (waveGetLaneIndex) is 0..31 in both halves, so ri = (lane >> 4) & 3 evaluates to {0, 1} in both halves — silently writing to row 2 (lanes 32-47) under row_mask = 0x1, or disabling writes for all 64 lanes under row_mask = 0x4.
Checking all cross_lanes_within call sites, every truly quad-local op already passes lanes <= 32 (ds_swizzle_b32 passes 32, symmetric Dpp::Row passes 16), so dropping !quad && from the condition (if self.host_wave() < lanes.min(self.wave())) fixes this cleanly without affecting valid quad operations. Adding a quad_perm + row_mask = 0x1 case to wave64_dpp_row_is_refused_on_wave32_host_only_with_a_mask_naming_one_half would lock it down.
(Optional non-blocking note: all 6 hardware cases in half_local_cross_lane_ops_of_wave64_match_rdna2_on_a_wave32_host run with all 64 lanes active and fi = true. Code inspection confirms src_lane_active / ds_bpermute_b32 work with waveGetLaneIndex() (0..31) + waveActiveBallot lo, and adding one divergent-EXEC / fi = false case would cover that path on 32-lane hardware too.)
Dukestar69
left a comment
There was a problem hiding this comment.
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).
|
Ran the half-local cross-lane tests at 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 The GPU test reports 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 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. |
…osts On a host of 32-lane waves (Marvisak#2176) every cross-lane operation that is not quad-local was refused as "a cross-half operation", but DPP rows (16 lanes), DPP8 (8 lanes), ds_swizzle_b32 in its group-of-32 mode and ds_bpermute_b32 (each 32-lane half on its own, RDNA2 ISA 10.4.4) only read lanes of their own half, which one host wave holds whole (FIND-7 in Marvisak#1633). cross_lane now takes how far an operation reaches. A DPP row write mask numbers the wave's four rows, so a row operation stays in its half only when the mask has the same bits for both halves (0xF, 0x5, 0xA, 0x0). Offline `translate --list` of the title's shader pack as a 32-lane host: "a cross-half operation on a 32-lane host" 69 -> 51 programs; compute programs emitted 2291 -> 2309 (the 2D and array mip-chain programs of levels 2-3, a cascade-shadow min/max and a trail-map mip program). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6f8cb55 to
be8c887
Compare
|
@fuzeofficlal thanks, right: a
AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and drafted this reply. |
|
Re-ran the half-local cross-lane tests at 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 The test now reports eight Not tested: the full 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. |
|
Automated triage for the maintainers. Needs work: stacked on #2176. The top commit CI: Generated by Claude Code |
…ata reads & #2142 fma_mix literal - Port ubiquitarianism/leonida#2142 (SHADER-FMA-MIX-TEXT-CUT-LITERAL, GPL-3.0): restore_text_cut_mix_literal recovers full 32-bit v_fma_mix* literals from printed encodings when llvm-mc 21.1.8 truncates text literals to 16 bits on clean and re-anchored listings. - Port ubiquitarianism/leonida#1397 (mask-regs-data-read, GPL-3.0): VALU data reads of exec_lo/exec_hi/vcc/vcc_lo/vcc_hi and mask-tracked SGPRs materialize the wave's 32-bit mask word (src_u/lane_mask_word), keep word readers out of lane-local runs and wave64-emulate folds, and fix v_readfirstlane_b32 / mask_src extraction on mask-holding VGPRs (_vgpr_mask_lane_bit). - Port PastiiJay/klbf-lab#50 (GPL-3.0) static Wave32 LDS alias & hazard proof (Refinement A disjoint constant byte ranges + Refinement B injective per-lane private slots with adversarial hardening) into tools/wave64_emulate_opt.py, enabling multi-op/cyclic LDS inline EXECZ folding and sync-free multi-wave inlining under --wave64-emulate (suppressing redundant intra-region LDS x_order_barrier splits). - Add opt-in --wave64-promote-wave32 compute promotion (can_promote_wave64_cs_to_wave32) combining FIND-7 half-local ops (Marvisak/VIctory#3115, GPL-3.0), static Wave32 LDS hazard proof (klbf-lab#50, GPL-3.0), and strict refusal of wave-wide counts/sums used as data (Rubenpannen/VIctory-RTX5070@b696f73, GPL-3.0). - Add synthetic hand-written tests in tests/semantic/test_wave30_wave32_rules.py (spirv-val + spirv_mini_interp + workgroup interpreter) and update docs/design.md.
fuzeofficlal
left a comment
There was a problem hiding this comment.
Re-reviewed at be8c887c. Dropping !quad && in cross_lanes_within (crates/victory-shader/src/emit/lower.rs:2935) cleanly closes the asymmetric row_mask bypass for quad_perm while keeping symmetric quad_perm (row_mask = 0xF / 0x5 / 0xA, reach = 16) and ds_swizzle_b32 (lanes = 32) accepted — verified all cross_lane / cross_lanes_within call sites in lower.rs. The new quad_perm refusal checks in emit/mod.rs and the two active-mask (even lanes active) wave64-on-wave32 GPU tests in crosslane_tests.rs are 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 ok- RTX 5090 (32-lane):
cargo 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) - WARP (
VICTORY_D3D12_WARP=1):cargo test -p victory-shader --lib -- crosslane_tests:: wave64— 14/14 passed - RTX 5090
victory-gpu:shader_cache::4/4 passed,host::tests::12/12 passed
LGTM.
…IRE_LEAN, lock-free compiler VEH, small-mip guard, wide_refresh >=2, shaders Marvisak#3008/Marvisak#3117/Marvisak#3115
…4 count its lanes (VICTORY_HALF_LOCAL=0 goes back)
On a host of 32-lane waves a console wave64 program is run as two host
waves, each one half of a console wave, so DPP rows (16 lanes), DPP8 and
`ds_swizzle_b32` in its group-of-32 mode already run without the halves
meeting (upstream's version of this had to refuse them as cross-half).
Two things were still wrong, found by a test that checks all 64 lanes of
a wave64 program against RDNA2 on the hardware device:
- A DPP row write mask names the four rows of the console wave, but the
host lane only numbers the rows of its half: a mask with different bits
for rows 0-1 and 2-3 (0x3, 0xC) wrote the wrong rows in the upper half
(30 of 64 lanes). The row is now counted from the console lane
(`console_lane_in_wave`) where the host waves are halves.
- `ds_bpermute_b32` in wave64 permutes lanes 0..31 and 32..63 each on
their own (RDNA2 ISA 10.4.4): the address modulo 32 in the lane's own
half. It was refused ("a lane permute across two host waves") on a
32-lane host, and on a 64-lane host it read across the halves (2 of 64
lanes wrong where the address wraps). It is now a read inside the half,
which a host wave of 32 holds whole, and it no longer makes the program
need the halves to exchange.
The saved set has no such program (its bpermutes are in console wave32
programs, its row masks all full), so no translation changes there.
After Marvisak/VIctory#3115 (Creaa), whose cheap part this is; what it
mainly does (let these operations run) this translation already did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stacked 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; GPU+shader: translate wave64 programs for 32-lane host waves when WaveLaneCountMax < 64 #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 Test report: RTX 5070 (Blackwell), Windows 11, 70564ae: 471 passed, 5 failed, 7 ignored (4 from the 1,000,000 view heap cap) #1744). The skipped test kills the process on this card on GPU+shader: translate wave64 programs for 32-lane host waves when WaveLaneCountMax < 64 #2176's base (Shader tests: heap_direct_texture_reads_mark_their_heap_index kills the test process on a real GPU (RTX 5070, main 67e8ae1) #2571, fixed onmainby Shader tests: an empty root-constant list is set as the one constant it declares (#2571) #2596/Shaders: bind a zero dword for empty root-constant slices #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 GPU and shaders: a host that caps its view heaps gets heaps at its ca… #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