shader: guard divergent wave64 loop latches and fence flat UAV barriers #141
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
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
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
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/Androtim--MiniVI!141
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/141/head"
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?
@Androtim on GitHub · 2026-11-29 15:20 UTC · original
Androtim:feat/iter142-shader-wave64-loop-latches-flat-uav-barriers→main· +674 −8 · 4 files · 3 commits · merged 2026-11-29 21:26 UTCPorts two DXIL barrier-correctness fixes in
victory-shader:Unconditional loop-latch region exclusion & looped LDS atomic fencing (
crates/victory-shader/src/emit/lower.rs):b == d) as part of their own divergent region unconditionally inlane_regions_of/branches_around/all_lane_blocks_ofinstead of gating onPAIR_MEETINGS, preventing group-wide barriers inside divergent Wave64 loops where one 32-lane half exits early.lds_no_meeting(unordered | looped) forlds_meetingsand emitsbarrier(8)forself.lds_loopedbefore thelds_meetbranch so looped LDS atomics stay Wave32 without widening.Flat global store/atomic UAV fencing (
crates/victory-shader/src/emit/lower.rs):Fields::Flatglobal_*non-load operations (global_store_*,global_atomic_*) inwrites_uavssos_barrieremitsUAV_FENCE_GLOBAL(mode = 11).Tests (
crates/victory-shader/src/emit/bitcode/census.rs,wave64_tests.rs,intersect_tests.rs):dx.op.barriermodes under#[cfg(test)]incensus::barrier_modes.Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy(304 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader wave64_tests --locked -- --test-threads=1(19 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader intersect_tests --locked -- --test-threads=1(8 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets(--lockedand--features diagnostics --locked,-D warnings)@Androtim on GitHub · 2026-11-29 16:03 UTC · original · edited 2026-11-29 19:03 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic and safety look solid, and CI is passing. Because this PR changes DXIL barrier emission (
dx.op.barrierfence/sync modes) and Wave64-to-Wave32 split-LDS lowering invictory-shader, a local real-GPU test pass is recommended before merging.Verified Changes
crates/victory-shader/src/emit/lower.rs(Lower::new,Lower::inst):writes_uavsnow includesFields::Flatinstructions starting withglobal_and notglobal_load_(global_store_*,global_atomic_*), sos_barrieremitsUAV_FENCE_GLOBAL(mode = 11instead of9) for shaders that only write global memory via flat ops.lds_no_meeting(lds_order.unordered ∪ lds_order.looped) is passed to theldscheck andlds_meetings, andLower::instnow checksself.lds_looped.contains(&(b, i))beforeself.lds_meet.as_ref().is_none_or(|(all, _)| all[b]). This keeps looped LDS atomics in Wave32 with a TGSM-only fence (dx.op.barrier(8)) even in non-all-lane blocks.crates/victory-shader/src/emit/bitcode/census.rs:#[cfg(test)]-onlyBARRIERStracking andbarrier_modes()inspection (no non-test runtime impact).crates/victory-shader/src/emit/intersect_tests.rs&wave64_tests.rs:dxil.dllvalidation, and hardware/WARP dispatch tests for cross-wave flat global stores/atomics (flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves) and 1-/2-block divergent Wave64 loops (one_console_wave_divergent_loop_lds_widens_for_one_and_two_block_loops,one_console_wave_divergent_loop_wave_ops_widen_for_one_and_two_block_loops,divergent_loop_atomics_stay_wave32_with_fence_only).Minor Note
lane_regions_of/branches_around/all_lane_blocks_ofto drop thePAIR_MEETINGSgate onb == d, but those functions are not modified in the current diff (presumably already onorigin/mainor omitted when rebasing). Please update the PR description if that change is already onmain.Local GPU Verification Needed
wave64_testsandintersect_testson a real SM 6.6 GPU (especially NVIDIA Wave32) to confirm hardware execution passes alongside WARP, and do a quick in-game smoke test covering compute/cloud passes with looped LDS atomics and flat global UAV barriers.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 16:41 UTC · original
Automated RTX 4060 Ti 8 GB A/B hardware verification FAILED visual & texture regression checks (bisected across
origin/main17a2f09vsplaytest/wave4vsplaytest/wave4-no141):verify-wave4), character skin/face and neck render severely blown-out white and semi-translucent with background geometry (bookshelf) bleeding through the face (capturedframe-3478.png,frame-3502.png; median luma jumped from39.23baseline to96.88).final_waitingregressed+678(6431vs5753baseline), failing the A/B non-regression gate.playtest/wave4-no141) immediately restored clean solid skin/lighting (frame-3923.png,frame-3955.png) and passed all 5/5 A/B gates (11.9 fpsvs11.2 fpsbaseline,-119 MBVRAM,-42%residency stalls).Please investigate the divergent wave64 loop latch / flat UAV barrier changes in this PR.
@Androtim on GitHub · 2026-11-29 18:38 UTC · original
Rebased onto
origin/main(9d8b3646) and restoredPAIR_MEETINGS.get()gating on the loop-latch region exclusion incrates/victory-shader/src/emit/lower.rs(lane_regions_of/all_lane_blocks_of/branches_aroundand their*_forhelpers), keepingFields::FlatUAV barriers andlds_loopedbarrier(8)while leaving non-PAIR_MEETINGStranslations identical tomain. Also wrapped the two new tests incrates/victory-shader/src/emit/wave64_tests.rsinlower::with_pair_meetings.Verified at
2bf6800d:xtask policy:305 files okcargo test -p victory-shader --locked -- wave64_tests:19 passed; 0 failedcargo test -p victory-shader --locked -- intersect_tests:8 passed; 0 failedcargo clippy --workspace --locked --all-targets -- -D warnings(default features and--all-features): 0 warningscheck):COMPLETED/SUCCESSscripts/verify-world.ps1with--features diagnosticsforVICTORY_CAPTURE): all 6 gates passed — 0 crashes, 0 host texture errors, 0 untranslated shaders,max_draws=11242,world_windows=12, VRAMmax 5709 MB / budget min 6708 MB,pngs=24(lit=15/24, median luma106.45, edge energy7.62, near-black0.03%, magenta0.0%). Visual inspection of captured PNGs confirms solid skin/face shading and lighting without the blown-out translucent visual regression seen when loop-latch exclusion applied unconditionally.@Androtim on GitHub · 2026-11-29 21:26 UTC · original
Automated RTX 4060 Ti 8 GB Open-World A/B hardware verification PASSED (
playtest/wave5vsorigin/mainb1b6dc1,VICTORY_LEVELS_ON_DEMAND=0play-parity):cargo test(RTX 4060 Ti): 645 passed, 0 failed (victory39/39,victory-shaderemit::wave64_tests19/19 &lower19/19,victory-gpu568/568).scripts/verify-world.ps1, DLSS Quality + open-world save):9.4 fpsvs7.5 fps(+1.90 fps / +25%), min8.3 fpsvs0.8 fps, preparing53.6 msvs60.0 ms5760 MBvs6005 MB(-245 MB,0 MBover budget);no room for new oneshalved (9,000vs18,000);max_waitingdropped (36,432vs41,431)0mismatches (other_bytes=0, showed_another_view=0, failed=0vs5and2on baseline)mapped_rate1.63 ms/svs6.9 ms/s(-76%, max12.9vs51.9 ms)frame-5975.png,frame-5983.png),edge_energy=4.69vs3.88,near_black=0.02%,magenta=0.0%(and#1412bf6800showed zero visual artifacts).