Warp budget test: accept either group charging first (rebased on main, +12/−1) #969

Closed
HailLucifer666 wants to merge 1 commit from upstream-pr/970 into main
HailLucifer666 commented 2026-11-25 14:05:09 +00:00 (Migrated from github.com)

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


Takes MamaLeVrai's #849 verbatim — same commit, same authorship, no changes. Roy-0406 reached the same cause independently in #847 from a different machine, which is the strongest evidence either of them has.

Now one commit, one file, +12/−1, on top of current main (0b0074e0).

A correction to this PR's own earlier body

I first wrote that main already had an order-independent version of this assertion, from 578d459c. That is wrong and I am retracting it: 578d459c is a commit on our fork's main, not upstream. Upstream main still carries assert!(i == 1 || i == 2, "the first two real draws fit the budget") at indirect.rs:1539, beside the count-based assertion at 1550. The count assertion does not save it — the index assertion still fires. The fix is genuinely needed here.

I also opened this against a branch based on f85101b6, which is seven commits and thirty-four files behind main. It has been rebuilt on 0b0074e0; that is why the diff is now twelve lines.

The mechanism

Two groups of 64 records each charge the list's one budget word with a compare-and-swap, and each group then takes its records in lane order. Which group charges first is the card's decision, so the two draws that fit are records 1 and 2 or records 64 and 65. The old assertion named one of two legal outcomes.

Evidence, and a probe that fails on demand

Two groups of one budget, so both orders are correct and the invariant worth pinning is (kept, zeroed) == (2, 126), which line 1561 already asserts.

On this machine today the second group charges first, consistently. That makes the old assertion fail deterministically rather than intermittently:

  • accept [1, 2] only (the pre-fix shape) → 2 of 3 runs fail, panicked at indirect.rs:1542: the first two real draws of the group that charged first fit the budget, not [64, 65]
  • accept [64, 65] only → passes, because that is the order this machine takes
  • accept both (this patch) → passes; restored byte-identical, sha256 7c2bf779459c22d0

Full suite: 170 passed, 0 failed, 5 ignored.

Earlier measurement on the f85101b6 tree, full suite, four processes at a time: 2 of 12 runs failed without this patch, 0 of 12 with it. Idle and serial runs never reproduced it, which is why it read as a machine-specific flake for days.

Ordering

#169 is built on f85101b6 and carries the same strict assertion, so it should rebase onto main after this lands — otherwise its suite keeps showing a failure unrelated to its change.

Not covered

Native D3D12 — everything above is WARP. And this fixes a test, not the shader: if the budget were ever meant to be spent in a defined order, that would be a different and much larger question.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6606301940 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/970). Originally posted by [HailLucifer666](https://github.com/HailLucifer666) on 2026-11-25T14:05:09Z. --- Takes `MamaLeVrai`'s #849 verbatim — same commit, same authorship, no changes. `Roy-0406` reached the same cause independently in #847 from a different machine, which is the strongest evidence either of them has. Now one commit, one file, `+12/−1`, on top of current `main` (`0b0074e0`). ## A correction to this PR's own earlier body I first wrote that `main` already had an order-independent version of this assertion, from `578d459c`. **That is wrong and I am retracting it**: `578d459c` is a commit on *our fork's* `main`, not upstream. Upstream `main` still carries `assert!(i == 1 || i == 2, "the first two real draws fit the budget")` at `indirect.rs:1539`, beside the count-based assertion at `1550`. The count assertion does not save it — the index assertion still fires. The fix is genuinely needed here. I also opened this against a branch based on `f85101b6`, which is seven commits and thirty-four files behind `main`. It has been rebuilt on `0b0074e0`; that is why the diff is now twelve lines. ## The mechanism Two groups of 64 records each charge the list's one budget word with a compare-and-swap, and each group then takes its records in lane order. Which group charges first is the card's decision, so the two draws that fit are records 1 and 2 **or** records 64 and 65. The old assertion named one of two legal outcomes. ## Evidence, and a probe that fails on demand Two groups of one budget, so both orders are correct and the invariant worth pinning is `(kept, zeroed) == (2, 126)`, which line 1561 already asserts. On this machine today the second group charges first, consistently. That makes the old assertion fail deterministically rather than intermittently: - accept `[1, 2]` only (the pre-fix shape) → **2 of 3 runs fail**, `panicked at indirect.rs:1542: the first two real draws of the group that charged first fit the budget, not [64, 65]` - accept `[64, 65]` only → passes, because that is the order this machine takes - accept both (this patch) → passes; restored byte-identical, sha256 `7c2bf779459c22d0` Full suite: **170 passed, 0 failed, 5 ignored**. Earlier measurement on the `f85101b6` tree, full suite, four processes at a time: 2 of 12 runs failed without this patch, 0 of 12 with it. Idle and serial runs never reproduced it, which is why it read as a machine-specific flake for days. ## Ordering #169 is built on `f85101b6` and carries the same strict assertion, so it should rebase onto `main` after this lands — otherwise its suite keeps showing a failure unrelated to its change. ## Not covered Native D3D12 — everything above is WARP. And this fixes a test, not the shader: if the budget were ever meant to be spent in a defined order, that would be a different and much larger question.
upstream-sync changed title from [PR #970] Take #849: the warp budget test accepts either group charging first (regression from f85101b6) to [PR #970] Warp budget test: accept either group charging first (rebased on main, +12/−1) 2026-11-25 15:08:25 +00:00
avt0m4t48 commented 2026-11-25 15:08:31 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T14:17:06Z.


I independently reproduced the same cross-group outcome on native Windows WARP while working on #888. This test change captures the current parallel clamp's behavior. #899 addresses the runtime side by making earlier records take the budget first across groups, keeping the assertion that the surviving records are 1 and 2.

The #899 WARP run passed all 13 indirect tests, including repeated runs of that order check. The comparison with the old parallel clamp also measures the additional dispatches. Physical GPU and game frame timings remain open.

WARP reproduction · Patched WARP run · Cost comparison

AI-assisted using Codex.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7165039953 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/970#issuecomment-7165039953). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T14:17:06Z. --- I independently reproduced the same cross-group outcome on native Windows WARP while working on #888. This test change captures the current parallel clamp's behavior. #899 addresses the runtime side by making earlier records take the budget first across groups, keeping the assertion that the surviving records are 1 and 2. The #899 WARP run passed all 13 indirect tests, including repeated runs of that order check. The comparison with the old parallel clamp also measures the additional dispatches. Physical GPU and game frame timings remain open. [WARP reproduction](https://github.com/avt0m4t48/victory-fork/actions/runs/45610184876) · [Patched WARP run](https://github.com/avt0m4t48/victory-fork/actions/runs/45611523140) · [Cost comparison](https://github.com/fxceless/victory-fork/pull/899#issuecomment-7164524621) AI-assisted using Codex.
upstream-sync closed this pull request 2026-11-26 14:03:19 +00:00
HailLucifer666 commented 2026-11-26 14:03:30 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HailLucifer666 on 2026-11-26T13:35:42Z.


Superseded by 0c7807ac on main ("Tests: three that failed on a machine with no card, or by the order tests ran in, hold everywhere"). Main now asserts only that two records keep the budget and that the no-draw record is not one of them, which is more tolerant than this PR's [1, 2] or [64, 65]; a rebase conflicts because the same assertion was relaxed upstream. Closing as already fixed rather than rebasing a redundant change. No behavior is affected.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7193567985 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/970#issuecomment-7193567985). Originally posted by [HailLucifer666](https://github.com/HailLucifer666) on 2026-11-26T13:35:42Z. --- Superseded by `0c7807ac` on `main` ("Tests: three that failed on a machine with no card, or by the order tests ran in, hold everywhere"). Main now asserts only that two records keep the budget and that the no-draw record is not one of them, which is more tolerant than this PR's `[1, 2]` or `[64, 65]`; a rebase conflicts because the same assertion was relaxed upstream. Closing as already fixed rather than rebasing a redundant change. No behavior is affected.

Pull request closed

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!969
No description provided.