Pipelines: one still being made waits less after its first frame (VICTORY_PIPELINE_WAIT_AGAIN_MS, unset as before) #410

Open
github-bot wants to merge 1 commit from github-bot/gh-410 into a-publier AGit
Owner

@⁠Esteban-V on GitHub · 2026-11-27 00:07 UTC · original
Esteban-V:perf/pipeline-wait-again → a-publier · +55 −1 · 1 files · 1 commits · open

A frame waits up to wait_budget() (500 ms, VICTORY_PIPELINE_WAIT_MS, crates/victory-gpu/src/pipeline/make.rs:361) for the pipelines its draws need, and wait starts that budget again every frame (make.rs:454). So a pipeline that is still compiling costs up to 500 ms in every frame until it is made. One 3.4 s compile is about seven such frames, and docs/findings.md records 270-660 s of a session spent in frames over 200 ms while pipelines were being made. This PR adds VICTORY_PIPELINE_WAIT_AGAIN_MS=<n>. With it set, a pipeline still gets the full budget in the first frame that waits for it, then at most n ms in each later frame. The trade-off: a draw whose pipeline isn't ready is skipped for more frames (pop-in) instead of holding up each frame. The crude existing A/B is VICTORY_PIPELINE_WAIT_MS=50.

  • make.rs: Pending gains first_wait: AtomicU64 (0: never waited, else frame+1). It is set with compare_exchange because up to five recording threads can wait for the same pipeline at once. It is set only when the pipeline actually waits, so a pipeline dropped on an already spent frame keeps its full first wait.
  • make.rs: wait_again_budget() (OnceLock) reads the switch. budget_for() picks the full or the again budget.
  • make.rs wait: the cap is applied to left before it is taken from the shared SPENT, so the give-back (left - waited) returns exactly what was taken. Screen passes keep screen_budget().
  • Default unchanged: with the switch unset, every frame waits as today.
  • Doesn't overlap #371, which changes pipeline/library.rs only. #229 caps the total wait per pipeline, but against main's older wait and on by default.

Testing

  • Windows CI (windows-latest): Clippy, default tests and diagnostics tests pass (run).
  • Type-checked for x86_64-pc-windows-msvc on a macOS host.
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings, with and without --all-features: clean.
  • Unit test later_frames_wait_the_again_budget added.
**@⁠Esteban-V** on GitHub · 2026-11-27 00:07 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/410) `Esteban-V:perf/pipeline-wait-again` → `a-publier` · +55 −1 · 1 files · 1 commits · open A frame waits up to `wait_budget()` (500 ms, `VICTORY_PIPELINE_WAIT_MS`, `crates/victory-gpu/src/pipeline/make.rs:361`) for the pipelines its draws need, and `wait` starts that budget again every frame (`make.rs:454`). So a pipeline that is still compiling costs up to 500 ms in every frame until it is made. One 3.4 s compile is about seven such frames, and docs/findings.md records 270-660 s of a session spent in frames over 200 ms while pipelines were being made. This PR adds `VICTORY_PIPELINE_WAIT_AGAIN_MS=<n>`. With it set, a pipeline still gets the full budget in the first frame that waits for it, then at most `n` ms in each later frame. The trade-off: a draw whose pipeline isn't ready is skipped for more frames (pop-in) instead of holding up each frame. The crude existing A/B is `VICTORY_PIPELINE_WAIT_MS=50`. - `make.rs`: `Pending` gains `first_wait: AtomicU64` (0: never waited, else frame+1). It is set with `compare_exchange` because up to five recording threads can wait for the same pipeline at once. It is set only when the pipeline actually waits, so a pipeline dropped on an already spent frame keeps its full first wait. - `make.rs`: `wait_again_budget()` (OnceLock) reads the switch. `budget_for()` picks the full or the again budget. - `make.rs` `wait`: the cap is applied to `left` before it is taken from the shared `SPENT`, so the give-back (`left - waited`) returns exactly what was taken. Screen passes keep `screen_budget()`. - Default unchanged: with the switch unset, every frame waits as today. - Doesn't overlap #371, which changes `pipeline/library.rs` only. #229 caps the total wait per pipeline, but against `main`'s older `wait` and on by default. ## Testing - Windows CI (`windows-latest`): Clippy, default tests and diagnostics tests pass ([run](https://github.com/Esteban-V/VIctory-Belobug-AMD/actions/runs/45916870443)). - Type-checked for `x86_64-pc-windows-msvc` on a macOS host. - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings`, with and without `--all-features`: clean. - Unit test `later_frames_wait_the_again_budget` added.
A frame waits up to the wait budget (500 ms) for the pipelines its draws
need, and the budget is new each frame: a pipeline still being made costs
up to half a second in every frame until it is made, about seven frames
for one 3.4 s compile.

With VICTORY_PIPELINE_WAIT_AGAIN_MS=<n>, a pipeline waits the full budget
in the first frame that waits for it and at most n ms in later ones, still
within what is left of the frame's shared budget. Passes over the screen
keep their own budget. Unset: as before.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:59:25 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 01:23 UTC · original

Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At 9654f6e: cargo test --release -p victory-gpu --lib 397 passed, 0 failed, 34 ignored.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 01:23 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/410#issuecomment-7207242639) Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At `9654f6e`: `cargo test --release -p victory-gpu --lib` 397 passed, 0 failed, 34 ignored. AI-assisted (Claude Code); no game data.
This pull request can be merged automatically.
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/410/head:github-bot/gh-410'
git switch 'github-bot/gh-410'

Merge

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