Tests: the WARP budget test lets either group of records charge the budget first #1110

Closed
github-bot wants to merge 1 commit from gh-pr/1110/head into gh-pr/1110/base
Owner

@⁠tippythetaidum on GitHub · 2026-11-25 19:48 UTC · original
tippythetaidum:tests/warp-budget-group-order → main · +11 −4 · 1 files · 1 commits · closed without merging

What fails

indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields fails on GitHub's Windows runner:

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

The runner has no card, so the test's WARP device is the only one. Today's main CI doesn't get as far as the tests: Clippy stops it first, and #982 fixes that. Once Clippy passed in a build of this tree, this test was one of two that still failed.

Why

The clamp program charges the budget per group of 64 records. Inside a group the records charge in their order, but the groups take turns through a compare-exchange on the budget word, in whatever order the device runs them. The test's 128 records are one empty record and 127 that each cost half the budget, so exactly two fit: the first two real draws of whichever group charges first. That's records 1 and 2 when group 0 goes first, and records 64 and 65 when group 1 does. The test assumed group 0. WARP doesn't always run it first.

So the clamp is doing what it says. The assertion was too narrow.

Change

The test collects the kept records and accepts [1, 2] or [64, 65]. The other checks stay as they are: the budget saturates at BUDGET without wrapping, the source arguments are untouched, every other record is zeroed (125), and every record keeps its fields.

Tested

On GitHub's Windows runner (no card, WARP), in a CI run of a tree with this change and #982 on main: the test fails before the change and passes after. I have not run it on WARP on my own machine. On my RTX 5080 the test also builds its device with WARP, and the change only widens what it accepts.

AI-assisted (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

**@⁠tippythetaidum** on GitHub · 2026-11-25 19:48 UTC · [original](https://github.com/fxceless/victory-fork/pull/1110) `tippythetaidum:tests/warp-budget-group-order` → `main` · +11 −4 · 1 files · 1 commits · closed without merging ## What fails `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` fails on GitHub's Windows runner: ``` panicked at crates\victory-gpu\src\indirect.rs:1992:17: the first two real draws fit the budget ``` The runner has no card, so the test's WARP device is the only one. Today's `main` CI doesn't get as far as the tests: Clippy stops it first, and #982 fixes that. Once Clippy passed in a build of this tree, this test was one of two that still failed. ## Why The clamp program charges the budget per group of 64 records. Inside a group the records charge in their order, but the groups take turns through a compare-exchange on the budget word, in whatever order the device runs them. The test's 128 records are one empty record and 127 that each cost half the budget, so exactly two fit: the first two real draws of whichever group charges first. That's records 1 and 2 when group 0 goes first, and records 64 and 65 when group 1 does. The test assumed group 0. WARP doesn't always run it first. So the clamp is doing what it says. The assertion was too narrow. ## Change The test collects the kept records and accepts `[1, 2]` or `[64, 65]`. The other checks stay as they are: the budget saturates at `BUDGET` without wrapping, the source arguments are untouched, every other record is zeroed (125), and every record keeps its fields. ## Tested On GitHub's Windows runner (no card, WARP), in a CI run of a tree with this change and #982 on `main`: the test fails before the change and passes after. I have not run it on WARP on my own machine. On my RTX 5080 the test also builds its device with WARP, and the change only widens what it accepts. AI-assisted (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Each group of 64 records charges the budget in its records' order, but the
groups take turns in whatever order the device runs them. The test expected
records 1 and 2 to be the two that fit; on GitHub's runner a record outside
them was kept, which is the clamp working as written when the second group
charges first. It now accepts the first two real draws of either group.

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

@⁠liuycsbxbxn on GitHub · 2026-11-25 22:09 UTC · original

Widening what the test accepts is the right direction — it removes the failure that was being observed, and "the change only widens what it accepts" is the right way to describe the risk.

One assumption left in it, for whoever lands one of the two: kept == [1, 2] || kept == [64, 65] also says which pair it is, which holds only while the group that charges is the lowest-indexed one. The invariant form in #1098 (exactly two records keep their draw, record 0 is not one of them, every other record zeroed whole, spent == BUDGET_CAP) makes the same change without naming the pair, so a future wave size or a different adapter cannot make it red again.

Not a blocker from my side — both PRs fix the observed flake, and they touch the same lines so only one can land.

**@⁠liuycsbxbxn** on GitHub · 2026-11-25 22:09 UTC · [original](https://github.com/fxceless/victory-fork/pull/1110#issuecomment-7176001244) Widening what the test accepts is the right direction — it removes the failure that was being observed, and "the change only widens what it accepts" is the right way to describe the risk. One assumption left in it, for whoever lands one of the two: `kept == [1, 2] || kept == [64, 65]` also says *which* pair it is, which holds only while the group that charges is the lowest-indexed one. The invariant form in #1098 (exactly two records keep their draw, record 0 is not one of them, every other record zeroed whole, `spent == BUDGET_CAP`) makes the same change without naming the pair, so a future wave size or a different adapter cannot make it red again. Not a blocker from my side — both PRs fix the observed flake, and they touch the same lines so only one can land.
Author
Owner

@⁠tippythetaidum on GitHub · 2026-11-25 22:32 UTC · original

Agreed, and thanks for pointing to #1098. I missed it when I opened this: it predates this PR (19:23 against 19:48) and states the invariant without naming the pair, which is the better test. The clamp is [numthreads(64, 1, 1)], so the pairs follow from its own group size rather than the adapter's wave size. Still, as you say, #1098's form holds whatever the record count or grouping becomes.

I'm closing this in favour of #1098 so there's one fewer duplicate to sort through.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠tippythetaidum** on GitHub · 2026-11-25 22:32 UTC · [original](https://github.com/fxceless/victory-fork/pull/1110#issuecomment-7176496298) Agreed, and thanks for pointing to #1098. I missed it when I opened this: it predates this PR (19:23 against 19:48) and states the invariant without naming the pair, which is the better test. The clamp is `[numthreads(64, 1, 1)]`, so the pairs follow from its own group size rather than the adapter's wave size. Still, as you say, #1098's form holds whatever the record count or grouping becomes. I'm closing this in favour of #1098 so there's one fewer duplicate to sort through. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.