Tests: the indirect budget tests assert both REST modes instead of the old discard-one #1508

Open
pwu2775-dev wants to merge 2 commits from upstream-pr/1508 into main
pwu2775-dev commented 2026-11-28 05:53:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by pwu2775-dev on 2026-11-28T05:53:54Z.


What

The two indirect-budget tests failed on the current main (6b3ce6c) when run by default, and passed only with VICTORY_INDIRECT_REST=1:

  • indirect::tests::host_list_budget_starts_empty_at_each_submission
  • indirect::tests::warp_batch_charges_every_execution

Both asserted the old spend model (a record after rejected work gets nothing), while the runtime keeps the remaining budget for it by default — the code comment in the budget path says exactly that. VICTORY_INDIRECT_REST=1 selects the old behavior, which is why the suite only passed with the variable set.

Fix (tests only, no runtime change)

  • host_list_budget_starts_empty_at_each_submission now runs each assertion under both modes: with REST=0 the small record after rejected work executes (hits == round+1 per round), with REST=1 it consumes the remaining budget (hits == 0), and the "next submission starts empty" check covers both.
  • warp_batch_charges_every_execution derives its expected spend per mode instead of assuming one model; the shader source is switched per run via a REST ? placeholder.
  • After review: the next-submission test now uses two records of 32,768 x 32 groups that cost exactly half the budget each, so they fill it in either mode and the small record after them runs only when the next submission starts empty — against an implementation that zeroes a list's budget only once per process, the test now fails in both modes instead of only REST=1.
  • Runtime code is untouched; this only corrects tests that still assumed the pre-VICTORY_INDIRECT_REST spend model.

Verification

  • cargo test -p victory-gpu --locked --lib: 454 passed, 35 skipped, 0 failed (default mode), including the reviewer's mutant-strengthened test.
  • Same suite with VICTORY_INDIRECT_REST=1: target tests pass in that mode too.
  • cargo test --workspace --locked -- --test-threads=1 on this branch: exit code 0, all suites pass (the run that was interrupted earlier completed successfully afterwards).
  • cargo clippy --workspace is not clean on this base: the warnings exist on main itself (pre-existing), this PR adds none.
  • Independently verified by @murillojndem on an AMD RX 7900 XT and WARP at 59d332c; the strengthened records follow their review.

Known limits

  • No game was run for this change; it is a test-only correction.
  • The repo's resource-policy check fails on main already due to two oversized source files unrelated to this PR.
<!-- greyfinch-sync:fxceless/victory-fork:issue:5537236984 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1508). Originally posted by [pwu2775-dev](https://github.com/pwu2775-dev) on 2026-11-28T05:53:54Z. --- ## What The two indirect-budget tests failed on the current `main` (`6b3ce6c`) when run by default, and passed only with `VICTORY_INDIRECT_REST=1`: - `indirect::tests::host_list_budget_starts_empty_at_each_submission` - `indirect::tests::warp_batch_charges_every_execution` Both asserted the old spend model (a record after rejected work gets nothing), while the runtime keeps the remaining budget for it by default — the code comment in the budget path says exactly that. `VICTORY_INDIRECT_REST=1` selects the old behavior, which is why the suite only passed with the variable set. ## Fix (tests only, no runtime change) - `host_list_budget_starts_empty_at_each_submission` now runs each assertion under **both** modes: with `REST=0` the small record after rejected work executes (`hits == round+1` per round), with `REST=1` it consumes the remaining budget (`hits == 0`), and the "next submission starts empty" check covers both. - `warp_batch_charges_every_execution` derives its expected spend per mode instead of assuming one model; the shader source is switched per run via a `REST ?` placeholder. - After review: the next-submission test now uses **two records of 32,768 x 32 groups that cost exactly half the budget each**, so they fill it in either mode and the small record after them runs only when the next submission starts empty — against an implementation that zeroes a list's budget only once per process, the test now fails in **both** modes instead of only `REST=1`. - Runtime code is untouched; this only corrects tests that still assumed the pre-`VICTORY_INDIRECT_REST` spend model. ## Verification - `cargo test -p victory-gpu --locked --lib`: **454 passed, 35 skipped, 0 failed** (default mode), including the reviewer's mutant-strengthened test. - Same suite with `VICTORY_INDIRECT_REST=1`: target tests pass in that mode too. - `cargo test --workspace --locked -- --test-threads=1` on this branch: **exit code 0**, all suites pass (the run that was interrupted earlier completed successfully afterwards). - `cargo clippy --workspace` is **not clean on this base**: the warnings exist on `main` itself (pre-existing), this PR adds none. - Independently verified by @murillojndem on an AMD RX 7900 XT and WARP at `59d332c`; the strengthened records follow their review. ## Known limits - No game was run for this change; it is a test-only correction. - The repo's resource-policy check fails on `main` already due to two oversized source files unrelated to this PR.
murillojndem commented 2026-11-28 06:59:45 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by murillojndem on 2026-11-28T06:59:45Z.


Checked on an AMD Radeon RX 7900 XT (RDNA 3, driver 32.0.32015.7029) and WARP, Windows 11, at this PR's head 59d332c: both tests pass with the default and with VICTORY_INDIRECT_REST=1. On 6b3ce6c they fail with the default and pass with VICTORY_INDIRECT_REST=1, as you describe.

One gap in host_list_budget_starts_empty_at_each_submission with the default (rest off): two of the three records fit and leave 2,048 of the budget, so the small record fits whether or not the budget was zeroed for the next submission. Against a mutant that zeroes a list's budget only once per process (HostList::budget in host.rs), this test still passes with the default and fails only with VICTORY_INDIRECT_REST=1.

Two records of 32,768 x 32 groups cost exactly half the budget each (2^26), so they fill it in either mode. With them, and the test's original expectations (0 in each round, 1 at the end), the test passes on this branch in both modes and fails against that mutant in both modes. The change to the records:

-        // Three records of 65,535 x 16 groups: about half the budget each.
-        let Some((big, big_ptr)) = host.shared_buffer(3 * u64::from(STRIDE)) else {
+        // Two records of 32,768 x 32 groups: half the budget each, exactly,
+        // so the two spend all of it whether or not a record that does not
+        // fit takes the rest (`rest`, off by default).
+        let Some((big, big_ptr)) = host.shared_buffer(2 * u64::from(STRIDE)) else {
@@
-            for i in 0..3 {
-                let words = [65535u32, 16, 1];
+            for i in 0..2 {
+                let words = [32768u32, 32, 1];
@@
-            bound(&list, (&big, 0), None, (KIND_DISPATCH, STRIDE, 3)).unwrap();
+            bound(&list, (&big, 0), None, (KIND_DISPATCH, STRIDE, 2)).unwrap();

warp_batch_charges_every_execution as changed here runs both modes in one run and needs no change.

Also, the description names warp_a_record_that_does_not_fit_may_take_nothing; the diff changes host_list_budget_starts_empty_at_each_submission.

AI use: Claude Code ran the tests and drafted this comment; posted at my request.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7235646325 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1508#issuecomment-7235646325). Originally posted by [murillojndem](https://github.com/murillojndem) on 2026-11-28T06:59:45Z. --- Checked on an AMD Radeon RX 7900 XT (RDNA 3, driver 32.0.32015.7029) and WARP, Windows 11, at this PR's head 59d332c: both tests pass with the default and with `VICTORY_INDIRECT_REST=1`. On 6b3ce6c they fail with the default and pass with `VICTORY_INDIRECT_REST=1`, as you describe. One gap in `host_list_budget_starts_empty_at_each_submission` with the default (`rest` off): two of the three records fit and leave 2,048 of the budget, so the small record fits whether or not the budget was zeroed for the next submission. Against a mutant that zeroes a list's budget only once per process (`HostList::budget` in `host.rs`), this test still passes with the default and fails only with `VICTORY_INDIRECT_REST=1`. Two records of 32,768 x 32 groups cost exactly half the budget each (2^26), so they fill it in either mode. With them, and the test's original expectations (0 in each round, 1 at the end), the test passes on this branch in both modes and fails against that mutant in both modes. The change to the records: ```diff - // Three records of 65,535 x 16 groups: about half the budget each. - let Some((big, big_ptr)) = host.shared_buffer(3 * u64::from(STRIDE)) else { + // Two records of 32,768 x 32 groups: half the budget each, exactly, + // so the two spend all of it whether or not a record that does not + // fit takes the rest (`rest`, off by default). + let Some((big, big_ptr)) = host.shared_buffer(2 * u64::from(STRIDE)) else { @@ - for i in 0..3 { - let words = [65535u32, 16, 1]; + for i in 0..2 { + let words = [32768u32, 32, 1]; @@ - bound(&list, (&big, 0), None, (KIND_DISPATCH, STRIDE, 3)).unwrap(); + bound(&list, (&big, 0), None, (KIND_DISPATCH, STRIDE, 2)).unwrap(); ``` `warp_batch_charges_every_execution` as changed here runs both modes in one run and needs no change. Also, the description names `warp_a_record_that_does_not_fit_may_take_nothing`; the diff changes `host_list_budget_starts_empty_at_each_submission`. AI use: Claude Code ran the tests and drafted this comment; posted at my request.
pwu2775-dev commented 2026-11-28 11:06:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by pwu2775-dev on 2026-11-28T11:06:19Z.


Applied as 41b43c2: two records of 32,768 x 32 groups cost exactly half the budget each, the small record after them runs only when the next submission starts empty, and the original expectations (0 in each round, 1 at the end) hold in both modes. Verified: 454 passed / 0 failed on the default, and the target tests pass with VICTORY_INDIRECT_REST=1. Thank you for the catch and the concrete diff — also fixed the test name in the description (host_list_budget_starts_empty_at_each_submission, not warp_a_record_that_does_not_fit_may_take_nothing).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7238330043 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1508#issuecomment-7238330043). Originally posted by [pwu2775-dev](https://github.com/pwu2775-dev) on 2026-11-28T11:06:19Z. --- Applied as 41b43c2: two records of 32,768 x 32 groups cost exactly half the budget each, the small record after them runs only when the next submission starts empty, and the original expectations (0 in each round, 1 at the end) hold in both modes. Verified: 454 passed / 0 failed on the default, and the target tests pass with VICTORY_INDIRECT_REST=1. Thank you for the catch and the concrete diff — also fixed the test name in the description (host_list_budget_starts_empty_at_each_submission, not warp_a_record_that_does_not_fit_may_take_nothing).
pwu2775-dev commented 2026-11-28 11:07:11 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by pwu2775-dev on 2026-11-28T11:07:11Z.


Marked ready for review: the review's mutant-strengthened records are applied (41b43c2), the full GPU lib suite passes in the default mode (454 passed / 0 failed), the target tests pass with VICTORY_INDIRECT_REST=1, and the independent verification on RX 7900 XT + WARP stands.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7238339663 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1508#issuecomment-7238339663). Originally posted by [pwu2775-dev](https://github.com/pwu2775-dev) on 2026-11-28T11:07:11Z. --- Marked ready for review: the review's mutant-strengthened records are applied (41b43c2), the full GPU lib suite passes in the default mode (454 passed / 0 failed), the target tests pass with VICTORY_INDIRECT_REST=1, and the independent verification on RX 7900 XT + WARP stands.
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/1508:upstream-pr/1508'
git switch 'upstream-pr/1508'

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/1508'
git switch 'upstream-pr/1508'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1508'
git switch 'upstream-pr/1508'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1508'
git switch 'main'
git merge --squash 'upstream-pr/1508'
git switch 'main'
git merge --ff-only 'upstream-pr/1508'
git switch 'main'
git merge 'upstream-pr/1508'
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!1508
No description provided.