Pipeline wait: a pipeline still being made costs the full per-frame budget on every frame; a panic in a worker would leave it "being made" for good #217

Open
opened 2026-11-26 03:38:07 +00:00 by github-bot · 1 comment
Owner

@⁠j-fuxa on GitHub · 2026-11-26 01:41 UTC · original

What we found

pipeline::make::wait gives each title frame a budget (500 ms by default, VICTORY_PIPELINE_WAIT_MS; screen passes 10 s on rx9070xt, 20 s on main). The budget restarts every frame and nothing records that a given pipeline has already used a whole one: Pending has no waited-time field. A pipeline that takes longer than the budget, or sits behind long compiles, therefore costs up to a full budget on every frame that binds it, until it is made.

This is the behaviour in fxceless/victory-fork#1181 (4 pipelines "being made" for a whole session: 500 ms waited on every world frame, median 761 ms; with the wait set to 50 ms the median was 252 ms). Your own notes point the same way: the comment at make.rs 421-427 on rx9070xt records 2.5 s of waiting per frame before the budget was shared, and docs/findings.md lists 270-660 s of a session in frames over 200 ms, almost all while pipelines were made.

What we did

  • Per-pipeline cumulative waited time. Once a pipeline has used a full budget, later frames do not wait for it (the draw is dropped, as it already is when the frame's budget is spent) until it is made. No pipeline then costs more than one budget in total.
  • catch_unwind around the worker's make(): on a panic the pipeline is marked refused (made = none, waiters notified, counters released) and the worker survives. Without it a panic ends the worker thread and leaves the pipeline "being made" for the rest of the run, so the first problem applies to it forever and the pool is one worker smaller.
fn wait(p, frame):
    if p.waited >= budget: return          // paid once already
    ... wait up to min(frame_left, budget - p.waited) ...
    p.waited += time_waited

Where in your code

ready and wait in pipeline/make.rs (main 124-182, rx9070xt 392-496) and the worker loops (main 192-221, rx9070xt 681-699, where p.make() runs bare). The release profile does not set panic = "abort", so a panic unwinds. We have not seen a panic in make() on your build; that second point is from reading the code only.

Caveats

Dropping a draw sooner for a slow pipeline is the same trade as today once the budget is gone. Screen passes may want a larger per-pipeline allowance than ordinary ones.

**@⁠j-fuxa** on GitHub · 2026-11-26 01:41 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/217) **What we found** `pipeline::make::wait` gives each title frame a budget (500 ms by default, `VICTORY_PIPELINE_WAIT_MS`; screen passes 10 s on `rx9070xt`, 20 s on `main`). The budget restarts every frame and nothing records that a given pipeline has already used a whole one: `Pending` has no waited-time field. A pipeline that takes longer than the budget, or sits behind long compiles, therefore costs up to a full budget on every frame that binds it, until it is made. This is the behaviour in fxceless/victory-fork#1181 (4 pipelines "being made" for a whole session: 500 ms waited on every world frame, median 761 ms; with the wait set to 50 ms the median was 252 ms). Your own notes point the same way: the comment at `make.rs` 421-427 on `rx9070xt` records 2.5 s of waiting per frame before the budget was shared, and `docs/findings.md` lists 270-660 s of a session in frames over 200 ms, almost all while pipelines were made. **What we did** - Per-pipeline cumulative waited time. Once a pipeline has used a full budget, later frames do not wait for it (the draw is dropped, as it already is when the frame's budget is spent) until it is made. No pipeline then costs more than one budget in total. - `catch_unwind` around the worker's `make()`: on a panic the pipeline is marked refused (made = none, waiters notified, counters released) and the worker survives. Without it a panic ends the worker thread and leaves the pipeline "being made" for the rest of the run, so the first problem applies to it forever and the pool is one worker smaller. ``` fn wait(p, frame): if p.waited >= budget: return // paid once already ... wait up to min(frame_left, budget - p.waited) ... p.waited += time_waited ``` **Where in your code** `ready` and `wait` in `pipeline/make.rs` (`main` 124-182, `rx9070xt` 392-496) and the worker loops (`main` 192-221, `rx9070xt` 681-699, where `p.make()` runs bare). The release profile does not set `panic = "abort"`, so a panic unwinds. We have not seen a panic in `make()` on your build; that second point is from reading the code only. **Caveats** Dropping a draw sooner for a slow pipeline is the same trade as today once the budget is gone. Screen passes may want a larger per-pipeline allowance than ordinary ones.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:38:07 +00:00
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:53 UTC · original

Checked on main 4f62c2a with local unit tests: Windows 11, debug test build, no game, no real driver compile. Other heavy jobs were running on the machine at the same time.

One code detail not in the issue: worker_lost (make.rs 226) is called only by the compile watchdog (library.rs 279, 309). After a panic in make(), the pipeline is never marked lost, the AT_WORK entry stays, and WAITING is not decremented (211). The panic hook in victory-loader/src/crash.rs:60 only logs.

On rx9070xt (81ebb7b), from reading only: lost() (make.rs:280) is the only path that gives up on a pipeline, and only the access-violation handler reaches it (make.rs:229-273). So it does not cover a panic in make() there either.

Measured with the 500 ms ordinary budget:

  • A pipeline that is never made, wait on 4 frames: 511, 513, 512 and 512 ms, 2.05 s in total.
  • make() panics in a worker: each of 3 frames waited 511-516 ms. 10 s later the pipeline was still being made, lost was false, and waiting() was still 1.

#219 (head 978681c, base 4f62c2a):

  • Its test calls make_with on the test thread. I also sent a panic through a real worker on its head. The pipeline was refused within 55 us, waiting() went back to 0, and the pool made the next pipeline.
  • victory-gpu lib tests, 3 runs each, interleaved with main: the only failures were watch:: tests, in one run on each side. These are flaky on this machine under load.
  • It covers only the second point.

The first point is now covered by #229. I posted my results on it there. Together, #229 and #219 cover both points.

Not tested:

  • A game run.
  • A real slow or panicking driver compile.
  • Screen passes (20 s budget).
  • WARP / --features diagnostics tests.
  • A build of the rx9070xt branch.
**@⁠adrianmjim** on GitHub · 2026-11-26 19:53 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/217#issuecomment-7202065242) Checked on main 4f62c2a with local unit tests: Windows 11, debug test build, no game, no real driver compile. Other heavy jobs were running on the machine at the same time. One code detail not in the issue: `worker_lost` (`make.rs` 226) is called only by the compile watchdog (`library.rs` 279, 309). After a panic in `make()`, the pipeline is never marked `lost`, the `AT_WORK` entry stays, and `WAITING` is not decremented (211). The panic hook in `victory-loader/src/crash.rs:60` only logs. On `rx9070xt` (81ebb7b), from reading only: `lost()` (make.rs:280) is the only path that gives up on a pipeline, and only the access-violation handler reaches it (make.rs:229-273). So it does not cover a panic in `make()` there either. Measured with the 500 ms ordinary budget: - A pipeline that is never made, `wait` on 4 frames: 511, 513, 512 and 512 ms, 2.05 s in total. - `make()` panics in a worker: each of 3 frames waited 511-516 ms. 10 s later the pipeline was still being made, `lost` was false, and `waiting()` was still 1. #219 (head 978681c, base 4f62c2a): - Its test calls `make_with` on the test thread. I also sent a panic through a real worker on its head. The pipeline was refused within 55 us, `waiting()` went back to 0, and the pool made the next pipeline. - victory-gpu lib tests, 3 runs each, interleaved with main: the only failures were `watch::` tests, in one run on each side. These are flaky on this machine under load. - It covers only the second point. The first point is now covered by #229. I posted my results on it there. Together, #229 and #219 cover both points. Not tested: - A game run. - A real slow or panicking driver compile. - Screen passes (20 s budget). - WARP / `--features diagnostics` tests. - A build of the `rx9070xt` branch.
This discussion has been locked. Commenting is limited to contributors.
No description provided.