shader(ir): keep empty-EXEC skip guards around potentially non-terminating loops #255
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/255"
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 Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T12:29:30Z.
Summary
without_skips's stall analysis (crates/victory-shader/src/ir.rs) so empty-EXECskip guards stay in place whenever any reachable path inside the skipped region can cycle without a proven exit.none_leftintoempty_mask(inst, &facts, low)covering bothEXECandVCC, propagate empty results from allv_cmp*instructions whenEXECis empty, and resolves_cbranch_vccz/s_cbranch_vccnzinExit::Branch.seen/chaintrace with a cycle-detecting DFS (visiting/finished) returningtrueon cycle or budget exhaustion so loops spinning on inactive lanes cannot reach the loop watchdog after skip removal.an_empty_wave_keeps_its_skip_around_a_loop_that_can_reach_the_watchdogcovering bothdeep = falseanddeep = true.Verification
cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy->asset policy: 313 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib ir::->13 passed; 0 failed(includes new test)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader->344 passed; 3 failed; 6 ignored(all 3 failures are pre-existing hostdxil.dllPipeline State Validation checks verified failing identically onorigin/main:emit::barycentric_tests::first_half_values_render_on_hardware_and_warp,emit::rect::tests::the_rectangle_stage_is_a_geometry_shader,emit::rect::tests::rectangles_are_drawn_whole)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings-> cleancargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings-> cleanImported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T13:04:27Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
Logic and safety in crates/victory-shader/src/ir.rs look solid, and CI is passing. Because this changes shader IR skip-guard elimination (
without_skips) for shaders containing loops, it warrants a local real-GPU smoke test before merging.What Looks Good
empty_mask): Extendingnone_lefttoempty_mask(inst, &facts, low)cleanly covers bothEXEC(126..=127) andVCC(106..=107), withdwords.peek().is_some()preventing vacuous matches.v_cmp*+s_cbranch_vccz/vccnz): Treating allv_cmp*results as empty whenEXECis empty is sound on GFX10/RDNA (inactive lanes write 0 bits to the destination lane mask), allowingwhile (any_lane)loops (s_cbranch_vccnz) to remain provably terminating whileuntil (any_lane)loops (s_cbranch_vccz) keep their skip guard.visiting/finished): Replacing the decided-only linear chain check with a 3-color iterative DFS correctly catches cycles through undecided scalar/vector branches (such as loops reading inactive lanes viav_readfirstlane_b32) without false positives on DAG diamonds, and safely defaults to keeping the skip guard (return true) on budget exhaustion (20_000states).an_empty_wave_keeps_its_skip_around_a_loop_that_can_reach_the_watchdogexercises all three cases (until_any_lane,from_inactive_lane,while_any_lane) for bothdeep = falseanddeep = true.Suggested Local GPU Smoke Test
VICTORY_WAVE_WHY=1to confirm newly retainedWAVE64-SKIPguards match expected loop regions without unexpected perf regressions.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T15:25:19Z.
Hardware-verified on RTX 4060 Ti 8 GB (Series X 1440p
-PlayParity, warm shader cache, stacked Wave 9:#237, #240, #241, #247, #250, #255onorigin/maincb2e024):victory(37+2) +victory-hle(223) +victory-gpu(625passed,0failed,39ignored) — 0 regressionsverify-wave9-warm):4.9 fps(11463draws,GPU=0.3 ms),VRAM 7159/6873 MB(-136 MBvs Wave 8),final_waiting=15641(-8834vs Wave 8),0crashes/DRED,0failed bakesluma=84.84,near_black=0.0%,magenta=0.0%)Merging onto
main.