GPU: a slow-frame report that says what bound the frame and why (guard split out to #2911) #2721

Open
github-bot wants to merge 9 commits from github-bot/gh-2721 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 18:50 UTC · original
0xkn0wh3r3:gpu/frame-budget → main · +1025 −42 · 6 files · 9 commits · open

A report of each frame past 50 ms (at most one line a second, counting the others), saying what bound the frame and why in terms of any title. It also adds per-command GPU timing, which the report uses when VICTORY_FRAME_TIMING=1.

Split after review: the slow-pipeline guard that was part of this PR is now a separate opt-in PR stacked on this one (#2911). This PR drops no title work.

The slow frame line

  • bound: the frame's largest part, one of:
    • GPU;
    • outside submissions: the title's own work and the translation of its command-list calls;
    • title memory refresh;
    • copy-back;
    • texture uploads;
    • descriptor heap sync;
    • pipeline waits.
  • why, in a sentence. For a GPU-bound frame with timing on, it names the main kind of command and the ways of reaching memory most of the GPU time used, e.g. "80% of the timed GPU time is compute work (412 commands); 80% is in programs using title memory by address".
  • Each part's time: gpu_ms, outside_ms, ours_ms, refresh_ms, copy_back_ms, uploads_ms, heap_sync_ms, pipeline_waits_ms, and submissions.
  • With VICTORY_FRAME_TIMING=1:
    • gpu_by_kind: compute, mesh, indirect compute and indirect mesh, each with its time and count;
    • gpu_by_trait: time per way programs reach memory;
    • slowest: the three slowest commands with their group counts and traits.

Cost

  • The report: a few relaxed atomic adds per submission and swaps at a present. No lock, no GPU work.
  • Timing (off by default): two timestamps per compute dispatch and mesh draw. A list makes its query heap only at its first timed command and keeps it across resets, and only lists that timed something are read back. On an RTX 5070 Ti that's about 0.45 µs per timed command per execute.

Overlap

  • #130 (opt-in profiler) and #1735 (per-pipeline timing under VICTORY_GPU_TIMING, diagnostics) overlap with the timing.
  • This report runs in release builds and names causes. #1735 times whole lists one at a time in diagnostics builds.
  • If one of them lands first, the report can take its timings from it instead.

Tests

  • frame_budget:
    • the report starts over at each present, reports a slow frame and only counts the others within a second;
    • a frame names the part that bound it;
    • a GPU-bound frame names its main kind of command and its memory traits;
    • commands are described by kind, groups and traits;
    • a frame keeps its slowest commands;
    • with timing off, nothing is timed and no query heap is made;
    • a list makes its query heap once, at its first timed command;
    • a timed dispatch of a long loop measures far longer than one of a short loop.
  • cargo test -p victory-gpu --lib: everything passes except dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, which fail the same way on main on NVIDIA (fixed by #2121).
  • frame::tests::waits_end_on_ticks_and_count_frames failed once in a full run and passed alone (a 50 ms timing assertion).
  • Clippy is clean, with and without --features diagnostics.

Not run with the title.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721) `0xkn0wh3r3:gpu/frame-budget` → `main` · +1025 −42 · 6 files · 9 commits · open A report of each frame past 50 ms (at most one line a second, counting the others), saying what bound the frame and why in terms of any title. It also adds per-command GPU timing, which the report uses when `VICTORY_FRAME_TIMING=1`. Split after review: the slow-pipeline guard that was part of this PR is now a separate opt-in PR stacked on this one (#2911). This PR drops no title work. ## The `slow frame` line - **`bound`:** the frame's largest part, one of: - `GPU`; - `outside submissions`: the title's own work and the translation of its command-list calls; - `title memory refresh`; - `copy-back`; - `texture uploads`; - `descriptor heap sync`; - `pipeline waits`. - **`why`**, in a sentence. For a GPU-bound frame with timing on, it names the main kind of command and the ways of reaching memory most of the GPU time used, e.g. "80% of the timed GPU time is compute work (412 commands); 80% is in programs using title memory by address". - **Each part's time:** `gpu_ms`, `outside_ms`, `ours_ms`, `refresh_ms`, `copy_back_ms`, `uploads_ms`, `heap_sync_ms`, `pipeline_waits_ms`, and `submissions`. - **With `VICTORY_FRAME_TIMING=1`:** - `gpu_by_kind`: compute, mesh, indirect compute and indirect mesh, each with its time and count; - `gpu_by_trait`: time per way programs reach memory; - `slowest`: the three slowest commands with their group counts and traits. ## Cost - **The report:** a few relaxed atomic adds per submission and swaps at a present. No lock, no GPU work. - **Timing (off by default):** two timestamps per compute dispatch and mesh draw. A list makes its query heap only at its first timed command and keeps it across resets, and only lists that timed something are read back. On an RTX 5070 Ti that's about 0.45 µs per timed command per execute. ## Overlap - #130 (opt-in profiler) and #1735 (per-pipeline timing under `VICTORY_GPU_TIMING`, diagnostics) overlap with the timing. - This report runs in release builds and names causes. #1735 times whole lists one at a time in diagnostics builds. - If one of them lands first, the report can take its timings from it instead. ## Tests - `frame_budget`: - the report starts over at each present, reports a slow frame and only counts the others within a second; - a frame names the part that bound it; - a GPU-bound frame names its main kind of command and its memory traits; - commands are described by kind, groups and traits; - a frame keeps its slowest commands; - with timing off, nothing is timed and no query heap is made; - a list makes its query heap once, at its first timed command; - a timed dispatch of a long loop measures far longer than one of a short loop. - `cargo test -p victory-gpu --lib`: everything passes except `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`, which fail the same way on main on NVIDIA (fixed by #2121). - `frame::tests::waits_end_on_ticks_and_count_frames` failed once in a full run and passed alone (a 50 ms timing assertion). - Clippy is clean, with and without `--features diagnostics`. Not run with the title.
At 30 frames a second a frame has 33.3 ms. A world frame takes about a
second on current main, and one submission of a few slow passes stops
the title's thread until the GPU is done with it (`Host::execute` waits),
or, past about 2 s, resets the device. Nothing said where a frame's time
went, and a pipeline that is slow on this host ran again every frame.

`crate::budget`:

- Compute dispatches and mesh draws, direct and indirect, are timed on
  the GPU: a timestamp before and after each (`HostList::time_start`,
  `time_end`), resolved when the list closes, read when it has run
  (1,024 timestamps a list; commands past them are not timed). Commands
  other than these are not timed.
- A frame (present to present) past 50 ms is reported, at most one line
  a second with a count of the others: its time, ours before its
  submissions (copies, uploads), the GPU's, pipeline waits, submissions,
  its three slowest timed commands and what the guard dropped.
- The slow-pipeline guard: a pipeline one of whose commands took longer
  than the limit three times is not run any more (`State::bind` drops
  its draws and dispatches as it does others that cannot run), said once
  with the pipeline. What it computes is then missing: visible, logged,
  and the world keeps moving. `VICTORY_SLOW_PIPELINE_MS` sets the limit
  (100 ms); `VICTORY_SLOW_PIPELINES=0` turns timing and the guard off.

Tests (`budget::tests`): a pipeline is dropped after its strikes and not
before, and only it; a frame keeps its slowest commands; frames start
over at each present; on the host GPU a timed dispatch of a long loop
measures far longer than one of a short loop (0.80 ms against 0.009 ms
on an RTX 5070 Ti). Not measured in a title run.

Seen once in five full runs of the GPU tests here, not in eight others
or in three on main: `host::title_copies::copy_back_writes_mapped_pages_only`
failing (it passed five runs alone); `frame::tests::waits_end_on_ticks_and_count_frames`
failed once under load as well, a 50 ms timing check.
Another module of that name (a video memory budget) is in open PRs; the
frame budget's is named for what it keeps.
A pipeline backing several timed commands was banned within one frame
when each was over the limit, and a one-off hitch (a shader compiled
mid-frame) counted toward a ban for the rest of the session.

Strikes are now per frame (present to present): a frame in which any
of a pipeline's timed commands is over the limit is one strike, however
many were; a frame in which all of them kept to it clears its strikes;
frames in which it was not timed leave them. Three over-limit frames in
a row ban it. Only pipelines timed in a frame are kept for it, with
their slowest command, and tallied when it is presented.

The ban is checked in `State::bind` while recording, so a list closed
before it still runs the pipeline's commands each time it is submitted
again. The warning and the module's docs now say so: draws and
dispatches recorded from then on are dropped.

Tests: three slow commands in one frame do not ban; slow, quick, slow,
slow frames do not; three slow frames in a row do, when the third ends
and not before, and only that pipeline. On the host GPU, a list closed
before its pipeline's ban writes again when resubmitted, and one
recorded after it holds no dispatch (`State::bind` refuses it).
With VICTORY_SLOW_PIPELINES=0 nothing is timed: no timestamps are
recorded, no query heap or read-back buffer is made, no timestamp is
read back, and the guard's lock is never taken. The slow-frame report
keeps running without GPU timing: its tallies are atomics, a few relaxed
adds a submission and swaps at a present, so submissions, waits and
presents take no lock whether the guard is on or off.

With the guard on, a list makes its query heap at its first timed
command (a list that times none never makes one; before, every list
executed made one) and keeps it across resets; only lists that timed
commands are read back, under one lock a list; the queue's timestamp
frequency is asked once.

Pipelines are not struck in the first 10 frames after they are first
timed (first-use hitches). A ban lasts 60 s; the pipeline is then tried
again, said once. Still over the limit 3 frames in a row, it is banned
again for twice as long (up to 16 minutes), said once; a frame within
the limit keeps it and forgets its bans.
The report named the frame's time, ours, the GPU's and pipeline waits,
and the slowest commands by their shader hashes: enough to see that a
frame was slow, not what made it so.

It now splits the frame into its parts and names the largest as what
bound it, with why:

- our work around submissions, each phase on its own: descriptor heap
  sync (and evictions), texture uploads, refreshing host copies of title
  memory, and copy-back of what shaders wrote;
- the GPU's;
- pipeline waits;
- the rest ("outside submissions"): the title's own work on its threads
  and the translation of its command-list calls as it makes them.

With the guard on, the GPU's part is broken down by kind of command
(compute, mesh, and their indirect forms: time and count) and by how
the commands' programs reach memory: title memory by address through
the page table (whose writes set bitmap bits with atomics), write marks
through views, views picked from the heap, view addresses read. The
slowest commands are described the same way, with their group counts:
"600 ms compute 1024x1x1 groups [title memory by address] [compute ..]".

A GPU-bound frame's why reads, for example, "80% of the timed GPU time
is compute work (412 commands); 80% is in programs using title memory
by address". Nothing in it depends on a particular title.

The phases are a few Instant reads per submission and relaxed atomic
adds, as before; with the guard off nothing is timed or locked.
Conflicts: draw.rs (main's new placed-texture tests beside the guard's
test, both kept) and host.rs (main's multi-plane present; the frame
budget's present hook moves into its new present()).
It drops title work, so it is opt-in (review). Commands are timed for the
slow-frame report with the guard, or with VICTORY_FRAME_TIMING=1; without
the guard timed commands strike nothing. Comments trimmed.
Review: per-command GPU timing, the slow-frame report and the slow-
pipeline guard were one change. This PR keeps the report and the timing
it uses (VICTORY_FRAME_TIMING=1 for the GPU breakdown); the guard, which
drops title work, is a separate opt-in PR stacked on this one.
Review (fuzeofficlal): it named the guard's switch, which no longer times
commands.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:45 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 18:57 UTC · original

The guard checks skips() in State::bind while recording. If one closed list with a slow dispatch is submitted three times and exceeds the limit each time, the pipeline is banned. Submitting that same list a fourth time still runs the dispatch because submission reuses the recorded commands without calling bind again.

Could the warning and PR description say the guard skips newly recorded commands? Resubmitting a closed list after its pipeline is banned would make a focused regression test for that boundary.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-25 18:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7171639124) The guard checks `skips()` in `State::bind` while recording. If one closed list with a slow dispatch is submitted three times and exceeds the limit each time, the pipeline is banned. Submitting that same list a fourth time still runs the dispatch because submission reuses the recorded commands without calling `bind` again. Could the warning and PR description say the guard skips newly recorded commands? Resubmitting a closed list after its pipeline is banned would make a focused regression test for that boundary. *AI-assisted with Codex.*
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 19:00 UTC · original

Well-instrumented and honest about the trade-off (fences/copies still run so nothing waits forever; the warn names the pipeline once). Two design points worth a second look:

  1. Strikes are counted per command, not per frame - a pipeline backing three timed commands that each exceed the limit is banned after a single frame. If the intent is 'slow three times across frames', consider one strike per frame per pipeline.

  2. Default-on with a hard 100 ms cutoff permanently drops pipelines on genuinely slow hosts (a world frame is ~1 s on current main). Missing output is arguably better than a device reset, but a banned compute pipeline's results are gone for the whole session - a counter of consecutive over-limit frames (so one-off spikes like shader-compile hitch doesn't accrue) might ban less aggressively. VICTORY_SLOW_PIPELINES=0 escape hatch is good.

skips()/ANY_BANNED fast-path and the per-list timestamp cap (1024, resolved at close) look right; skipped counting inside the mutex is correct.

**@⁠kotekompotek** on GitHub · 2026-11-25 19:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7171687260) Well-instrumented and honest about the trade-off (fences/copies still run so nothing waits forever; the warn names the pipeline once). Two design points worth a second look: 1. Strikes are counted per *command*, not per frame - a pipeline backing three timed commands that each exceed the limit is banned after a single frame. If the intent is 'slow three times across frames', consider one strike per frame per pipeline. 2. Default-on with a hard 100 ms cutoff permanently drops pipelines on genuinely slow hosts (a world frame is ~1 s on current main). Missing output is arguably better than a device reset, but a banned compute pipeline's results are gone for the whole session - a counter of consecutive over-limit frames (so one-off spikes like shader-compile hitch doesn't accrue) might ban less aggressively. VICTORY_SLOW_PIPELINES=0 escape hatch is good. skips()/ANY_BANNED fast-path and the per-list timestamp cap (1024, resolved at close) look right; skipped counting inside the mutex is correct.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 19:08 UTC · original

Thanks both. Fixed in de01ee6.

@⁠DrDarkDK Agreed: the ban is checked when commands are recorded, not when they are submitted. The warning, module docs and description now say that draws and dispatches recorded after the ban are dropped, and that lists recorded before it still run the pipeline when resubmitted.

draw::tests::a_banned_pipeline_is_dropped_from_lists_recorded_after_the_ban pins this through State::bind on the host GPU:

  • a list closed before the ban writes again when resubmitted;
  • a list recorded after the ban has no dispatch.

Submission itself is unchanged.

@⁠kotekompotek Both points are done:

  • Per frame: strikes now count frames (present to present). Any number of over-limit commands from one pipeline in a frame is one strike.
  • Consecutive frames: a frame in which all of the pipeline's timed commands keep to the limit clears its strikes, so a one-off hitch such as a shader compile doesn't add up. Three over-limit frames in a row ban it. A frame in which the pipeline isn't timed leaves its strikes alone.

Only pipelines timed in a frame are tracked. New tests cover three slow commands in one frame (no ban), slow, quick, slow, slow (no ban), and three slow frames in a row (banned when the third frame ends). One consequence is now in the description: strikes are tallied at presents, so work never followed by a present bans nothing.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 19:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7171878741) Thanks both. Fixed in de01ee6. **@⁠DrDarkDK** Agreed: the ban is checked when commands are recorded, not when they are submitted. The warning, module docs and description now say that draws and dispatches recorded after the ban are dropped, and that lists recorded before it still run the pipeline when resubmitted. `draw::tests::a_banned_pipeline_is_dropped_from_lists_recorded_after_the_ban` pins this through `State::bind` on the host GPU: - a list closed before the ban writes again when resubmitted; - a list recorded after the ban has no dispatch. Submission itself is unchanged. **@⁠kotekompotek** Both points are done: - **Per frame:** strikes now count frames (present to present). Any number of over-limit commands from one pipeline in a frame is one strike. - **Consecutive frames:** a frame in which all of the pipeline's timed commands keep to the limit clears its strikes, so a one-off hitch such as a shader compile doesn't add up. Three over-limit frames in a row ban it. A frame in which the pipeline isn't timed leaves its strikes alone. Only pipelines timed in a frame are tracked. New tests cover three slow commands in one frame (no ban), slow, quick, slow, slow (no ban), and three slow frames in a row (banned when the third frame ends). One consequence is now in the description: strikes are tallied at presents, so work never followed by a present bans nothing.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 19:41 UTC · original

Independent WARP/CPU verification for head de01ee6568 against origin/main 13f91caee2. State check: open, non-draft, clean merge-tree; no oni-swr comment found.

Environment: Windows x64, Rust 1.98.1 (48a229cea 2026-09-01), Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11); WARP/D3D12 WARP env vars set; CARGO_TARGET_DIR=D:\victory-warp-2720-target.

Commands/results:

  • Baseline: cargo test --locked -p victory-gpu --lib — 195 passed, 0 failed, 1 ignored; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings — pass.
  • PR: cargo test --locked -p victory-gpu frame_budget::tests:: — 6 passed; cargo test --locked -p victory-gpu --lib — 202 passed, 0 failed, 1 ignored; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings — pass; same Clippy command with --features diagnostics — pass.
  • Negative control: disabled timestamp start in time_start; timed_dispatches_measure_their_gpu_time failed as expected.

Review: the frame-level strikes and pre-recorded-list boundary match the documented behavior; no additional blocker found.

Not tested: physical GPU, retail title/game behavior, release build. AI disclosure: Codex (gpt-6-luna).

**@⁠oni-swr** on GitHub · 2026-11-25 19:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7172640664) Independent WARP/CPU verification for head de01ee6568f652b6dc80d2e43bb27d74b149f1dd against origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca. State check: open, non-draft, clean merge-tree; no oni-swr comment found. Environment: Windows x64, Rust 1.98.1 (48a229cea 2026-09-01), Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11); WARP/D3D12 WARP env vars set; CARGO_TARGET_DIR=D:\victory-warp-2720-target. Commands/results: - Baseline: cargo test --locked -p victory-gpu --lib — 195 passed, 0 failed, 1 ignored; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings — pass. - PR: cargo test --locked -p victory-gpu frame_budget::tests:: — 6 passed; cargo test --locked -p victory-gpu --lib — 202 passed, 0 failed, 1 ignored; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings — pass; same Clippy command with --features diagnostics — pass. - Negative control: disabled timestamp start in time_start; timed_dispatches_measure_their_gpu_time failed as expected. Review: the frame-level strikes and pre-recorded-list boundary match the documented behavior; no additional blocker found. Not tested: physical GPU, retail title/game behavior, release build. AI disclosure: Codex (gpt-6-luna).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:46 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of de01ee6 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo xtask policy: 185 files ok; cargo clippy --locked -p victory-gpu --all-targets (default & --features diagnostics): 0 warnings.
  • RTX 5090: frame_budget::tests 6 passed, 0 failed (including real GPU timed_dispatches_measure_their_gpu_time); draw::tests::a_banned_pipeline_is_dropped_from_lists_recorded_after_the_ban 1 passed.
  • WARP (VICTORY_D3D12_WARP=1): cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1 -> 205 passed, 0 failed, 1 ignored.

Review Notes

  • Arithmetic and concurrency mechanics look clean (saturating_sub, frequency.max(1), 512-command cap per list, ANY_BANNED relaxed fast path, HostList::reset clearing timed).
  • Design points for maintainers to weigh:
    • VICTORY_SLOW_PIPELINES currently defaults on (is_none_or(|v| v != "0")), meaning every non-diagnostics release build lazily allocates a 1024-entry timestamp query heap + 8 KiB readback buffer per HostList executing compute/mesh/indirect dispatches and calls GetTimestampFrequency() + Map/Unmap on every Host::execute(). Even with VICTORY_SLOW_PIPELINES=0, submitted()/waited()/presented() still take the global STATE mutex.
    • Banning after 3 consecutive >100 ms frames is currently permanent with no cooldown or warmup grace period, which could permanently silence legitimate slow pipelines on slower GPUs or WARP.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7172744296) Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of `de01ee6` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo xtask policy`: **185 files ok**; `cargo clippy --locked -p victory-gpu --all-targets` (default & `--features diagnostics`): **0 warnings**. - **RTX 5090:** `frame_budget::tests` **6 passed, 0 failed** (including real GPU `timed_dispatches_measure_their_gpu_time`); `draw::tests::a_banned_pipeline_is_dropped_from_lists_recorded_after_the_ban` **1 passed**. - **WARP (`VICTORY_D3D12_WARP=1`):** `cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1` -> **205 passed, 0 failed, 1 ignored**. ### Review Notes - Arithmetic and concurrency mechanics look clean (`saturating_sub`, `frequency.max(1)`, 512-command cap per list, `ANY_BANNED` relaxed fast path, `HostList::reset` clearing `timed`). - **Design points for maintainers to weigh:** - `VICTORY_SLOW_PIPELINES` currently defaults **on** (`is_none_or(|v| v != "0")`), meaning every non-`diagnostics` release build lazily allocates a 1024-entry timestamp query heap + 8 KiB readback buffer per `HostList` executing compute/mesh/indirect dispatches and calls `GetTimestampFrequency()` + `Map`/`Unmap` on every `Host::execute()`. Even with `VICTORY_SLOW_PIPELINES=0`, `submitted()`/`waited()`/`presented()` still take the global `STATE` mutex. - Banning after 3 consecutive >100 ms frames is currently permanent with no cooldown or warmup grace period, which could permanently silence legitimate slow pipelines on slower GPUs or WARP.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 20:15 UTC · original

Thanks @⁠fuzeofficlal, and thanks @⁠oni-swr for the WARP run and the negative control. Both points are addressed in ecb7640.

Cost. With VICTORY_SLOW_PIPELINES=0 nothing is timed:

  • no timestamps, query heap, read-back or Map;
  • the guard's lock is never taken, just one relaxed atomic load.

The slow-frame report stays on, but it needs no GPU timing and takes no lock; its tallies are atomics.

With the guard on:

  • a list makes its heap only at its first timed command, and keeps it across resets;
  • only lists that timed something are read back;
  • the timestamp frequency is cached.

This also fixed a real bug: before, every executed list made a heap. On an RTX 5070 Ti, in a release build:

guard off guard on
execute a list of 64 back-to-back dispatches 132–137 µs 161–166 µs
execute a list with nothing timed 132–136 µs 133–136 µs

That's about 0.45 µs per timed command, mostly the GPU writing the timestamps. Recording costs about 0.25 µs per timed command. So the guard stays on by default; the table is in the description.

Permanent bans:

  • A pipeline takes no strikes in its first 10 frames.
  • A ban lasts 60 s, and then the pipeline is tried again.
  • If it is still over the limit for 3 frames in a row, the ban doubles, up to 16 min.
  • One frame within the limit keeps it allowed.

The retry and the re-ban are each logged once. New tests cover the warm-up, the retry and re-ban through to the cap, a retried pipeline that is now quick staying allowed, and the off path never taking the lock or making a heap.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 20:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7173410955) Thanks @⁠fuzeofficlal, and thanks @⁠oni-swr for the WARP run and the negative control. Both points are addressed in ecb7640. **Cost.** With `VICTORY_SLOW_PIPELINES=0` nothing is timed: - no timestamps, query heap, read-back or `Map`; - the guard's lock is never taken, just one relaxed atomic load. The slow-frame report stays on, but it needs no GPU timing and takes no lock; its tallies are atomics. With the guard on: - a list makes its heap only at its first timed command, and keeps it across resets; - only lists that timed something are read back; - the timestamp frequency is cached. This also fixed a real bug: before, every executed list made a heap. On an RTX 5070 Ti, in a release build: | | guard off | guard on | |---|---|---| | execute a list of 64 back-to-back dispatches | 132–137 µs | 161–166 µs | | execute a list with nothing timed | 132–136 µs | 133–136 µs | That's about 0.45 µs per timed command, mostly the GPU writing the timestamps. Recording costs about 0.25 µs per timed command. So the guard stays on by default; the table is in the description. **Permanent bans:** - A pipeline takes no strikes in its first 10 frames. - A ban lasts 60 s, and then the pipeline is tried again. - If it is still over the limit for 3 frames in a row, the ban doubles, up to 16 min. - One frame within the limit keeps it allowed. The retry and the re-ban are each logged once. New tests cover the warm-up, the retry and re-ban through to the cap, a retried pipeline that is now quick staying allowed, and the off path never taking the lock or making a heap.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:19 UTC · original · edited 2026-11-26 02:19 UTC

Automated triage for the maintainers.

Thanks, both earlier points are addressed: the slow-pipeline guard is now the separate opt-in #2911, and this PR no longer drops title work. What remains is the slow-frame report (crates/victory-gpu/src/frame_budget.rs) and an opt-in per-command timing (VICTORY_FRAME_TIMING=1, HostList::time_start/time_end in host.rs, hooked into dispatches, mesh draws and indirect dispatch/mesh in draw.rs). With the switch off this is counters only, which is behaviour-neutral by my reading.

Still needs work, for one concrete reason: main already has per-command GPU timestamps under VICTORY_GPU_TIMING in host.rs (the timed-list path around Host::execute and the EndQuery/ResolveQueryData code), documented in the README switch table. This PR adds a second, parallel timestamp mechanism with its own query heaps and readback (≈1,000 lines in total). What would change the verdict:

  • build the gpu_by_kind / gpu_by_trait / slowest breakdown on the existing VICTORY_GPU_TIMING timestamps, or explain in the PR why they cannot serve (and then make the two switches one), and
  • document whichever switch remains in the README table and read it with crate::switch::on like the other VICTORY_* switches (frame_budget::timing compares to "1" by hand).

CI (check) passes.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7177413786) · edited 2026-11-26 02:19 UTC <!-- victory-triage v1 head=16aa2a49b7f8c4725f9ee4cce1580eb3f6f0eb9f verdict=needs-work at=2026-11-26T02:19:00Z --> Automated triage for the maintainers. Thanks, both earlier points are addressed: the slow-pipeline guard is now the separate opt-in #2911, and this PR no longer drops title work. What remains is the slow-frame report (`crates/victory-gpu/src/frame_budget.rs`) and an opt-in per-command timing (`VICTORY_FRAME_TIMING=1`, `HostList::time_start`/`time_end` in `host.rs`, hooked into dispatches, mesh draws and indirect dispatch/mesh in `draw.rs`). With the switch off this is counters only, which is behaviour-neutral by my reading. Still **needs work**, for one concrete reason: `main` already has per-command GPU timestamps under `VICTORY_GPU_TIMING` in `host.rs` (the timed-list path around `Host::execute` and the `EndQuery`/`ResolveQueryData` code), documented in the README switch table. This PR adds a second, parallel timestamp mechanism with its own query heaps and readback (≈1,000 lines in total). What would change the verdict: - build the `gpu_by_kind` / `gpu_by_trait` / `slowest` breakdown on the existing `VICTORY_GPU_TIMING` timestamps, or explain in the PR why they cannot serve (and then make the two switches one), and - document whichever switch remains in the README table and read it with `crate::switch::on` like the other `VICTORY_*` switches (`frame_budget::timing` compares to `"1"` by hand). CI (`check`) passes. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:01 UTC · original

Both points are addressed in 1252f747.

  • Guard: split out into #2911 (stacked on this one) and now opt-in. It does nothing unless VICTORY_SLOW_PIPELINES=1, so no title work is dropped by default.
  • Scope: this PR is now the slow-frame report only. Per-command GPU timing is opt-in with VICTORY_FRAME_TIMING=1. The module comment and constant rationales are trimmed to say what the code does. The description names #130 and #1735 and how this relates to them.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2721#issuecomment-7178309592) Both points are addressed in 1252f747. - **Guard:** split out into #2911 (stacked on this one) and now opt-in. It does nothing unless `VICTORY_SLOW_PIPELINES=1`, so no title work is dropped by default. - **Scope:** this PR is now the slow-frame report only. Per-command GPU timing is opt-in with `VICTORY_FRAME_TIMING=1`. The module comment and constant rationales are trimmed to say what the code does. The description names #130 and #1735 and how this relates to them.
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/2721/head:github-bot/gh-2721'
git switch 'github-bot/gh-2721'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2721'
git switch 'github-bot/gh-2721'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2721'
git switch 'github-bot/gh-2721'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2721'
git switch 'main'
git merge --squash 'github-bot/gh-2721'
git switch 'main'
git merge --ff-only 'github-bot/gh-2721'
git switch 'main'
git merge 'github-bot/gh-2721'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2721
No description provided.