shader: intersect v_cndmask_b32 active masks with partial_active on 32-lane hosts #2059
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2059"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by steven-seagull27 on 2026-11-29T08:52:21Z.
Related: Marvisak/VIctory#3750 (Cause 3)
What it changes
On 32-lane hosts, counted wave64 compute shaders (
USER_DISPATCH_THREADS_X) that cannot early-return at entry (because of a group barrier, two-wave exchange, or loop back to entry) keep threads withx >= countalive underLower::partial_active.Previously,
ballotand collapsed whole-wave reductions (Shape::Masked,Shape::Active,Shape::Prefix,active_f64_sum) intersected masks inst.activewithself.partial_active, but direct mask consumers incrates/victory-shader/src/emit/lower.rsdid not:v_cndmask_b32v_add_co_ci_u32/v_sub_co_ci_u32/v_subrev_co_ci_u32(carry-in)v_div_fmas_f32(VCC)lane_heap_index(Source::Lanes)When a counted wave64 compute shader saved
EXECwiths_or_saveexec_b64, masked inactive lanes to zero withv_cndmask_b32, and ran a cross-lane reduction/DPP prefix sum without collapsing into a single-block whole-wave section,v_cndmask_b32evaluated entryEXECasBool::TRUEin every thread—leaving lanes>= countunzeroed and letting them pollute the cross-lane result.Changes:
Lower::launched_maskincrates/victory-shader/src/emit/lower.rsto intersect trackedst.activelane-mask booleans withself.partial_active, and applied it across all eightst.masks.getconsumers (fixing the four unguarded sites and unifying the four existing sites).cndmask_saved_exec_respects_dispatch_x_partial_activeincrates/victory-shader/src/emit/wave64_tests.rs: a counted 64-thread compute shader that savesEXECvias_or_saveexec_b64, zeroes inactive lanes withv_cndmask_b32, runs a 64-lane DPP +v_readlane_b32prefix sum, and stores(prefix, wave_total)per active lane for counts5,37, and0(all 64 lanes).How it was tested
dxil.dll); synthetic unit test only (no game assets).cndmask_saved_exec_respects_dispatch_x_partial_activefailed on 32-lane hardware atcount = 5, lane = 0withleft: (1, 2080)vsright: (1, 15)(lanes5..63were not zeroed byv_cndmask_b32, so lane 63 summed1..=64 = 2080instead of1..=5 = 15).cndmask_saved_exec_respects_dispatch_x_partial_activepasses DXIL validation on both 64-lane and 32-lane forms and passes D3D12 hardware execution on 32-lane waves for counts5(total15),37(total703), and0(total2080). (WARP skippedWaveSize(32)/WaveSize(64)PSO creation on this host.)cargo testpassed for the crates it touches: yes (cargo test --locked -j 3 -p victory-shader --lib -- wave64_tests --test-threads=1-> 45 passed, 0 failed;cargo clippy --locked -j 3 -p victory-shader --lib --tests-> 0 new warnings;git diff --checkclean).Checked for overlap
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-29T10:30:18Z.
Review: APPROVED
Tested locally merged onto
main(829188e9).crates/victory-shader/src/emit/lower.rsandwave64_tests.rs.cargo test -p victory-shader --lib emit::wave64_tests::passed (45 passed; 0 failed, including the newcndmask_saved_exec_respects_dispatch_x_partial_activeGPU execution test) with 0 new warnings.Solid Wave32
v_cndmask_b32active-mask intersection fix for partial-active dispatches. LGTM.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T13:05:16Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs, on top of829188e9plus a couple of local fixes). Read the full diff first: no network, process spawning, binaries, build/CI/dependency changes or game data. Builds with--profile diag --features diagnostics; clean cherry-pick; the targeted shader tests pass. In-game runs on an RTX 4090 (wave32 host) are queued; results will follow here.