Skip to content

Indirect test: the two groups charge the budget in either order (the test failed 5 runs in 6) - #849

Open
MamaLeVrai wants to merge 1 commit into
fxceless:mainfrom
MamaLeVrai:indirect-test-race
Open

MamaLeVrai wants to merge 1 commit into
fxceless:mainfrom
MamaLeVrai:indirect-test-race

Conversation

@MamaLeVrai

Copy link
Copy Markdown

indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields fails most of the time on main (f85101b) on this machine (Windows 11, RX 6950 XT, Rust 1.98.1): 5 of 6 runs of the test alone, and 4 of 15 runs of cargo test -p victory-gpu --lib, with

panicked at crates\victory-gpu\src\indirect.rs:1539:17:
the first two real draws fit the budget

Why. The test has 128 records, two groups of 64. Each group charges the list's budget once, and takes its records in lane order (the comment in the clamp shader says so). Which of the two groups charges first is up to the card, or up to WARP's threads here. If the second group goes first, the draws that fit are records 64 and 65, not 1 and 2, and the test's assert!(i == 1 || i == 2) fails.

The change. The test now collects the kept records and asserts they are [1, 2] or [64, 65] (the first two real draws of the group that charged first), then runs the rest of its checks as before (two kept, the others zeroed, the fields untouched, the budget saturated at 2^27 without wrapping). Only the test changes.

Checks. The test alone, 25 runs with this change: 0 failures (before: 5 of 6 failed). I did not run the whole suite again with this change; it touches the one test. I could not tell which of the two outcomes WARP gives in a run, only that the old assertion fails often.

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

🤖 Generated with Claude Code

warp_budget_saturates_without_wraparound_and_preserves_draw_fields has 128 records, two groups
of 64. Each group charges the list's budget once, taking its records in lane order, but which
group charges first is up to the card (or WARP's threads): the two draws that fit are records
1 and 2 or records 64 and 65. The test asserted records 1 and 2 only, and failed about 5 runs
in 6 on an RX 6950 XT's host.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 10:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@eazyves

eazyves commented Nov 25, 2026

Copy link
Copy Markdown

Confirmed on a Windows 11 / RX 9070 XT machine: the test alone fails 100 of 100 times on main f85101b and passes 100 of 100 times with this PR (8971052, same base).

victory-gpu lib test binary main f85101b this PR
this test alone, 100 runs: failures 100 0
whole binary, default threads, 100 runs: this test failed 60 0

The whole-binary runs also have failures this PR doesn't touch: inplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset in 4 of 100 runs of main and 7 of 100 here, and three watch::tests tests once each in this PR's 100 runs.

Driver 32.0.32029.2010, Ryzen 7 5800X3D, Windows 11 26200, run from a service session. No game data. AI-assisted (Claude Code); run on my machine.

@MamaLeVrai

Copy link
Copy Markdown
Author

Thank you for the 100-run confirmation on a different card and a different Windows build: on my RX 6950 XT the test alone failed 5 of 6 times on main, so the two machines agree that the assertion is what fails.

On the other failures you list: I saw inplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset fail once in two runs of another PR's tree (#520) on my machine too, so it looks like a failure of main and not of a PR. I will look at that one next.

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

@tikD1337

Copy link
Copy Markdown

Reproduced and confirmed on a different machine: Windows 11, NVIDIA RTX 4070 Ti SUPER (driver 621.01), Ryzen 5 7600, Rust 1.98.1.

  • main @ a253706, cargo test --release -p victory-gpu --lib warp_budget_saturates -- --test-threads=1, 10 runs: 4 failed (indirect.rs:1539, "the first two real draws fit the budget").
  • The same command with this PR merged on a253706, 10 runs: 0 failed.
  • cargo test --release -p victory-gpu --lib -- --test-threads=1 with this PR: 169 passed, 0 failed, 5 ignored.

The test runs on WARP, so the GPU should not matter; it fails on this NVIDIA / Ryzen machine too, not only on the RX 6950 XT.

@MamaLeVrai

Copy link
Copy Markdown
Author

Thank you for running it on an NVIDIA / Ryzen machine: 4 of 10 on main and 0 of 10 with this PR agrees with what I saw on the RX 6950 XT, and it fits the test running on WARP.

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

HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
The switch this branch added turned the clamp pass off so `ExecuteIndirect`
could read the title's own argument buffer. `dkdknight` ran it on an RTX
5080, twice, and both runs died with `0xc0000005` writing `0x0` within
seconds. That is the answer the switch deserved: the title's argument
records contain bounds the pass is what enforces, so "read them directly"
is not a fast path, it is a crash with a longer name.

So `0` no longer means "bypass". `clamp_setting` returns `(clamp on, say
so)` and the clamp is on whatever is asked; a run that asked is told once,
with the reason and with what actually answers its complaint. `clamp_is_on`
is consulted where the clamp is first made, so the refusal is spoken even
in a run that never reaches the pass.

That leaves no path for the bypass, so the code is gone rather than
unreachable: the `if !clamped` branch in `draw.rs` and the two `if clamped`
teardowns go with it, and so does `wait_direct`, which existed only to put
a barrier in front of an unclamped execute. Dead code behind a switch that
is now always true is a lie about what the program can do.

The cost the switch was chasing is real -- about five thousand one-record
indirect mesh draws a frame, and SM issue at 4% in `dkdknight`'s Nsight
capture -- and the answer to it is hoisting the clamps out of the
per-record path (`VICTORY_HOIST_CLAMPS`, Phase I), which keeps the bounds
check and stops paying for it once per record.

Probe: `clamp_setting` returns `parse_clamp_enabled(asked)` again -> the new
test fails with `left: (false, true), right: (true, true)` -> restored
byte-identical (sha256 ade38ee886e354e5).

cargo test -p victory-gpu --lib: 161 passed, 1 failed -- the failure is
`warp_budget_saturates...`, the pre-existing flake (fxceless#847/fxceless#849), on a test
this commit does not touch. cargo clippy -p victory-gpu --lib -D warnings:
only the two pre-existing fxceless#841 errors remain.
@HailLucifer666

HailLucifer666 commented Nov 25, 2026 •

Copy link
Copy Markdown

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 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
The switch this branch added turned the clamp pass off so `ExecuteIndirect`
could read the title's own argument buffer. `dkdknight` ran it on an RTX
5080, twice, and both runs died with `0xc0000005` writing `0x0` within
seconds. That is the answer the switch deserved: the title's argument
records contain bounds the pass is what enforces, so "read them directly"
is not a fast path, it is a crash with a longer name.

So `0` no longer means "bypass". `clamp_setting` returns `(clamp on, say
so)` and the clamp is on whatever is asked; a run that asked is told once,
with the reason and with what actually answers its complaint. `clamp_is_on`
is consulted where the clamp is first made, so the refusal is spoken even
in a run that never reaches the pass.

That leaves no path for the bypass, so the code is gone rather than
unreachable: the `if !clamped` branch in `draw.rs` and the two `if clamped`
teardowns go with it, and so does `wait_direct`, which existed only to put
a barrier in front of an unclamped execute. Dead code behind a switch that
is now always true is a lie about what the program can do.

The cost the switch was chasing is real -- about five thousand one-record
indirect mesh draws a frame, and SM issue at 4% in `dkdknight`'s Nsight
capture -- and the answer to it is hoisting the clamps out of the
per-record path (`VICTORY_HOIST_CLAMPS`, Phase I), which keeps the bounds
check and stops paying for it once per record.

Probe: `clamp_setting` returns `parse_clamp_enabled(asked)` again -> the new
test fails with `left: (false, true), right: (true, true)` -> restored
byte-identical (sha256 ade38ee886e354e5).

cargo test -p victory-gpu --lib: 161 passed, 1 failed -- the failure is
`warp_budget_saturates...`, the pre-existing flake (fxceless#847/fxceless#849), on a test
this commit does not touch. cargo clippy -p victory-gpu --lib -D warnings:
only the two pre-existing fxceless#841 errors remain.
akus-elinius pushed a commit to akus-elinius/victory-fork that referenced this pull request Nov 25, 2026
…test failed 5 runs in 6) (fxceless#849)


PR: fxceless#849
Head: 8971052

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants