GPU loading allowance follows elapsed frame waits #19

Open
Artking175 wants to merge 1 commit from upstream-pr/19 into main
Artking175 commented 2026-11-25 18:49:14 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by Artking175 on 2026-11-25T18:49:14Z.


Problem

The loading allowance was charged against each individual wait. With a 500 ms base budget, sequential waits of 400, 400 and 200 ms in one frame leave 500 ms to charge. The previous code charged zero. With the default shared wait window, two overlapping 800 ms waits should spend 300 ms beyond the base, but per-wait accounting can count 600 ms.

Change

Account for elapsed waiting beyond the ordinary budget once per frame and pipeline kind. Count overlapping waits once in the default mode. Track reserved time separately from completed waits so the reserve mode only charges time that elapsed. The loading allowance already recorded for the current frame is excluded when calculating that frame's remaining budget.

Verification

Tested on Windows 10 22H2 (19045), RTX 2060 (driver 531.41) and Rust 1.98.1 MSVC on base 2e01ab4.

  • cargo test --locked -p victory-gpu --lib pipeline::make -- --test-threads=1 passed all 10 tests, including two new deterministic regressions.
  • cargo test --locked -p victory-gpu --lib -- --test-threads=1 gave 187 passed, 1 failed and 3 ignored on main, and 189 passed, 1 failed and 3 ignored with the patch. Both runs failed depth_bounds_pipeline_loads_and_filters_draws with 0x80070057 during root-signature creation.
  • git diff --check passed.

Gameplay FPS was not measured. Related discussion in #7.

<!-- greyfinch-sync:DexNom/VIctory:issue:5497207773 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/19). Originally posted by [Artking175](https://github.com/Artking175) on 2026-11-25T18:49:14Z. --- ## Problem The loading allowance was charged against each individual wait. With a 500 ms base budget, sequential waits of 400, 400 and 200 ms in one frame leave 500 ms to charge. The previous code charged zero. With the default shared wait window, two overlapping 800 ms waits should spend 300 ms beyond the base, but per-wait accounting can count 600 ms. ## Change Account for elapsed waiting beyond the ordinary budget once per frame and pipeline kind. Count overlapping waits once in the default mode. Track reserved time separately from completed waits so the reserve mode only charges time that elapsed. The loading allowance already recorded for the current frame is excluded when calculating that frame's remaining budget. ## Verification Tested on Windows 10 22H2 (19045), RTX 2060 (driver 531.41) and Rust 1.98.1 MSVC on base `2e01ab4`. - `cargo test --locked -p victory-gpu --lib pipeline::make -- --test-threads=1` passed all 10 tests, including two new deterministic regressions. - `cargo test --locked -p victory-gpu --lib -- --test-threads=1` gave 187 passed, 1 failed and 3 ignored on main, and 189 passed, 1 failed and 3 ignored with the patch. Both runs failed `depth_bounds_pipeline_loads_and_filters_draws` with `0x80070057` during root-signature creation. - `git diff --check` passed. Gameplay FPS was not measured. Related discussion in [#7](https://github.com/DexNom/VIctory/pull/7#issuecomment-7171115239).
andrewDoing commented 2026-11-26 23:02:52 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-26T23:02:52Z.


I reproduced a loading-allowance accounting regression across frame rollover at cd05b6a. With WAIT_MS=500 and PIPELINE_GATE_S=1, frame 1 waits about 800 ms on a pending pipeline. Just before that wait completes, a second thread starts a frame-2 wait using an already-ready pipeline. Frame 2 replaces the frame state; the frame-1 completion is then discarded at make.rs:429, so its extra 300 ms is not charged to the cumulative loading allowance.

Using the production wait() with real wall time and two threads, observed frame budgets were [1000,1000,700] ms on parent 2e01ab4 and [1000,1000,1000] ms on this PR. A deterministic timestamp fixture reproduced the same behavior in Window, Reserve and PerThread modes; ending the first wait just before the second begins retained the expected 700 ms. Only budget observation and the test fixture were added. No GPU, gameplay or frequency claim.

Verification was AI-assisted with GPT-6.2 Astra.

<!-- greyfinch-sync:DexNom/VIctory:comment:7205207634 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/19#issuecomment-7205207634). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-26T23:02:52Z. --- I reproduced a loading-allowance accounting regression across frame rollover at `cd05b6a`. With `WAIT_MS=500` and `PIPELINE_GATE_S=1`, frame 1 waits about 800 ms on a pending pipeline. Just before that wait completes, a second thread starts a frame-2 wait using an already-ready pipeline. Frame 2 replaces the frame state; the frame-1 completion is then discarded at `make.rs:429`, so its extra 300 ms is not charged to the cumulative loading allowance. Using the production `wait()` with real wall time and two threads, observed frame budgets were `[1000,1000,700]` ms on parent `2e01ab4` and `[1000,1000,1000]` ms on this PR. A deterministic timestamp fixture reproduced the same behavior in Window, Reserve and PerThread modes; ending the first wait just before the second begins retained the expected 700 ms. Only budget observation and the test fixture were added. No GPU, gameplay or frequency claim. Verification was AI-assisted with GPT-6.2 Astra.
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/19:upstream-pr/19'
git switch 'upstream-pr/19'

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