Shaders: seed POPS collision id with wave_id != collision_id #2393
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2395"
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 VastyViz on 2026-11-25T12:40:31Z.
The title's pixel ordered-section (POPS) wait loop computes:
label_wait:
s0 = src_pops_exiting_wave_id + s4
s_cmp_lt_u32 s5, s0
s_cbranch_scc0 label_wait
Seeding the POPS hardware SGPR with 0 gives wave_id == collision_id == 0, making s5 = 0 + ~0 = 0xffff_ffff so s5 <u s0 can never hold for any u32 exiting wave id. While active lanes skip the loop on overlap == 0, any inactive lane (where EXEC is clear at s_cbranch_vccnz) falls through and spins to LOOP_LIMIT (1 << 20 iterations).
Seeding 1 << 16 (overlap = 0, wave_id = 1, collision_id = 0) satisfies the hardware invariant wave_id != collision_id so s5 = 0 and s0 = 0xffff_ffff with src_pops_exiting_wave_id = 0, exiting immediately on the first check.
Add a WARP draw test reproducing the 1 << 20 spin and verifying it drops to a single pass.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T13:19:16Z.
Review: APPROVED
Tested locally: merged into main
940d32f69b,cargo test -p victory-shader --lockedon macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — POPS collision id seeded with wave_id != collision wave.Imported from Marvisak/VIctory. Originally posted by welisonzika14-jpg on 2026-11-25T13:08:01Z.
First run on NVIDIA hardware here, as far as I can see. RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head
0b239a7merged ontomain940d32f,cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.The PR's new test(s) pass on this card:
emit::synthetic_tests::pops_wait_loop_exits_immediately_for_inactive_lanes. The rest is the same asmainon this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests invictory-gpu, 3 invictory-shader), nothing new.One run, unit tests only, title not run.
Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:02:23Z.
Automated triage for the maintainers.
Merge candidate. In
Lower(crates/victory-shader/src/emit/lower.rs, hardware SGPR inputs), the POPS collision-id SGPR is now seeded as1 << 16(no overlap, wave id 1, collision id 0) instead of 0, while the exiting wave id stays 0. The evidence is the title's own wait loop quoted in the description. I worked it through: with 0,s5 = 0 + ~0 = 0xFFFF_FFFFands_cmp_lt_u32 s5, s0can never hold, so a wave reaching the wait spins to the loop limit. With1 << 16,s5 = 0ands0 = 0 + ~0, so it exits on the first test. Ordering still comes from the host's rasterizer-ordered views, as before. The draw test reproduces the spin onmainand passes here.CI:
checkpassing. A contributor reports the new test passing on an RTX 5070.Generated by Claude Code