Indirect: raise the list budget from 2^27 to 2^30 (valid records were emptied in 248 of 509 s of play) #72

Open
github-bot wants to merge 1 commit from github-bot/gh-72 into main AGit
Owner

@⁠exotiquee on GitHub · 2026-11-27 16:14 UTC · original
exotiquee:indirect-budget-2-30 → main · +51 −21 · 4 files · 1 commits · open

The per-list indirect budget (BUDGET = 1u << 27 in the clamps in indirect.rs and indirect/batch.rs) empties valid draws and dispatches in normal play. This PR raises it to 1u << 30.

Evidence

Measured on an RTX 5080 with a Ryzen 7 9800X3D, using a downstream build that has the same clamp shaders and a per-second counter of records emptied by the budget (the same data as BUDGET_NOTES[0] in host.rs):

Budget Seconds in which the budget emptied records
2^27 248 of 509
2^30 0 (whole session)
  • At 2^27, about two lists a second ran out of budget in steady play.
  • The groups of a clamp race for the budget word, so which records get cut changes from frame to frame. On screen this was flicker and intermittently missing geometry: in one run the ocean disappeared from the first cutscene shots of the boat.
  • The water lists alone take about half the budget.
  • At 2^30 the counter stayed at 0, and the water and flicker problems went away.

Why 2^30 is still safe

The budget is a hang guard for records the title never wrote. It is not a console limit, since the console runs every record. The per-record limits already empty the known garbage before the budget is involved: 2^23 vertices per instance, 2^26 per draw, 2^20 groups per dispatch, and unfilled window slots.

At 2^30, a list that spends its whole budget on garbage is about 1,000 million vertex-instances or threads. That is roughly 0.2-0.5 s of card time, still under the 2 s TDR limit. The 32-bit sums in the clamps stay safe:

  • A record costs at most 2^26, and a batched job at most 31 x 2^26.
  • next + c is only computed after BUDGET - next >= c holds.

Changes

  • BUDGET goes from 1u << 27 to 1u << 30 in both clamp shaders (indirect.rs SOURCE, indirect/batch.rs SOURCE).
  • The module doc, the draw.rs comment and the diagnostics log line (2^27 -> 2^30) are updated to match.
  • indirect/bench.rs OLD_SOURCE is left as it is, because it is the old clamp the benchmark compares against.
  • Tests:
    • The tests now use one test-module constant BUDGET (plus MOST_RECORD = 1 << 26). A new test checks that both shader sources are compiled with that value.
    • warp_budget_saturates_without_wraparound_and_preserves_draw_fields: BUDGET / 2^26 records are kept instead of 2.
    • host_list_budget_starts_empty_at_each_submission: now uses BUDGET / 2^26 records of 1024x1024 groups, which fill the budget exactly. The test no longer depends on VICTORY_INDIRECT_REST.
    • warp_batch_charges_every_execution: the cases are scaled to the new budget. The over-budget single-record case expects BUDGET with VICTORY_INDIRECT_REST=1 and 0 without it, so the test passes either way. This overlaps with #67, which fixes the same two tests by forcing REST on. Either approach works, and I'm happy to rebase on whichever lands first.

Not verified here

I could not run the test suite on this machine. The changed tests are WARP / host D3D12 tests in victory-gpu, so please run cargo test -p victory-gpu indirect:: before merging. The runtime change is the two shader constants.

To check this in play, use the existing "records a frame ran empty for want of their list's budget" figure in the frame line (BUDGET_NOTES). With 2^30 it should stay at 0. If a title ever asks for more, the "largest cost" figure next to it shows by how much.

🤖 Generated with Claude Code

**@⁠exotiquee** on GitHub · 2026-11-27 16:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/72) `exotiquee:indirect-budget-2-30` → `main` · +51 −21 · 4 files · 1 commits · open The per-list indirect budget (`BUDGET = 1u << 27` in the clamps in `indirect.rs` and `indirect/batch.rs`) empties valid draws and dispatches in normal play. This PR raises it to `1u << 30`. ### Evidence Measured on an RTX 5080 with a Ryzen 7 9800X3D, using a downstream build that has the same clamp shaders and a per-second counter of records emptied by the budget (the same data as `BUDGET_NOTES[0]` in `host.rs`): | Budget | Seconds in which the budget emptied records | |---|---| | 2^27 | **248 of 509** | | 2^30 | **0** (whole session) | - At 2^27, about two lists a second ran out of budget in steady play. - The groups of a clamp race for the budget word, so which records get cut changes from frame to frame. On screen this was flicker and intermittently missing geometry: in one run the ocean disappeared from the first cutscene shots of the boat. - The water lists alone take about half the budget. - At 2^30 the counter stayed at 0, and the water and flicker problems went away. ### Why 2^30 is still safe The budget is a hang guard for records the title never wrote. It is not a console limit, since the console runs every record. The per-record limits already empty the known garbage before the budget is involved: 2^23 vertices per instance, 2^26 per draw, 2^20 groups per dispatch, and unfilled window slots. At 2^30, a list that spends its whole budget on garbage is about 1,000 million vertex-instances or threads. That is roughly 0.2-0.5 s of card time, still under the 2 s TDR limit. The 32-bit sums in the clamps stay safe: - A record costs at most 2^26, and a batched job at most 31 x 2^26. - `next + c` is only computed after `BUDGET - next >= c` holds. ### Changes - `BUDGET` goes from `1u << 27` to `1u << 30` in both clamp shaders (`indirect.rs` `SOURCE`, `indirect/batch.rs` `SOURCE`). - The module doc, the `draw.rs` comment and the diagnostics log line (`2^27` -> `2^30`) are updated to match. - `indirect/bench.rs` `OLD_SOURCE` is left as it is, because it is the old clamp the benchmark compares against. - Tests: - The tests now use one test-module constant `BUDGET` (plus `MOST_RECORD = 1 << 26`). A new test checks that both shader sources are compiled with that value. - `warp_budget_saturates_without_wraparound_and_preserves_draw_fields`: `BUDGET / 2^26` records are kept instead of 2. - `host_list_budget_starts_empty_at_each_submission`: now uses `BUDGET / 2^26` records of 1024x1024 groups, which fill the budget exactly. The test no longer depends on `VICTORY_INDIRECT_REST`. - `warp_batch_charges_every_execution`: the cases are scaled to the new budget. The over-budget single-record case expects `BUDGET` with `VICTORY_INDIRECT_REST=1` and 0 without it, so the test passes either way. This overlaps with #67, which fixes the same two tests by forcing REST on. Either approach works, and I'm happy to rebase on whichever lands first. ### Not verified here I could not run the test suite on this machine. The changed tests are WARP / host D3D12 tests in `victory-gpu`, so please run `cargo test -p victory-gpu indirect::` before merging. The runtime change is the two shader constants. To check this in play, use the existing "records a frame ran empty for want of their list's budget" figure in the frame line (`BUDGET_NOTES`). With 2^30 it should stay at 0. If a title ever asks for more, the "largest cost" figure next to it shows by how much. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
At 2^27 the clamps emptied valid indirect draws and dispatches of the
title's in normal play, in about half of all seconds; with racing groups
the records cut change from frame to frame (flicker, missing water).
2^30 is still a hang guard: a list that spends all of it on garbage is a
few tenths of a second of card time, under the 2 s device-removal limit.

The tests derive their numbers from one test constant, checked against
both clamps' sources; the host-list and batch budget tests no longer
depend on VICTORY_INDIRECT_REST.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 16:18:54 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-27 16:30 UTC · original · approved these changes

LGTM — verified on Windows (RTX 5090 + WARP):

  • cargo test -p victory-gpu --lib indirect:: passed (30/30, including the_clamps_are_compiled_with_the_tests_budget, host_list_budget_starts_empty_at_each_submission, and warp_batch_charges_every_execution)
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (279 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-27 16:30 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/72#pullrequestreview-6091007677) · **approved these changes** LGTM — verified on Windows (RTX 5090 + WARP): - `cargo test -p victory-gpu --lib indirect::` passed (30/30, including `the_clamps_are_compiled_with_the_tests_budget`, `host_list_budget_starts_empty_at_each_submission`, and `warp_batch_charges_every_execution`) - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`279 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠FIJI1299 on GitHub · 2026-11-27 16:37 UTC · original

Tested commit 96fc904 with 0 errors on the indirect:: test suite.

System Specifications

  • GPU: NVIDIA GeForce RTX 5070
  • CPU: AMD Ryzen 5 9600X
  • RAM: 32GB DDR5 6000 MT/s
  • OS: Windows 11

Test Suite Results (cargo test --locked -p victory-gpu indirect::)

All 30 unit / WARP / host D3D12 tests in indirect:: passed:

test result: ok. 30 passed; 0 failed; 9 ignored; 0 measured; 413 filtered out; finished in 1.06s

(Note: Verification was limited to the indirect:: test suite; in-game testing was not performed.)


🤖 Generated with Gemini

**@⁠FIJI1299** on GitHub · 2026-11-27 16:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/72#issuecomment-7223485791) Tested commit `96fc904` with **0 errors** on the `indirect::` test suite. ### System Specifications * **GPU:** NVIDIA GeForce RTX 5070 * **CPU:** AMD Ryzen 5 9600X * **RAM:** 32GB DDR5 6000 MT/s * **OS:** Windows 11 ### Test Suite Results (`cargo test --locked -p victory-gpu indirect::`) All **30** unit / WARP / host D3D12 tests in `indirect::` passed: ```text test result: ok. 30 passed; 0 failed; 9 ignored; 0 measured; 413 filtered out; finished in 1.06s ``` *(Note: Verification was limited to the `indirect::` test suite; in-game testing was not performed.)* --- 🤖 Generated with Gemini
Author
Owner

@⁠exotiquee on GitHub · 2026-11-27 17:54 UTC · original

Correction to the evidence above: the 248-of-509-seconds figure was measured on a downstream tree with different defaults (1440p scene, water light on), not on this repo's defaults. On a run of this repo's main with its default settings (RTX 5080), the existing counter reads 0.00 indirect records a frame ran empty (2^27) in every one-second line. So on current defaults the budget does not appear to be hit; the raise only matters for configurations that render more indirect work (e.g. VICTORY_WATER_LIGHT=1). Happy to close this if you prefer to keep 2^27 until someone reproduces run-outs on this tree.

**@⁠exotiquee** on GitHub · 2026-11-27 17:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/72#issuecomment-7224920292) Correction to the evidence above: the 248-of-509-seconds figure was measured on a downstream tree with different defaults (1440p scene, water light on), not on this repo's defaults. On a run of this repo's main with its default settings (RTX 5080), the existing counter reads `0.00 indirect records a frame ran empty (2^27)` in every one-second line. So on current defaults the budget does not appear to be hit; the raise only matters for configurations that render more indirect work (e.g. `VICTORY_WATER_LIGHT=1`). Happy to close this if you prefer to keep 2^27 until someone reproduces run-outs on this tree.
Author
Owner

@⁠1tsethan on GitHub · 2026-11-27 23:00 UTC · original

Independent Windows validation of PR #72.

Tested commit: 96fc90418897864ad56911eb9e978b616aabb872.

cargo test --locked -p victory-gpu indirect:: -- --nocapture --test-threads=1

Exit: 0.

  • test result: ok. 30 passed; 0 failed; 9 ignored; 0 measured; 413 filtered out; finished in 1.90s

Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.

**@⁠1tsethan** on GitHub · 2026-11-27 23:00 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/72#issuecomment-7229796798) Independent Windows validation of PR #72. Tested commit: `96fc90418897864ad56911eb9e978b616aabb872`. `cargo test --locked -p victory-gpu indirect:: -- --nocapture --test-threads=1` Exit: **0**. - test result: ok. 30 passed; 0 failed; 9 ignored; 0 measured; 413 filtered out; finished in 1.90s Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result. <!-- victory-native-validation-20261128 -->
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/72/head:github-bot/gh-72'
git switch 'github-bot/gh-72'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-72'
git switch 'github-bot/gh-72'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-72'
git switch 'github-bot/gh-72'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-72'
git switch 'main'
git merge --squash 'github-bot/gh-72'
git switch 'main'
git merge --ff-only 'github-bot/gh-72'
git switch 'main'
git merge 'github-bot/gh-72'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.