GPU: dropped draws say whether their pipeline was refused or is still being made #3166

Open
pablogonz12 wants to merge 2 commits from upstream-pr/3168 into main
pablogonz12 commented 2026-11-26 10:50:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-26T10:50:48Z.


What

draw::State drops a draw or dispatch that has no host pipeline, and the frame line said only how many of them: dropped 4440 without a host pipeline (4 being made). One number reads the same for two very different states: a pipeline whose shaders do not translate, whose draws are lost every frame to the end of the run, and one still being made, which costs its draws one frame. The per-reason lines that tell them apart (dropped N/frame without a host pipeline: <reason>) are printed only by a diagnostics build, so a plain run cannot say why it is dropping.

pipeline::note_drop now counts in every build, on one of two sides, from what the pending pipeline actually holds: refused (a shader did not translate, the host driver declined to make it, or no pipeline is set at all) and waiting (still being made). take_dropped_split() returns [refused, waiting], and the frame line prints both:

dropped 4440 without a host pipeline (4393 refused, 47 waiting for one, 4 being made) and ...

The drop sites in draw.rs count in every build now (the DROPPED trace marker stays inside diagnostics), which is what feeds the counters.

Counters and log text only: no behaviour change, so no off switch — a run that wants the old text reads the first number, which is unchanged.

Test

a_refused_pipeline_counts_its_drops_apart_from_one_still_being_made (crates/victory-gpu/src/pipeline.rs): a pipeline hand-built from junk shader words (no game data, no card involved) is counted as waiting while it is unmade, made on the spot (Pending::now) it is refused on the junk container and counted as refused, and a draw with no pipeline set at all counts as refused too — take_dropped_split() gives [0,1] and then [2,0].

Numbers

  • cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean, and the same with --features victory-gpu/diagnostics.
  • victory-gpu tests under Wine (GE-Proton11-14, --test-threads=1): 232 passed, 0 failed, 1 ignored.
  • Not run in a title on this machine for this change; it is a counter and a log line, and the counters were only read from the test above.

Other hardware

Counting and one log line: no shader translation, no heap layout and no GPU object changes, so every adapter takes exactly the path it took before. The counters are plain relaxed atomics, as the diagnostics counters already were, and the split is read once per report. Not tested on NVIDIA hardware; nothing in the diff reads an adapter, vendor or driver, but a log line from a Windows/NVIDIA run of the new frame line would confirm the text there.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5508636127 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3168). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-26T10:50:48Z. --- ## What `draw::State` drops a draw or dispatch that has no host pipeline, and the frame line said only how many of them: `dropped 4440 without a host pipeline (4 being made)`. One number reads the same for two very different states: a pipeline whose shaders do not translate, whose draws are lost every frame to the end of the run, and one still being made, which costs its draws one frame. The per-reason lines that tell them apart (`dropped N/frame without a host pipeline: <reason>`) are printed only by a `diagnostics` build, so a plain run cannot say why it is dropping. `pipeline::note_drop` now counts in every build, on one of two sides, from what the pending pipeline actually holds: **refused** (a shader did not translate, the host driver declined to make it, or no pipeline is set at all) and **waiting** (still being made). `take_dropped_split()` returns `[refused, waiting]`, and the frame line prints both: ``` dropped 4440 without a host pipeline (4393 refused, 47 waiting for one, 4 being made) and ... ``` The drop sites in `draw.rs` count in every build now (the `DROPPED` trace marker stays inside `diagnostics`), which is what feeds the counters. Counters and log text only: no behaviour change, so no off switch — a run that wants the old text reads the first number, which is unchanged. ## Test `a_refused_pipeline_counts_its_drops_apart_from_one_still_being_made` (`crates/victory-gpu/src/pipeline.rs`): a pipeline hand-built from junk shader words (no game data, no card involved) is counted as **waiting** while it is unmade, made on the spot (`Pending::now`) it is refused on the junk container and counted as **refused**, and a draw with no pipeline set at all counts as refused too — `take_dropped_split()` gives `[0,1]` and then `[2,0]`. ## Numbers - `cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings`: clean, and the same with `--features victory-gpu/diagnostics`. - victory-gpu tests under Wine (GE-Proton11-14, `--test-threads=1`): **232 passed, 0 failed, 1 ignored**. - Not run in a title on this machine for this change; it is a counter and a log line, and the counters were only read from the test above. ## Other hardware Counting and one log line: no shader translation, no heap layout and no GPU object changes, so every adapter takes exactly the path it took before. The counters are plain relaxed atomics, as the `diagnostics` counters already were, and the split is read once per report. Not tested on NVIDIA hardware; nothing in the diff reads an adapter, vendor or driver, but a log line from a Windows/NVIDIA run of the new frame line would confirm the text there.
Dukestar69 commented 2026-11-26 11:08:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T11:08:54Z.

Review: APPROVED


Verified on RTX 5090 against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1: 24/24 passed (including a_refused_pipeline_counts_its_drops_apart_from_one_still_being_made).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly distinguishes refused pipelines from still-compiling pipelines in dropped-draw reporting.

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

<!-- greyfinch-sync:Marvisak/VIctory:review:6073074396 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3168#pullrequestreview-6073074396). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T11:08:54Z. **Review:** APPROVED --- Verified on RTX 5090 against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1`: 24/24 passed (including `a_refused_pipeline_counts_its_drops_apart_from_one_still_being_made`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly distinguishes refused pipelines from still-compiling pipelines in dropped-draw reporting. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Jackster commented 2026-11-26 23:02:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T23:02:19Z.


Windows 11, 63bcca4 + this PR, Radeon RX 7900 XTX:

  • cargo test -p victory-gpu --lib: 232 passed / 0 failed / 1 ignored (unpatched 63bcca4 here: 231).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.

a_refused_pipeline_counts_its_drops_apart_from_one_still_being_made passes; the frame-line drop tests are unchanged. Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7205199625 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3168#issuecomment-7205199625). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T23:02:19Z. --- Windows 11, `63bcca4` + this PR, Radeon RX 7900 XTX: - `cargo test -p victory-gpu --lib`: 232 passed / 0 failed / 1 ignored (unpatched `63bcca4` here: 231). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. `a_refused_pipeline_counts_its_drops_apart_from_one_still_being_made` passes; the frame-line drop tests are unchanged. Synthetic only. AI-assisted.
fuzeofficlal commented 2026-11-27 00:16:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T00:16:04Z.

Review: CHANGES_REQUESTED


Tested 9cd45776da512f52adcba85eb96e5b78e8ab6bc4 with cargo xtask policy, cargo clippy --tests (default and --features diagnostics), pipeline::tests, and live probes on RTX 5090 and WARP (VICTORY_D3D12_DEBUG=1).

pipeline::absent / Pending::made and the new unit test are clean, but two regressions/accounting bugs show up in draw.rs and host.rs:

  1. NOT_RUN is double-consumed under --features diagnostics, blanking every DROPPED ... () breadcrumb (crates/victory-gpu/src/draw.rs:169-204)

    • dropped() calls count_dropped() at line 170, which unconditionally executes let why = NOT_RUN.with(|w| w.replace("")); at line 192.
    • Immediately afterward, dropped() calls let why = NOT_RUN.with(|w| w.replace("")); a second time at line 173, which now always returns "". As a result, list.note_op(...) (lines 174–179) always records "DROPPED {kind} () ..." with an empty reason instead of the actual not_run(...) message.
    • Confirmed live: after not_run("indexed rectangles") + count_dropped(0, "indexed"), NOT_RUN is already "" before line 173 runs.
    • Reading NOT_RUN once in dropped() (and passing why into count_dropped, or returning it from count_dropped) preserves both note_why and list.note_op.
  2. DROPPED_SPLIT (refused / waiting) counts execute_indirect drops that draw::DROPPED does not count (crates/victory-gpu/src/draw.rs:1729, 1753-1757, 1808-1819, crates/victory-gpu/src/host.rs:3073-3086, crates/victory-gpu/src/list.rs:1625-1638)

    • State::execute_indirect calls crate::pipeline::note_drop (incrementing DROPPED_SPLIT) when there is no host pipeline (line 1754, plus lines 1729 and 1810 under diagnostics), while its caller list.rs:1638 increments list::INDIRECT rather than draw::DROPPED.
    • Meanwhile host.rs:3081-3083 prints:
      dropped {dropped:.0} without a host pipeline ({refused:.0} refused, {waiting:.0} waiting for one, {making} being made) and {indirect:.0} indirect
      which presents (refused, waiting) as a breakdown of {dropped}.
    • Confirmed live (both default and --features diagnostics builds on RTX 5090 and WARP): 1 direct dropped dispatch + 5 dropped indirect calls produces draw::take_dropped() == 1 alongside pipeline::take_dropped_split() == [6, 0] (refused + waiting exceeds dropped by 6×; on frames dropping ~1,500 indirect calls this makes the parenthetical breakdown wildly larger than dropped).
    • Also note that draw.rs:1810 only calls note_drop under #[cfg(feature = "diagnostics")], making the split inconsistent between default and diagnostic builds. Please either keep indirect drops out of DROPPED_SPLIT (or track them separately) or reword the log format so the (refused, waiting) split explicitly covers direct + indirect drops together consistently across builds.
<!-- greyfinch-sync:Marvisak/VIctory:review:6081899633 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3168#pullrequestreview-6081899633). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T00:16:04Z. **Review:** CHANGES_REQUESTED --- Tested `9cd45776da512f52adcba85eb96e5b78e8ab6bc4` with `cargo xtask policy`, `cargo clippy --tests` (default and `--features diagnostics`), `pipeline::tests`, and live probes on RTX 5090 and WARP (`VICTORY_D3D12_DEBUG=1`). `pipeline::absent` / `Pending::made` and the new unit test are clean, but two regressions/accounting bugs show up in `draw.rs` and `host.rs`: 1. **`NOT_RUN` is double-consumed under `--features diagnostics`, blanking every `DROPPED ... ()` breadcrumb (`crates/victory-gpu/src/draw.rs:169-204`)** - `dropped()` calls `count_dropped()` at line 170, which unconditionally executes `let why = NOT_RUN.with(|w| w.replace(""));` at line 192. - Immediately afterward, `dropped()` calls `let why = NOT_RUN.with(|w| w.replace(""));` a second time at line 173, which now always returns `""`. As a result, `list.note_op(...)` (lines 174–179) always records `"DROPPED {kind} () ..."` with an empty reason instead of the actual `not_run(...)` message. - Confirmed live: after `not_run("indexed rectangles")` + `count_dropped(0, "indexed")`, `NOT_RUN` is already `""` before line 173 runs. - Reading `NOT_RUN` once in `dropped()` (and passing `why` into `count_dropped`, or returning it from `count_dropped`) preserves both `note_why` and `list.note_op`. 2. **`DROPPED_SPLIT` (`refused` / `waiting`) counts `execute_indirect` drops that `draw::DROPPED` does not count (`crates/victory-gpu/src/draw.rs:1729, 1753-1757, 1808-1819`, `crates/victory-gpu/src/host.rs:3073-3086`, `crates/victory-gpu/src/list.rs:1625-1638`)** - `State::execute_indirect` calls `crate::pipeline::note_drop` (incrementing `DROPPED_SPLIT`) when there is no host pipeline (line 1754, plus lines 1729 and 1810 under `diagnostics`), while its caller `list.rs:1638` increments `list::INDIRECT` rather than `draw::DROPPED`. - Meanwhile `host.rs:3081-3083` prints: `dropped {dropped:.0} without a host pipeline ({refused:.0} refused, {waiting:.0} waiting for one, {making} being made) and {indirect:.0} indirect` which presents `(refused, waiting)` as a breakdown of `{dropped}`. - Confirmed live (both default and `--features diagnostics` builds on RTX 5090 and WARP): 1 direct dropped dispatch + 5 dropped indirect calls produces `draw::take_dropped() == 1` alongside `pipeline::take_dropped_split() == [6, 0]` (`refused + waiting` exceeds `dropped` by 6×; on frames dropping ~1,500 indirect calls this makes the parenthetical breakdown wildly larger than `dropped`). - Also note that `draw.rs:1810` only calls `note_drop` under `#[cfg(feature = "diagnostics")]`, making the split inconsistent between default and diagnostic builds. Please either keep indirect drops out of `DROPPED_SPLIT` (or track them separately) or reword the log format so the `(refused, waiting)` split explicitly covers direct + indirect drops together consistently across builds.
pablogonz12 commented 2026-11-27 10:34:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-27T10:34:52Z.


Both are real. Fixed in 9c1fac9b1, one commit on top of 9cd45776d.

  1. NOT_RUN read once. count_dropped now returns the reason it read and the trace formats that (draw.rs:172, :191); the second read in dropped() is gone. So DROPPED ... (...) carries the not_run(...) text again instead of ().
  2. Indirect drops counted in every build. The note_drop for an indirect call that finds no host pipeline moved out of the #[cfg(feature = "diagnostics")] block (draw.rs:1826); only the note_op breadcrumb stays behind the feature. draw::DROPPED still counts direct drops alone, so the frame line no longer presents the split as its breakdown: it now reads dropped N without a host pipeline and M indirect not run: R refused, W waiting for one, K being made (both counts together) (host.rs:3081), and take_dropped_split's doc says the same (pipeline.rs:341). I kept one counter for both paths rather than a second split for indirect calls, since the question the line answers is "how much of this frame is waiting on a pipeline".

Tested on RX 9070 XT (RDNA4), Mesa 26.3.1 RADV, this tree at 9c1fac9b1:

  • cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean.
  • cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean, and clean again with --features victory-gpu/diagnostics.
  • cargo xtask policy: 191 files ok.
  • victory-gpu lib tests under Wine (GE-Proton11-14), --test-threads=1: 140 passed, 5 failed, then the process exits at queue::tests::aliased_present_planes_preserve_the_host_texture_state. Those 5 (dynamic_slots_are_held_until_released, a_texture_written_in_one_format_reads_in_another_through_a_placed_view, lists_share_a_table_and_copies_keep_their_views, a_rejected_blob_gives_an_empty_library, pipelines_load_on_many_threads_at_once) fail on base 63bcca43c on this machine too, and the process exits at the same test there, so this diff is not what changes them.
  • Diagnostics build: pipeline::tests:: plus draw::tests::a_texture_written... filtered: 6 passed, 1 failed (that texture test, also failing on base).

Not tested here: NVIDIA, Windows, WARP, a release build, and the title - no game run, so the frame line itself was not read out in a frame, only unit-tested.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7216056982 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3168#issuecomment-7216056982). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-27T10:34:52Z. --- Both are real. Fixed in `9c1fac9b1`, one commit on top of `9cd45776d`. 1. **`NOT_RUN` read once.** `count_dropped` now returns the reason it read and the trace formats that (`draw.rs:172`, `:191`); the second read in `dropped()` is gone. So `DROPPED ... (...)` carries the `not_run(...)` text again instead of `()`. 2. **Indirect drops counted in every build.** The `note_drop` for an indirect call that finds no host pipeline moved out of the `#[cfg(feature = "diagnostics")]` block (`draw.rs:1826`); only the `note_op` breadcrumb stays behind the feature. `draw::DROPPED` still counts direct drops alone, so the frame line no longer presents the split as its breakdown: it now reads `dropped N without a host pipeline and M indirect not run: R refused, W waiting for one, K being made (both counts together)` (`host.rs:3081`), and `take_dropped_split`'s doc says the same (`pipeline.rs:341`). I kept one counter for both paths rather than a second split for indirect calls, since the question the line answers is "how much of this frame is waiting on a pipeline". Tested on RX 9070 XT (RDNA4), Mesa 26.3.1 RADV, this tree at `9c1fac9b1`: - `cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings`: clean. - `cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings`: clean, and clean again with `--features victory-gpu/diagnostics`. - `cargo xtask policy`: 191 files ok. - `victory-gpu` lib tests under Wine (GE-Proton11-14), `--test-threads=1`: 140 passed, 5 failed, then the process exits at `queue::tests::aliased_present_planes_preserve_the_host_texture_state`. Those 5 (`dynamic_slots_are_held_until_released`, `a_texture_written_in_one_format_reads_in_another_through_a_placed_view`, `lists_share_a_table_and_copies_keep_their_views`, `a_rejected_blob_gives_an_empty_library`, `pipelines_load_on_many_threads_at_once`) fail on base `63bcca43c` on this machine too, and the process exits at the same test there, so this diff is not what changes them. - Diagnostics build: `pipeline::tests::` plus `draw::tests::a_texture_written...` filtered: 6 passed, 1 failed (that texture test, also failing on base). Not tested here: NVIDIA, Windows, WARP, a release build, and the title - no game run, so the frame line itself was not read out in a frame, only unit-tested.
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/3168:upstream-pr/3168'
git switch 'upstream-pr/3168'

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