Tests: the warp budget test accepts either group winning the budget race #847

Open
github-bot wants to merge 1 commit from github-bot/gh-847 into main AGit
Owner

@⁠Roy-0406 on GitHub · 2026-11-25 10:29 UTC · original
Roy-0406:fix/warp-budget-group-race → main · +10 −6 · 1 files · 1 commits · open

indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields fails intermittently.

Cause. The test clamps 128 records, two groups of 64. The clamp shader charges records in lane order within a group, but the two groups race for the budget word with a compare and swap (indirect.rs, the while (before < BUDGET) loop). Whichever group charges first keeps its first two real draws: records 1 and 2, or 64 and 65. The test required 1 and 2.

Measured on WARP (RTX 4070 machine, single test thread): the old test failed in 8 of 10 runs on its own; with a temporary log of the kept record, every failure kept record 64. In the full suite it passed more often, which is why it slips through.

Change. The test accepts [1, 2] or [64, 65] and names the records kept when it fails. Everything else it checks is unchanged: the budget saturates without wrapping, the source is untouched, every other draw is emptied, and the remaining fields of every record are kept. The shader is not touched.

Proof. The fixed test passes 20 of 20 runs alone; cargo test -p victory-gpu --lib passes 3 of 3 (159 passed); cargo xtask policy --staged ok.

Note on CI. Both clippy jobs already fail on main without this change (placed_filler_twins never used, sort_unstable_by_key in draw.rs, depth_written never read); #841 fixes those.

Not in this PR, seen while testing: watch::tests::a_write_is_reported_at_every_checked_view failed once in 10 parallel runs of the GPU tests (0 of 15 serial), and one parallel run of the GPU test binary ended in 0xc0000005 (not reproduced in 10 more runs).

🤖 Generated with Claude Code

**@⁠Roy-0406** on GitHub · 2026-11-25 10:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/847) `Roy-0406:fix/warp-budget-group-race` → `main` · +10 −6 · 1 files · 1 commits · open `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` fails intermittently. **Cause.** The test clamps 128 records, two groups of 64. The clamp shader charges records in lane order *within* a group, but the two groups race for the budget word with a compare and swap (`indirect.rs`, the `while (before < BUDGET)` loop). Whichever group charges first keeps its first two real draws: records 1 and 2, or 64 and 65. The test required 1 and 2. **Measured** on WARP (RTX 4070 machine, single test thread): the old test failed in 8 of 10 runs on its own; with a temporary log of the kept record, every failure kept record 64. In the full suite it passed more often, which is why it slips through. **Change.** The test accepts `[1, 2]` or `[64, 65]` and names the records kept when it fails. Everything else it checks is unchanged: the budget saturates without wrapping, the source is untouched, every other draw is emptied, and the remaining fields of every record are kept. The shader is not touched. **Proof.** The fixed test passes 20 of 20 runs alone; `cargo test -p victory-gpu --lib` passes 3 of 3 (159 passed); `cargo xtask policy --staged` ok. **Note on CI.** Both clippy jobs already fail on `main` without this change (`placed_filler_twins` never used, `sort_unstable_by_key` in `draw.rs`, `depth_written` never read); #841 fixes those. **Not in this PR**, seen while testing: `watch::tests::a_write_is_reported_at_every_checked_view` failed once in 10 parallel runs of the GPU tests (0 of 15 serial), and one parallel run of the GPU test binary ended in `0xc0000005` (not reproduced in 10 more runs). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
warp_budget_saturates_without_wraparound_and_preserves_draw_fields clamps
128 records, two groups of 64. The clamp charges records in lane order
within a group, but the two groups race for the budget word with a compare
and swap, so whichever group charges first keeps its first two real draws:
1 and 2, or 64 and 65. The test required 1 and 2 and failed in 8 of 10
runs on its own here (WARP, single test thread); the group that won was
group 1 every time it failed.

The test now accepts either pair and names the records kept when it fails.
Everything else it checks is unchanged: the budget saturates without
wrapping, the source is untouched, every other draw is emptied and the
remaining fields of every record are kept. 20 of 20 runs pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:52:29 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 12:23 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head 520179a into main f85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins, depth_written, a sort; PR #841 fixes them), also with --all-features; this PR adds none. cargo test --workspace --locked: run 1: 555 passed, 0 failed, 11 ignored; run 2: 555 passed, 0 failed, 11 ignored (main alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 12:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/847#issuecomment-7162309847) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `520179a` into `main` `f85101b` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails with exactly the errors `main` itself has on this machine (`placed_filler_twins`, `depth_written`, a sort; PR #841 fixes them), also with `--all-features`; this PR adds none. `cargo test --workspace --locked`: run 1: 555 passed, 0 failed, 11 ignored; run 2: 555 passed, 0 failed, 11 ignored (`main` alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠HailLucifer666 on GitHub · 2026-11-25 14:05 UTC · original

Evidence from a fourth machine (Windows, WARP, this repo's own suite), and one thing your two PRs between them have established that neither body says: this is a regression, not a missing nicety.

main already had an order-independent version of this test — (kept, zeroed) == (2, 126), naming no indices — from 578d459c. f85101b6 (Frame rate, second night) changed that block back to assert!(i == 1 || i == 2, ...), so every branch built on it inherits the failure.

Measured: full suite, four processes at a time, twelve runs on f85101b6 without the patch — 2 of 12 failed with panicked at indirect.rs:1611: the first two real draws fit the budget. With the patch applied, 0 of 12. Idle and serial runs never reproduce it (34 runs clean), which is why it looked machine-specific.

I have opened #970 taking MamaLeVrai's #849 verbatim so the branches under review have it; if #847 lands instead it is equivalent and #970 can be closed unmerged. Credit for the diagnosis is entirely yours — two people on two machines reaching the same cause is stronger evidence than either measurement alone.

**@⁠HailLucifer666** on GitHub · 2026-11-25 14:05 UTC · [original](https://github.com/fxceless/victory-fork/pull/847#issuecomment-7164734400) Evidence from a fourth machine (Windows, WARP, this repo's own suite), and one thing your two PRs between them have established that neither body says: **this is a regression, not a missing nicety.** `main` already had an order-independent version of this test — `(kept, zeroed) == (2, 126)`, naming no indices — from `578d459c`. `f85101b6` (*Frame rate, second night*) changed that block back to `assert!(i == 1 || i == 2, ...)`, so every branch built on it inherits the failure. Measured: full suite, four processes at a time, twelve runs on `f85101b6` without the patch — 2 of 12 failed with `panicked at indirect.rs:1611: the first two real draws fit the budget`. With the patch applied, 0 of 12. Idle and serial runs never reproduce it (34 runs clean), which is why it looked machine-specific. I have opened #970 taking `MamaLeVrai`'s #849 verbatim so the branches under review have it; if #847 lands instead it is equivalent and #970 can be closed unmerged. Credit for the diagnosis is entirely yours — two people on two machines reaching the same cause is stronger evidence than either measurement alone.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/indirect.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/847/head:github-bot/gh-847'
git switch 'github-bot/gh-847'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-847'
git switch 'github-bot/gh-847'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-847'
git switch 'github-bot/gh-847'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-847'
git switch 'main'
git merge --squash 'github-bot/gh-847'
git switch 'main'
git merge --ff-only 'github-bot/gh-847'
git switch 'main'
git merge 'github-bot/gh-847'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.