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

Open
Roy-0406 wants to merge 1 commit from upstream-pr/847 into main
Roy-0406 commented 2026-11-25 10:29:29 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Roy-0406 on 2026-11-25T10:29:29Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6602410713 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/847). Originally posted by [Roy-0406](https://github.com/Roy-0406) on 2026-11-25T10:29:29Z. --- `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)
MamaLeVrai commented 2026-11-25 13:06:01 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T12:23:31Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7162309847 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/847#issuecomment-7162309847). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T12:23:31Z. --- 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.
HailLucifer666 commented 2026-11-25 14:10:53 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HailLucifer666 on 2026-11-25T14:05:11Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7164734400 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/847#issuecomment-7164734400). Originally posted by [HailLucifer666](https://github.com/HailLucifer666) on 2026-11-25T14:05:11Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/847:upstream-pr/847'
git switch 'upstream-pr/847'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/847'
git switch 'upstream-pr/847'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/847'
git switch 'upstream-pr/847'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/847'
git switch 'main'
git merge --squash 'upstream-pr/847'
git switch 'main'
git merge --ff-only 'upstream-pr/847'
git switch 'main'
git merge 'upstream-pr/847'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!846
No description provided.