shader: lower compute constant lane masks via flat group index without WaveSize(64) #3496
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3496"
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 danielibabet on 2026-11-27T10:08:39Z.
Compute and mesh shaders that branch on or select with a constant 64-bit lane mask (\Atom::Constant) or an inline constant mask in \_cndmask_b32\ previously forced \WaveSize(64), causing Wave32-only GPUs (NVIDIA RTX / Intel Arc) to reject the pipeline with \E_INVALIDARG.
Because console compute/mesh waves are consecutive runs of \wave\ flat group threads, a constant mask only depends on \lattenedThreadIdInGroup & (wave - 1)\ and does not need \WaveSize(64)\ or \dx.op.waveGetLaneIndex.
What changes
Tests
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T10:20:04Z.
Independent Windows CPU verification of PR #3496 (head
836fb58f5e436573b04995f3e19a2376656c642e, base63bcca43c6a00a758510398fa43096ce7e4f7df0).cargo test --locked -p victory-shader --lib -- emit::lower::const_mask_tests::constant_lane_masks_in_compute_omit_wave_size_and_wave_ops --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 305 filtered, exit 0.git diff --check 63bcca4 HEAD→ clean (exit 0).git grep -F constant_lane_masks_in_compute_omit_wave_size_and_wave_ops 63bcca4 -- crates/victory-shader/src/emit/const_mask_tests.rs→ no hit (exit 1), so the test is new on this PR.Environment: Windows, Rust 1.100.0/MSVC, per-worktree
CARGO_TARGET_DIR,CARGO_BUILD_JOBS=2. Only the named synthetic CPU test was replayed; the GPU/WARP testconstant_lane_masks_2d_wave64_match_console_lanes_on_gpu_and_warpand the full suite were not run here. No game data, assets, extracted shaders or DRM involved. AI-assisted (Hy4 flash). GPU/driver: N/A for this CPU-only test.Imported from Marvisak/VIctory. Originally posted by AurumCarlos on 2026-11-27T10:46:21Z.
Review: COMMENTED
The flat-index lane looks right for compute (console waves are runs of consecutive flat ids). Three points:
v_cndmask_b32half is #2792's change. Thecndmasksselector chain inLower::new(lower.rs:589) is the same hunk as #2792 (legayclightning22), which triage marked merge candidate, so the two will conflict. Dropping it here (or stacking on #2792) would keep this PR to theAtom::Constantpart.& (wave - 1)(flat_console_lane,lower.rs:3042). Both use a single[8, 8, 1]wave64 group, where the flat index already is the console lane, so a version without the mask passes them too. Modelling the GPU test's two masks, dropping the&gives 0/64 wrong lanes for[8, 8, 1]wave64, but 62/128 for[16, 8, 1]wave64 and 4/64 for[8, 8, 1]withwave64: false. One of those shapes would cover it. Also, LLVM's gfx1030 assembler refuses an inline constant as the_e64mask in both wave sizes (and disassembles0x85there as an invalid immediate), so thes[20:21]case is the one to rely on.Imported from Marvisak/VIctory. Originally posted by oddmaniv on 2026-11-27T10:58:14Z.
Independent verification of the PR author's concurrent WARP pipeline/draw test at
836fb58f5e436573b04995f3e19a2376656c642e.cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocaptureMain baseline pin:
63bcca43c6a00a758510398fa43096ce7e4f7df0.Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits.
This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed.
AI-assisted verification.
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-27T13:15:31Z.
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. Head836fb58.const_masktests: 2 passed, 0 failed. That includesconstant_lane_masks_2d_wave64_match_console_lanes_on_gpu_and_warp, which opens the native adapter (Host::new(false)succeeds on this card) and then WARP. Its hardware loop doesn't print, so this is the assertion passing, not a printed readback.victory-shadersuite (--features host): 304 passed, 0 failed, 3 ignored.AI use: Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by danielibabet on 2026-12-01T09:31:00Z.
Thanks @AurumCarlos!
Updated pr/constant-lane-mask:
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.