GPU: with VICTORY_GPU_OVERLAP=1, the title's submissions return before the host GPU has run them #3118

Open
0xkn0wh3r3 wants to merge 9 commits from upstream-pr/3120 into main
0xkn0wh3r3 commented 2026-11-26 08:51:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T08:51:39Z.


With VICTORY_GPU_OVERLAP=1, ExecuteCommandLists no longer waits for the host GPU. The title's lists go to the host queue with a Signal of the host fence, and the call returns. The submission completes later: what shaders wrote goes back to title memory, then the lists' work after them and their bottom-of-pipe writes, then the title fences its queue signalled behind it. A completion thread completes each submission once the GPU has run it, so a title's fence moves, and its waits end, without any call from the title, as on the console. A title that keeps frames in flight then gets them: it records the next frame while the GPU runs the last.

Off by default. Without the switch, every submission is waited for as on main, and the swap chain keeps two buffers. Whether to turn it on is the maintainer's call, after a run of the actual title (see Evidence).

What still waits, with overlap on

A submission completes the ones it needs before it is prepared. The wait is for the host fence, with the submission lock released.

  • Completion writes title memory or takes write marks: declared shader writes (copy-backs), title memory through page tables, missed-read checks, work after the lists, bottom-of-pipe writes, or marks together with heap indexing. Such a submission completes before the next is prepared, because the next one's refreshes and copies read title memory and its shaders mark in the same bitmaps.
  • Title copies and work that write title memory on the CPU (for the GPU's timeline) wait for everything before them.
  • The upload list waits for its own last run, and a host list waits for its own previous run.
  • Read marks are cleared only when no submission whose shaders mark reads is in flight, because the GPU's ORs into the bitmap are not atomic with the CPU's clears. The once-a-frame eviction pass clears every read mark, so the title's first submission of a frame first completes those submissions. A completion takes forgotten slots' clears only when none is left marking; otherwise a later one does. Reading marks while a submission may still set more is harmless: what isn't seen yet is seen by a later call.

So only submissions without such writes overlap. GTA VI's lists have bottom-of-pipe writes, so it would overlap much less than the measurements below. Snapshots and bitmaps per submission would lift that.

Other changes

  • A queue's Signal behind work in flight is owed by that queue's last submission and set when it completes, in order, under the submission lock.
  • A blocking fence wait (SetEventOnCompletion with no event) now blocks until the value is reached instead of returning E_NOTIMPL.
  • Present copies into the swap chain from a ring of three lists. With overlap on, it does not wait for the frame, keeps its planes alive on its list until that has run (not the back buffer, which the swap chain keeps), and the swap chain has three buffers. A resize, multi-plane composition and diagnostics read-backs still wait for what they need.
  • Held queue work is pumped after submissions complete on any thread.
  • With overlap on, a PresentX on a queue that still holds work (a wait for another queue's fence or memory value) is queued behind that work, and the frame is shown once that work has gone to the host GPU. Without overlap it runs at once, as on main. The frame line counts queued presents.
  • Host textures given up by eviction, and resources retired while work is in flight, are released once the next submission has completed.
  • A title list reset while its host list is still in flight keeps what it owned until that host list is reset, rather than as work run after the list.
  • Per-list timing (VICTORY_GPU_TIMING) and capture-listed frames always wait.

Evidence

Measured in the title

In-game runs by five testers, each on one host with one to three runs per mode in a session, so the direction is clearer than the size. No run with overlap on had a device removal, crash, hang or new dropped draws.

Tester Host Head Overlap on, against off
imjustprism (1, 2, 3) RX 9070 XT, Windows c7d538c2, 20af9470 No gain at either head. No flicker in 64 consecutive world frames captured with it on.
neonbyte1 (1, 2, 3) RTX 5090, Linux (vkd3d-proton) c7d538c2, 20af9470 At 20af9470, about 16% faster: four alternating 10-minute runs, 707.5 and 726.3 ms a frame on against 857.8 and 861.1 off. The time on the GPU drops by about as much (585.5-609.4 against 737.2-740.7 ms): the CPU waits less for it. At c7d538c2, about 3-4% faster (784.8-796.7 against 819.1 ms warm off), with copies up from about 120 to 152 MB a frame.
Jackster (1) RX 7900 XTX, Windows 10 not stated Slower: 1,769.9 against 1,229.5 ms a frame. Time on the GPU unchanged (155.7 against 161.6 ms); copies up from 203 ms / 380 MB to 492 ms / 597 MB a frame. One run each.
Kajanos (1) RTX 5080, Windows 11 20af9470 No gain: the frame stays at preparing + GPU + copying back added up (320-350 ms), so nothing runs alongside.

What the runs show:

  • The result depends on the host. The world's submissions write title memory when they complete (copy-backs, bottom-of-pipe writes), so each completes before the next is prepared, and preparing, the GPU and copying back mostly stay in series: Kajanos's and imjustprism's hosts gained nothing. neonbyte1's host gained about 16% at 20af9470, all of it in less waiting for the GPU. One likely reason: there, waiting for the GPU is most of the frame (about 740 of 860 ms with it off), against about 190 of 330 ms on Kajanos's host and 160 of 1,230 ms on Jackster's, so there is far more to hide. Its two sessions also differ (3-4% at c7d538c2), so a matched pair at one head on another host would help.
  • Work is held at the present on nearly every world frame with it on, and never with it off. The values compute queues wait for are written by graphics submissions that are still in flight at the present; with overlap off those writes land at submission. Many presents then wait behind held work on their queue: on 58% and 89% of world frames in imjustprism's two runs at 20af9470.
  • Copies grow with it on on two hosts (Jackster, neonbyte1). This change does not alter what a refresh copies. The likely cause is that held work is released in more, smaller host submissions, each of which copies again the pages the title rewrote since the last one. Not confirmed yet.

On this evidence, overlap helps on one host, does nothing on two and costs on one (Jackster, head not stated). It should stay off by default until the extra copies are explained and the difference between hosts is understood; per-submission snapshots and marks would let much more of the world overlap.

Conformance title

The conformance title's GPU frame was measured in a window (cargo demo, 2560x1440), on an RTX 5070 Ti, Windows 11, with this change merged into a branch that has the conformance title. Steady 5 s windows at head 92137df3:

default (off) VICTORY_GPU_OVERLAP=1
scale 4 (207 draws, 4 submissions a frame): frame rate 33.6 fps 59.9 fps (held to the title's 60 Hz frame tick)
scale 4: ExecuteCommandLists a frame 27.8 ms 1.5 ms
scale 32 (1,999 draws, 32 submissions a frame): frame rate 13.6 fps 56.2 fps
scale 32: ExecuteCommandLists a frame 66.0 ms 6.2 ms

Every list in that frame binds the views' marks bitmaps, so most of ExecuteCommandLists' remaining time is the once-a-frame wait before read marks are cleared.

Tests

  • New: a PresentX on a queue held at a fence wait is queued behind it, keeps its plane after the title releases it, and runs once the fence moves; a held action runs after the work before it and before the work behind it.
  • New: a submission held at a GPU gate returns from ExecuteCommandLists, and both its fence and its copy into a title buffer move only once it has completed. A blocking fence wait then ends.
  • Tests that read results straight after ExecuteCommandLists now wait for a fence as a title does. Tests that submit through title queues hold a shared lock, so a test holding the GPU finds no other test's work in flight. Tests run with overlap on unless VICTORY_GPU_OVERLAP=0.
  • cargo test -p victory-gpu --lib, in parallel and single-threaded, with and without VICTORY_GPU_OVERLAP=0: 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 this card (its view heap is smaller than HEAP_VIEWS). views_bound_while_another_slot_gets_its_texture_do_not_wait and frame::tests::waits_end_on_ticks_and_count_frames fail now and then on main too. a_slot_rewritten_while_its_view_is_prepared_views_the_new_record, which uses the same prepare hook as the first, failed once in parallel and then passed five reruns.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --features victory-gpu/diagnostics.
  • cargo conformance, with the switch off and on (also with a 5 s window, overlap on): all pass. With overlap on, 1 of 5 runs crashed with an access violation at process exit after every test had passed; not found yet.
<!-- greyfinch-sync:Marvisak/VIctory:issue:5506893762 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T08:51:39Z. --- With `VICTORY_GPU_OVERLAP=1`, ExecuteCommandLists no longer waits for the host GPU. The title's lists go to the host queue with a Signal of the host fence, and the call returns. The submission completes later: what shaders wrote goes back to title memory, then the lists' work after them and their bottom-of-pipe writes, then the title fences its queue signalled behind it. A completion thread completes each submission once the GPU has run it, so a title's fence moves, and its waits end, without any call from the title, as on the console. A title that keeps frames in flight then gets them: it records the next frame while the GPU runs the last. **Off by default.** Without the switch, every submission is waited for as on `main`, and the swap chain keeps two buffers. Whether to turn it on is the maintainer's call, after a run of the actual title (see Evidence). ## What still waits, with overlap on A submission completes the ones it needs before it is prepared. The wait is for the host fence, with the submission lock released. - **Completion writes title memory or takes write marks:** declared shader writes (copy-backs), title memory through page tables, missed-read checks, work after the lists, bottom-of-pipe writes, or marks together with heap indexing. Such a submission completes before the next is prepared, because the next one's refreshes and copies read title memory and its shaders mark in the same bitmaps. - **Title copies and work that write title memory on the CPU** (for the GPU's timeline) wait for everything before them. - **The upload list** waits for its own last run, and a host list waits for its own previous run. - **Read marks** are cleared only when no submission whose shaders mark reads is in flight, because the GPU's ORs into the bitmap are not atomic with the CPU's clears. The once-a-frame eviction pass clears every read mark, so the title's first submission of a frame first completes those submissions. A completion takes forgotten slots' clears only when none is left marking; otherwise a later one does. Reading marks while a submission may still set more is harmless: what isn't seen yet is seen by a later call. So only submissions without such writes overlap. GTA VI's lists have bottom-of-pipe writes, so it would overlap much less than the measurements below. Snapshots and bitmaps per submission would lift that. ## Other changes - A queue's Signal behind work in flight is owed by that queue's last submission and set when it completes, in order, under the submission lock. - A blocking fence wait (SetEventOnCompletion with no event) now blocks until the value is reached instead of returning E_NOTIMPL. - Present copies into the swap chain from a ring of three lists. With overlap on, it does not wait for the frame, keeps its planes alive on its list until that has run (not the back buffer, which the swap chain keeps), and the swap chain has three buffers. A resize, multi-plane composition and diagnostics read-backs still wait for what they need. - Held queue work is pumped after submissions complete on any thread. - With overlap on, a PresentX on a queue that still holds work (a wait for another queue's fence or memory value) is queued behind that work, and the frame is shown once that work has gone to the host GPU. Without overlap it runs at once, as on `main`. The frame line counts queued presents. - Host textures given up by eviction, and resources retired while work is in flight, are released once the next submission has completed. - A title list reset while its host list is still in flight keeps what it owned until that host list is reset, rather than as work run after the list. - Per-list timing (`VICTORY_GPU_TIMING`) and capture-listed frames always wait. ## Evidence ### Measured in the title In-game runs by five testers, each on one host with one to three runs per mode in a session, so the direction is clearer than the size. No run with overlap on had a device removal, crash, hang or new dropped draws. | Tester | Host | Head | Overlap on, against off | |---|---|---|---| | imjustprism ([1](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7189249958), [2](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7195684043), [3](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7199595765)) | RX 9070 XT, Windows | c7d538c2, 20af9470 | No gain at either head. No flicker in 64 consecutive world frames captured with it on. | | neonbyte1 ([1](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192403592), [2](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7193495220), [3](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7201676308)) | RTX 5090, Linux (vkd3d-proton) | c7d538c2, 20af9470 | At 20af9470, about 16% faster: four alternating 10-minute runs, 707.5 and 726.3 ms a frame on against 857.8 and 861.1 off. The time on the GPU drops by about as much (585.5-609.4 against 737.2-740.7 ms): the CPU waits less for it. At c7d538c2, about 3-4% faster (784.8-796.7 against 819.1 ms warm off), with copies up from about 120 to 152 MB a frame. | | Jackster ([1](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7196531194)) | RX 7900 XTX, Windows 10 | not stated | Slower: 1,769.9 against 1,229.5 ms a frame. Time on the GPU unchanged (155.7 against 161.6 ms); copies up from 203 ms / 380 MB to 492 ms / 597 MB a frame. One run each. | | Kajanos ([1](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7199321385)) | RTX 5080, Windows 11 | 20af9470 | No gain: the frame stays at preparing + GPU + copying back added up (320-350 ms), so nothing runs alongside. | What the runs show: - **The result depends on the host.** The world's submissions write title memory when they complete (copy-backs, bottom-of-pipe writes), so each completes before the next is prepared, and preparing, the GPU and copying back mostly stay in series: Kajanos's and imjustprism's hosts gained nothing. neonbyte1's host gained about 16% at 20af9470, all of it in less waiting for the GPU. One likely reason: there, waiting for the GPU is most of the frame (about 740 of 860 ms with it off), against about 190 of 330 ms on Kajanos's host and 160 of 1,230 ms on Jackster's, so there is far more to hide. Its two sessions also differ (3-4% at c7d538c2), so a matched pair at one head on another host would help. - **Work is held at the present on nearly every world frame with it on, and never with it off.** The values compute queues wait for are written by graphics submissions that are still in flight at the present; with overlap off those writes land at submission. Many presents then wait behind held work on their queue: on 58% and 89% of world frames in imjustprism's two runs at 20af9470. - **Copies grow with it on** on two hosts (Jackster, neonbyte1). This change does not alter what a refresh copies. The likely cause is that held work is released in more, smaller host submissions, each of which copies again the pages the title rewrote since the last one. Not confirmed yet. On this evidence, overlap helps on one host, does nothing on two and costs on one (Jackster, head not stated). It should stay off by default until the extra copies are explained and the difference between hosts is understood; per-submission snapshots and marks would let much more of the world overlap. ### Conformance title The conformance title's GPU frame was measured in a window (`cargo demo`, 2560x1440), on an RTX 5070 Ti, Windows 11, with this change merged into a branch that has the conformance title. Steady 5 s windows at head 92137df3: | | default (off) | `VICTORY_GPU_OVERLAP=1` | |---|---|---| | scale 4 (207 draws, 4 submissions a frame): frame rate | 33.6 fps | 59.9 fps (held to the title's 60 Hz frame tick) | | scale 4: ExecuteCommandLists a frame | 27.8 ms | 1.5 ms | | scale 32 (1,999 draws, 32 submissions a frame): frame rate | 13.6 fps | 56.2 fps | | scale 32: ExecuteCommandLists a frame | 66.0 ms | 6.2 ms | Every list in that frame binds the views' marks bitmaps, so most of ExecuteCommandLists' remaining time is the once-a-frame wait before read marks are cleared. ## Tests - New: a PresentX on a queue held at a fence wait is queued behind it, keeps its plane after the title releases it, and runs once the fence moves; a held action runs after the work before it and before the work behind it. - New: a submission held at a GPU gate returns from ExecuteCommandLists, and both its fence and its copy into a title buffer move only once it has completed. A blocking fence wait then ends. - Tests that read results straight after ExecuteCommandLists now wait for a fence as a title does. Tests that submit through title queues hold a shared lock, so a test holding the GPU finds no other test's work in flight. Tests run with overlap on unless `VICTORY_GPU_OVERLAP=0`. - `cargo test -p victory-gpu --lib`, in parallel and single-threaded, with and without `VICTORY_GPU_OVERLAP=0`: 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 this card (its view heap is smaller than `HEAP_VIEWS`). `views_bound_while_another_slot_gets_its_texture_do_not_wait` and `frame::tests::waits_end_on_ticks_and_count_frames` fail now and then on `main` too. `a_slot_rewritten_while_its_view_is_prepared_views_the_new_record`, which uses the same prepare hook as the first, failed once in parallel and then passed five reruns. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--features victory-gpu/diagnostics`. - `cargo conformance`, with the switch off and on (also with a 5 s window, overlap on): all pass. With overlap on, 1 of 5 runs crashed with an access violation at process exit after every test had passed; not found yet.
fuzeofficlal commented 2026-11-26 09:05:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:05:11Z.

Review: CHANGES_REQUESTED


Really strong async submission architecture overall — the Arc::try_unwrap handling in list::recycle keeps Presenter's copy ring out of SPARE, retire_any attaches evicted textures cleanly to the current InFlight.retired (so they outlive earlier submissions on the single queue), and the new hold_gpu gate test is great.

Verified locally on Windows 11 (RTX 5090 + WARP + D3D12 Debug Layer):

  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features) and cargo xtask policy (191 files ok): clean.
  • RTX 5090: fence::, hold::, queue::, resource::, shadow:: passed 46/46 serially and 28/28 in parallel (including a_submission_completes_after_it_returns).
  • WARP + VICTORY_D3D12_DEBUG=1 (--features diagnostics): fence::, hold::, queue::, resource::, shadow:: passed 46/46.
  • RTX 5090 + VICTORY_D3D12_DEBUG=1: host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame still exits 2173 (pre-existing #3084 gap: ResizeBuffers waits for submitted copy lists via complete_all(), not for the queued Present after them).

Three real concurrency/lifetime issues turned up during code review that should be fixed before merging:

1. Async present_with_compositor does not keep source planes alive on copy (crates/victory-gpu/src/host.rs:3785-3985)

Previously present_with_compositor called synchronous self.execute(&[&p.copy]), so &ID3D12Resource entries in planes stayed alive until the copy/composite finished on the GPU. Now that it submits asynchronously via self.submit(0, vec![copy.clone()]) and returns while copy is still in flight, copy never calls copy.keep(tex) on any plane in planes (nor on &back if anything could drop it). If the title releases or evicts a presented texture before copy finishes on the host GPU, the GPU reads a destroyed resource. Adding for &(tex, _) in planes { copy.keep(tex); } before copy.close() closes this UAF window.

2. Non-atomic &mut [u32] + std::mem::take on read-mark bitmaps while the GPU writes them (crates/victory-gpu/src/shadow.rs:828-885)

With overlapping submissions, the host GPU can execute InterlockedOr on the mapped read-mark bitmap concurrently with take_reads() / reads_since(). Forming &mut [u32] via std::slice::from_raw_parts_mut and running std::mem::take(word) (a separate non-atomic load and zero store) is both a Rust data race (UB) and loses any GPU read mark set between the load and the clear. Using &[std::sync::atomic::AtomicU32] with word.swap(0, Ordering::AcqRel) eliminates both the UB and the lost-bit window on coherent memory.

3. Completions drained by complete_while do not pump held queue work (crates/victory-gpu/src/host.rs:544-550, 598-612)

complete_in_background calls crate::queue::pump_held_if_free(Why::Completed) after draining submitted.flight, whereas complete_while (used by complete_all, complete_held, Host::execute, and Host::submit) does not. If a non-queue::pump caller (such as Present calling complete_held / complete_all, or Host::execute) drains a submission that wrote a bottom-of-pipe memory value or signalled a title fence that another queue's held work is waiting on, complete_in_background wakes to an empty flight (completed == false) and skips pumping — leaving held work stalled until the next title call or background timer tick. Calling pump_held_if_free(Why::Completed) after complete_all/complete_held/execute finishes any in-flight record (once submitted is dropped) closes this gap.

<!-- greyfinch-sync:Marvisak/VIctory:review:6071173604 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6071173604). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T09:05:11Z. **Review:** CHANGES_REQUESTED --- Really strong async submission architecture overall — the `Arc::try_unwrap` handling in `list::recycle` keeps `Presenter`'s copy ring out of `SPARE`, `retire_any` attaches evicted textures cleanly to the current `InFlight.retired` (so they outlive earlier submissions on the single queue), and the new `hold_gpu` gate test is great. Verified locally on Windows 11 (RTX 5090 + WARP + D3D12 Debug Layer): - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`) and `cargo xtask policy` (191 files ok): clean. - RTX 5090: `fence::`, `hold::`, `queue::`, `resource::`, `shadow::` passed 46/46 serially and 28/28 in parallel (including `a_submission_completes_after_it_returns`). - WARP + `VICTORY_D3D12_DEBUG=1` (`--features diagnostics`): `fence::`, `hold::`, `queue::`, `resource::`, `shadow::` passed 46/46. - RTX 5090 + `VICTORY_D3D12_DEBUG=1`: `host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame` still exits `2173` (pre-existing `#3084` gap: `ResizeBuffers` waits for submitted copy lists via `complete_all()`, not for the queued `Present` after them). Three real concurrency/lifetime issues turned up during code review that should be fixed before merging: ### 1. Async `present_with_compositor` does not keep source `planes` alive on `copy` (`crates/victory-gpu/src/host.rs:3785-3985`) Previously `present_with_compositor` called synchronous `self.execute(&[&p.copy])`, so `&ID3D12Resource` entries in `planes` stayed alive until the copy/composite finished on the GPU. Now that it submits asynchronously via `self.submit(0, vec![copy.clone()])` and returns while `copy` is still in flight, `copy` never calls `copy.keep(tex)` on any plane in `planes` (nor on `&back` if anything could drop it). If the title releases or evicts a presented texture before `copy` finishes on the host GPU, the GPU reads a destroyed resource. Adding `for &(tex, _) in planes { copy.keep(tex); }` before `copy.close()` closes this UAF window. ### 2. Non-atomic `&mut [u32]` + `std::mem::take` on read-mark bitmaps while the GPU writes them (`crates/victory-gpu/src/shadow.rs:828-885`) With overlapping submissions, the host GPU can execute `InterlockedOr` on the mapped read-mark bitmap concurrently with `take_reads()` / `reads_since()`. Forming `&mut [u32]` via `std::slice::from_raw_parts_mut` and running `std::mem::take(word)` (a separate non-atomic load and zero store) is both a Rust data race (UB) and loses any GPU read mark set between the load and the clear. Using `&[std::sync::atomic::AtomicU32]` with `word.swap(0, Ordering::AcqRel)` eliminates both the UB and the lost-bit window on coherent memory. ### 3. Completions drained by `complete_while` do not pump held queue work (`crates/victory-gpu/src/host.rs:544-550, 598-612`) `complete_in_background` calls `crate::queue::pump_held_if_free(Why::Completed)` after draining `submitted.flight`, whereas `complete_while` (used by `complete_all`, `complete_held`, `Host::execute`, and `Host::submit`) does not. If a non-`queue::pump` caller (such as `Present` calling `complete_held` / `complete_all`, or `Host::execute`) drains a submission that wrote a bottom-of-pipe memory value or signalled a title fence that another queue's held work is waiting on, `complete_in_background` wakes to an empty `flight` (`completed == false`) and skips pumping — leaving held work stalled until the next title call or background timer tick. Calling `pump_held_if_free(Why::Completed)` after `complete_all`/`complete_held`/`execute` finishes any in-flight record (once `submitted` is dropped) closes this gap.
Dukestar69 commented 2026-11-26 09:08:53 +00:00 (Migrated from github.com)

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

Review: APPROVED


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

  • cargo test -p victory-gpu --lib resource:: -- --test-threads=1: 19/19 passed on RTX 5090 (including a_submission_completes_after_it_returns and a_list_waiting_for_another_queues_write_reads_what_it_wrote).
  • cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed on RTX 5090.
  • cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: 10/10 passed on RTX 5090 and WARP.
  • cargo test -p victory-gpu --lib host:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 34/34 passed on RTX 5090 and WARP; fence:: 2/2 and queue:: 5/5 passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Major throughput win: cleanly decouples title submission returns from host GPU completion while preserving fence/queue/copy-back ordering.

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

<!-- greyfinch-sync:Marvisak/VIctory:review:6071236090 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6071236090). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T09:08:53Z. **Review:** APPROVED --- Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib resource:: -- --test-threads=1`: 19/19 passed on RTX 5090 (including `a_submission_completes_after_it_returns` and `a_list_waiting_for_another_queues_write_reads_what_it_wrote`). - `cargo test -p victory-gpu --lib draw:: -- --test-threads=1`: 20/20 passed on RTX 5090. - `cargo test -p victory-gpu --lib shadow:: -- --test-threads=1`: 10/10 passed on RTX 5090 and WARP. - `cargo test -p victory-gpu --lib host:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released`: 34/34 passed on RTX 5090 and WARP; `fence::` 2/2 and `queue::` 5/5 passed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Major throughput win: cleanly decouples title submission returns from host GPU completion while preserving fence/queue/copy-back ordering. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 09:39:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:39:19Z.

Review: CHANGES_REQUESTED


Re-reviewed through 92137df3. Making overlap opt-in (VICTORY_GPU_OVERLAP=1), moving shadow.rs read marks to &[AtomicU32] with quiet-only clearing, keeping planes alive on the present list, and avoiding frame stalls in 92137df3 are all solid improvements.

However, two regressions/bugs were caught in a75fc056..92137df3:

1. copy.keep(&back) breaks ResizeBuffers on every swap-chain resize (reproduced on RTX 5090 and WARP, even with VICTORY_GPU_OVERLAP=0)

At crates/victory-gpu/src/host.rs:4040, copy.keep(&back) stores a COM reference to the swap chain's back buffer in copy.deferred().keep, which is only cleared when copy.reset() runs. When a resize is needed (host.rs:3814-3828), self.complete_all() waits for in-flight work but never clears keep on p.copies, so the ring's present lists still hold references to the old back buffers when p.swap_chain.ResizeBuffers(...) is called, causing it to fail with DXGI_ERROR_INVALID_CALL.

Locally verified on Windows 11 (cargo test -p victory-gpu --features diagnostics --lib host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame):

  • RTX 5090 (overlap=1, debug=0 and debug=1): FAILED at host.rs:4708 (compositor initialization can be retried after failure)
  • WARP (overlap=1 and overlap=0, debug=0 and debug=1): FAILED at host.rs:4708

Note this also breaks the default non-overlap path (VICTORY_GPU_OVERLAP=0) because copy.keep(&back) runs unconditionally. Clearing keep on every list in p.copies right after self.complete_all() (before ResizeBuffers) — or releasing keep on completion — fixes it.

2. Lost-wakeup race on COMPLETED in Host::finish (host.rs:1171-1185, 1790, 1933-1935)

COMPLETED.store(true, Ordering::Relaxed) runs on the very first line of Host::finish (host.rs:1790), before self.wait_for(record.value), copy-backs, bottom-of-pipe writes, and set_title_fence(fence, value) (host.rs:1934).

If Thread A drops the submitted lock after S1 (just before calling pump_after_completions()) while Thread B enters finish() for S2, sets COMPLETED = true, and blocks in wait_for(S2) (potentially milliseconds):

  1. Thread A runs COMPLETED.swap(false, Relaxed) -> observes true, resets it to false, and calls pump_held_if_free before S2's writes or fence signals happen.
  2. Thread B finishes wait_for(S2), performs S2's writes and set_title_fence, drops submitted, and calls pump_after_completions() -> swap(false) returns false, skipping pump_held_if_free and leaving S2's held work un-woken.

Moving COMPLETED.store(true, Ordering::Release) to the end of finish() (after the set_title_fence loop) and pairing it with COMPLETED.swap(false, Ordering::AcqRel) in pump_after_completions() ensures any thread that consumes the flag is guaranteed to observe all writes and fence signals from finish() before pumping.

Other verification on 92137df3:

  • cargo clippy --workspace --all-targets [--all-features] -- -D warnings: clean; cargo xtask policy: 191 files ok
  • RTX 5090: fence:: + hold:: + queue:: + resource:: + shadow:: 46/46 passed (including a_submission_completes_after_it_returns)
  • WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1): 81/82 passed across host:: + fence:: + hold:: + queue:: + resource:: + shadow:: (the sole failure is compositor_failure_presents_primary_in_the_same_frame above).
<!-- greyfinch-sync:Marvisak/VIctory:review:6071704815 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6071704815). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T09:39:19Z. **Review:** CHANGES_REQUESTED --- Re-reviewed through `92137df3`. Making overlap opt-in (`VICTORY_GPU_OVERLAP=1`), moving `shadow.rs` read marks to `&[AtomicU32]` with quiet-only clearing, keeping `planes` alive on the present list, and avoiding frame stalls in `92137df3` are all solid improvements. However, two regressions/bugs were caught in `a75fc056..92137df3`: ### 1. `copy.keep(&back)` breaks `ResizeBuffers` on every swap-chain resize (reproduced on RTX 5090 and WARP, even with `VICTORY_GPU_OVERLAP=0`) At `crates/victory-gpu/src/host.rs:4040`, `copy.keep(&back)` stores a COM reference to the swap chain's back buffer in `copy.deferred().keep`, which is only cleared when `copy.reset()` runs. When a resize is needed (`host.rs:3814-3828`), `self.complete_all()` waits for in-flight work but never clears `keep` on `p.copies`, so the ring's present lists still hold references to the old back buffers when `p.swap_chain.ResizeBuffers(...)` is called, causing it to fail with `DXGI_ERROR_INVALID_CALL`. Locally verified on Windows 11 (`cargo test -p victory-gpu --features diagnostics --lib host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame`): - RTX 5090 (`overlap=1`, `debug=0` and `debug=1`): **FAILED** at `host.rs:4708` (`compositor initialization can be retried after failure`) - WARP (`overlap=1` and `overlap=0`, `debug=0` and `debug=1`): **FAILED** at `host.rs:4708` Note this also breaks the default non-overlap path (`VICTORY_GPU_OVERLAP=0`) because `copy.keep(&back)` runs unconditionally. Clearing `keep` on every list in `p.copies` right after `self.complete_all()` (before `ResizeBuffers`) — or releasing `keep` on completion — fixes it. ### 2. Lost-wakeup race on `COMPLETED` in `Host::finish` (`host.rs:1171-1185, 1790, 1933-1935`) `COMPLETED.store(true, Ordering::Relaxed)` runs on the very first line of `Host::finish` (`host.rs:1790`), *before* `self.wait_for(record.value)`, copy-backs, bottom-of-pipe writes, and `set_title_fence(fence, value)` (`host.rs:1934`). If Thread A drops the `submitted` lock after S1 (just before calling `pump_after_completions()`) while Thread B enters `finish()` for S2, sets `COMPLETED = true`, and blocks in `wait_for(S2)` (potentially milliseconds): 1. Thread A runs `COMPLETED.swap(false, Relaxed)` -> observes `true`, resets it to `false`, and calls `pump_held_if_free` *before* S2's writes or fence signals happen. 2. Thread B finishes `wait_for(S2)`, performs S2's writes and `set_title_fence`, drops `submitted`, and calls `pump_after_completions()` -> `swap(false)` returns `false`, skipping `pump_held_if_free` and leaving S2's held work un-woken. Moving `COMPLETED.store(true, Ordering::Release)` to the end of `finish()` (after the `set_title_fence` loop) and pairing it with `COMPLETED.swap(false, Ordering::AcqRel)` in `pump_after_completions()` ensures any thread that consumes the flag is guaranteed to observe all writes and fence signals from `finish()` before pumping. Other verification on `92137df3`: - `cargo clippy --workspace --all-targets [--all-features] -- -D warnings`: clean; `cargo xtask policy`: `191 files ok` - RTX 5090: `fence::` + `hold::` + `queue::` + `resource::` + `shadow::` 46/46 passed (including `a_submission_completes_after_it_returns`) - WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`): 81/82 passed across `host::` + `fence::` + `hold::` + `queue::` + `resource::` + `shadow::` (the sole failure is `compositor_failure_presents_primary_in_the_same_frame` above).
upstream-sync changed title from [PR #3120] GPU: the title's submissions return before the host GPU has run them to [PR #3120] GPU: with VICTORY_GPU_OVERLAP=1, the title's submissions return before the host GPU has run them 2026-11-26 10:04:53 +00:00
0xkn0wh3r3 commented 2026-11-26 10:05:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T09:09:53Z.


Thanks for testing on the 5090 and WARP. All three are fixed in a75fc056:

  1. Async present. Before copy.close(), the present list now keeps every plane it copies or composes, and the back buffer (copy.keep). They stay alive until the list is reset, which happens only once the present has completed.
  2. Read marks. take_reads, reads_since and the test helper mark_read now see the read marks as &[AtomicU32]. reads_since loads each word and swaps in 0 only where a word is set; take_reads loads and does a fetch_and for forgotten slots. There is no &mut [u32] over memory the GPU may still OR into, and no mark set between the read and the clear is lost. Write marks keep their plain access: they are only taken with no other submission in flight.
  3. Held work. finish notes that a submission completed. execute, submit, complete_all and complete_held then call pump_held_if_free(Why::Completed) once the submission lock is dropped. Inside a pump the try-lock fails and nothing runs there, but that pump tests its queues again itself.

cargo test -p victory-gpu --lib, parallel and single-threaded: 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 this card (its view heap is smaller than HEAP_VIEWS). Workspace clippy is clean with and without --features victory-gpu/diagnostics.

Agreed on compositor_failure_presents_primary_in_the_same_frame under the debug layer: that's #3084, and this PR doesn't change it.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187521295 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7187521295). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T09:09:53Z. --- Thanks for testing on the 5090 and WARP. All three are fixed in a75fc056: 1. **Async present.** Before `copy.close()`, the present list now keeps every plane it copies or composes, and the back buffer (`copy.keep`). They stay alive until the list is reset, which happens only once the present has completed. 2. **Read marks.** `take_reads`, `reads_since` and the test helper `mark_read` now see the read marks as `&[AtomicU32]`. `reads_since` loads each word and swaps in 0 only where a word is set; `take_reads` loads and does a `fetch_and` for forgotten slots. There is no `&mut [u32]` over memory the GPU may still OR into, and no mark set between the read and the clear is lost. Write marks keep their plain access: they are only taken with no other submission in flight. 3. **Held work.** `finish` notes that a submission completed. `execute`, `submit`, `complete_all` and `complete_held` then call `pump_held_if_free(Why::Completed)` once the submission lock is dropped. Inside a pump the try-lock fails and nothing runs there, but that pump tests its queues again itself. `cargo test -p victory-gpu --lib`, parallel and single-threaded: 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 this card (its view heap is smaller than `HEAP_VIEWS`). Workspace clippy is clean with and without `--features victory-gpu/diagnostics`. Agreed on `compositor_failure_presents_primary_in_the_same_frame` under the debug layer: that's #3084, and this PR doesn't change it.
Marvisak commented 2026-11-26 10:05:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T09:20:02Z.


Automated triage for the maintainers.

Needs work: needs the maintainer's decision. This makes Host::submit return before the host GPU has run a submission. complete_in_background does copy-backs and sets title fences later, HostList::heavy submissions complete before the next one is prepared, and fence.rs gains a blocking SetEventOnCompletion wait. The ordering in complete_while/finish is consistent: copy-backs, then work after the lists, then title fences, all under the submission lock. Moving retired objects into each InFlight and keep_until_reset also look right. Still needed:

  1. Decision. The change is on by default and replaces main's submission model, so the maintainer has to decide on it.
  2. Docs. The module doc and PR body point to docs/submission-overlap.md and a demo branch, and neither is in main. Please remove the reference, since design documents do not go into the repo.
  3. Evidence. All the numbers come from the conformance title. Please report a run of the actual title on main plus this change, with overlap on and off, and no new fence or copy-back problems.
  4. Read marks. shadow::read_marks now treats the mapped bitmap as AtomicU32, but CPU atomics on mapped memory are not atomic with the GPU's ORs. Either explain why a lost mark is harmless, or take the read marks only after completion.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187802642 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7187802642). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T09:20:02Z. --- <!-- victory-triage v1 head=a75fc0563d5da62e968206b936cb9279a9df479a verdict=needs-work at=2026-11-26T09:21:00Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** This makes `Host::submit` return before the host GPU has run a submission. `complete_in_background` does copy-backs and sets title fences later, `HostList::heavy` submissions complete before the next one is prepared, and `fence.rs` gains a blocking `SetEventOnCompletion` wait. The ordering in `complete_while`/`finish` is consistent: copy-backs, then work after the lists, then title fences, all under the submission lock. Moving retired objects into each `InFlight` and `keep_until_reset` also look right. Still needed: 1. **Decision.** The change is on by default and replaces `main`'s submission model, so the maintainer has to decide on it. 2. **Docs.** The module doc and PR body point to `docs/submission-overlap.md` and a `demo` branch, and neither is in `main`. Please remove the reference, since design documents do not go into the repo. 3. **Evidence.** All the numbers come from the conformance title. Please report a run of the actual title on `main` plus this change, with overlap on and off, and no new fence or copy-back problems. 4. **Read marks.** `shadow::read_marks` now treats the mapped bitmap as `AtomicU32`, but CPU atomics on mapped memory are not atomic with the GPU's ORs. Either explain why a lost mark is harmless, or take the read marks only after completion. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
0xkn0wh3r3 commented 2026-11-26 10:05:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T09:29:26Z.


Thanks. All four points are addressed in cb88757d and 92137df3, and the description is updated:

  1. Decision. Overlap is now off by default. Without VICTORY_GPU_OVERLAP=1, every submission is waited for as on main, and the swap chain keeps two buffers. Turning it on is the maintainer's call. The lib tests run with it on (unless it is set to 0), because those are the paths it adds; I ran them both ways.

  2. Docs. The module doc and the description no longer point to a design document or another branch.

  3. Evidence. I can't run the actual title here, so I haven't claimed a result for it. The only numbers in the description are from the conformance title, labelled as such. Could a tester run the title on main plus this PR, once with VICTORY_GPU_OVERLAP=1 and once without, and post the frame-rate and slow-frame lines, plus any fence or copy-back problems?

  4. Read marks. I took the second option. The CPU now clears read marks only when no submission whose shaders mark reads is in flight:

    • A completion clears forgotten slots only then; otherwise a later completion does.
    • The once-a-frame eviction pass (reads_since) runs only then. Before the title's first submission of a frame, the submissions that mark are completed first. Not before a present's submission, which would otherwise wait for the frame it shows.
    • Reading marks while a submission may still set more is kept. A mark not yet visible is simply seen by a later call, and nothing is cleared under the GPU.
    • The atomics stay only so the CPU's own accesses are not a data race.

    On the conformance title this once-a-frame wait costs ExecuteCommandLists about 1.1 ms a frame at scale 4. The frame rate is unchanged (59.9 fps, held to the frame tick).

One thing to know: #2121 also changes take_reads/reads_since and the order in Host::execute, so whichever of the two lands second will need a merge there.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188060265 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188060265). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T09:29:26Z. --- Thanks. All four points are addressed in cb88757d and 92137df3, and the description is updated: 1. **Decision.** Overlap is now off by default. Without `VICTORY_GPU_OVERLAP=1`, every submission is waited for as on `main`, and the swap chain keeps two buffers. Turning it on is the maintainer's call. The lib tests run with it on (unless it is set to 0), because those are the paths it adds; I ran them both ways. 2. **Docs.** The module doc and the description no longer point to a design document or another branch. 3. **Evidence.** I can't run the actual title here, so I haven't claimed a result for it. The only numbers in the description are from the conformance title, labelled as such. **Could a tester run the title on `main` plus this PR, once with `VICTORY_GPU_OVERLAP=1` and once without, and post the frame-rate and slow-frame lines, plus any fence or copy-back problems?** 4. **Read marks.** I took the second option. The CPU now clears read marks only when no submission whose shaders mark reads is in flight: - A completion clears forgotten slots only then; otherwise a later completion does. - The once-a-frame eviction pass (`reads_since`) runs only then. Before the title's first submission of a frame, the submissions that mark are completed first. Not before a present's submission, which would otherwise wait for the frame it shows. - Reading marks while a submission may still set more is kept. A mark not yet visible is simply seen by a later call, and nothing is cleared under the GPU. - The atomics stay only so the CPU's own accesses are not a data race. On the conformance title this once-a-frame wait costs ExecuteCommandLists about 1.1 ms a frame at scale 4. The frame rate is unchanged (59.9 fps, held to the frame tick). One thing to know: #2121 also changes `take_reads`/`reads_since` and the order in `Host::execute`, so whichever of the two lands second will need a merge there.
passerbyyhx commented 2026-11-26 10:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T09:34:51Z.


With overlap enabled, I checked which thread actually submitted the waiting compute queue after the graphics queue finished. Holding the timer and completion worker outside that interval makes the difference visible even though the final 64 texture bytes match on every run. On d362e501 the timer submitted the copy only after the workers resumed. On a75fc056 the foreground thread submitted it before complete_all() returned, with release reason Completed. Four runs per revision per adapter on the RTX 4090 Laptop and WARP, plus one more each with explicit opt-in on cb88757d. Test and reproduction.

One follow-up for 92137df3: an actual Completed release produces reason index 6, but the next frame aggregates only six slots. The aggregation runs before the trace call even when logging is off. Fork PR #11 adds the seventh counter and label. Its empty-frame and seven-reason distribution checks passed in regular and diagnostics Windows builds.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188180803 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188180803). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-11-26T09:34:51Z. --- With overlap enabled, I checked which thread actually submitted the waiting compute queue after the graphics queue finished. Holding the timer and completion worker outside that interval makes the difference visible even though the final 64 texture bytes match on every run. On `d362e501` the timer submitted the copy only after the workers resumed. On `a75fc056` the foreground thread submitted it before `complete_all()` returned, with release reason `Completed`. Four runs per revision per adapter on the RTX 4090 Laptop and WARP, plus one more each with explicit opt-in on `cb88757d`. [Test and reproduction](https://github.com/0xkn0wh3r3/VIctory/pull/10). One follow-up for `92137df3`: an actual `Completed` release produces reason index 6, but the next frame aggregates only six slots. The aggregation runs before the trace call even when logging is off. [Fork PR #11](https://github.com/0xkn0wh3r3/VIctory/pull/11) adds the seventh counter and label. Its empty-frame and seven-reason distribution checks passed in regular and diagnostics Windows builds.
0xkn0wh3r3 commented 2026-11-26 10:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T09:39:37Z.


@passerbyyhx thanks for checking point 3 on the 4090 Laptop and WARP, and for finding this.

You're right about Completed: it was a panic, not a dropped count. The frame line counted releases into [0u32; 6] with by[r.2 as usize] += 1, so the first present after a Completed release indexed past the end, in the present path. It could happen with overlap off too, because any completion pumps held work.

Fixed in 26c88f1f, written separately from your fork PRs, so 0xkn0wh3r3/VIctory#10 and #11 can be closed:

  • Why::ALL lists every reason. A const assertion checks at compile time that each one sits at its own index and that the last variant ends the list, so a new reason that isn't added there fails to build.
  • released_by sizes its counts with Why::ALL.len() and labels them with Why::name, an exhaustive match. The frame line now shows names with counts (for example [("completed", 1)]) instead of a fixed list of labels.
  • The new test every_reason_held_work_is_released_by_is_counted_in_the_frame_line releases with every reason, including Completed, checks the counts, and runs the frame aggregation (account_frame). With the old six counts it panics on the index.

cargo test -p victory-gpu --lib, parallel and single-threaded, with overlap on and off: everything passes except the two heap-size tests that fail on main on this card. Workspace clippy is clean with and without --features victory-gpu/diagnostics.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188293955 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188293955). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T09:39:37Z. --- @passerbyyhx thanks for checking point 3 on the 4090 Laptop and WARP, and for finding this. You're right about `Completed`: it was a panic, not a dropped count. The frame line counted releases into `[0u32; 6]` with `by[r.2 as usize] += 1`, so the first present after a `Completed` release indexed past the end, in the present path. It could happen with overlap off too, because any completion pumps held work. Fixed in 26c88f1f, written separately from your fork PRs, so 0xkn0wh3r3/VIctory#10 and #11 can be closed: - `Why::ALL` lists every reason. A const assertion checks at compile time that each one sits at its own index and that the last variant ends the list, so a new reason that isn't added there fails to build. - `released_by` sizes its counts with `Why::ALL.len()` and labels them with `Why::name`, an exhaustive match. The frame line now shows names with counts (for example `[("completed", 1)]`) instead of a fixed list of labels. - The new test `every_reason_held_work_is_released_by_is_counted_in_the_frame_line` releases with every reason, including `Completed`, checks the counts, and runs the frame aggregation (`account_frame`). With the old six counts it panics on the index. `cargo test -p victory-gpu --lib`, parallel and single-threaded, with overlap on and off: everything passes except the two heap-size tests that fail on `main` on this card. Workspace clippy is clean with and without `--features victory-gpu/diagnostics`.
0xkn0wh3r3 commented 2026-11-26 10:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T09:45:24Z.


@fuzeofficlal thanks for the re-review. Both are fixed in c7d538c2. passerbyyhx's reason-index bug was fixed earlier in 26c88f1f.

  1. Back buffer kept on the present list. Confirmed: with --features diagnostics, compositor_failure_presents_primary_in_the_same_frame failed at host.rs:4708 here too, with overlap on and off. The present list no longer keeps the back buffer, only the frame's planes. The swap chain keeps its own buffers, and a resize completes every list first (complete_all), so nothing holds a back buffer at ResizeBuffers. The test now gets past 4708. On this machine it then exits with 2173, which plain main (63bcca43) does too: that is #3084, as you said.
  2. Lost wakeup. finish now sets COMPLETED last, with Release, after the copy-backs, the bottom-of-pipe writes and the title fences. pump_after_completions takes it with swap(false, AcqRel). A pump that takes the flag sees all of a completion's effects, and a completion that lands after a swap sets the flag again for its own pump. I didn't add a test that interleaves two finish calls: it would need hooks inside finish to stop one thread between its fences and the flag, and I'd rather not add those to the submission path for a test. If you see a way that doesn't need them, I'll add it.

One more thing turned up while running the lib with --features diagnostics and overlap on. placed_uav_textures_create_real_host_uavs failed in 5 of 6 runs on a debug-layer message from another test: CreatePipelineLibrary given a blob it can't use, from the pipeline-library tests. With completions moved to another thread, the queue was drained less often, so the message stayed there until this test checked for errors. pipeline::library expects that rejection and opens an empty library instead. The info queue no longer stores those four messages (invalid blob, driver or adapter version mismatch, unsupported). That test then passed 5 of 5.

cargo test -p victory-gpu --lib, plain and --features diagnostics (minus the #3084 test), parallel and single-threaded, overlap on and off: everything passes except the two heap-size tests that fail on main on this card. Workspace clippy is clean with and without the diagnostics feature.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188427758 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188427758). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T09:45:24Z. --- @fuzeofficlal thanks for the re-review. Both are fixed in c7d538c2. passerbyyhx's reason-index bug was fixed earlier in 26c88f1f. 1. **Back buffer kept on the present list.** Confirmed: with `--features diagnostics`, `compositor_failure_presents_primary_in_the_same_frame` failed at host.rs:4708 here too, with overlap on and off. The present list no longer keeps the back buffer, only the frame's planes. The swap chain keeps its own buffers, and a resize completes every list first (`complete_all`), so nothing holds a back buffer at `ResizeBuffers`. The test now gets past 4708. On this machine it then exits with 2173, which plain `main` (63bcca43) does too: that is #3084, as you said. 2. **Lost wakeup.** `finish` now sets `COMPLETED` last, with `Release`, after the copy-backs, the bottom-of-pipe writes and the title fences. `pump_after_completions` takes it with `swap(false, AcqRel)`. A pump that takes the flag sees all of a completion's effects, and a completion that lands after a swap sets the flag again for its own pump. I didn't add a test that interleaves two `finish` calls: it would need hooks inside `finish` to stop one thread between its fences and the flag, and I'd rather not add those to the submission path for a test. If you see a way that doesn't need them, I'll add it. One more thing turned up while running the lib with `--features diagnostics` and overlap on. `placed_uav_textures_create_real_host_uavs` failed in 5 of 6 runs on a debug-layer message from another test: `CreatePipelineLibrary` given a blob it can't use, from the pipeline-library tests. With completions moved to another thread, the queue was drained less often, so the message stayed there until this test checked for errors. `pipeline::library` expects that rejection and opens an empty library instead. The info queue no longer stores those four messages (invalid blob, driver or adapter version mismatch, unsupported). That test then passed 5 of 5. `cargo test -p victory-gpu --lib`, plain and `--features diagnostics` (minus the #3084 test), parallel and single-threaded, overlap on and off: everything passes except the two heap-size tests that fail on `main` on this card. Workspace clippy is clean with and without the diagnostics feature.
passerbyyhx commented 2026-11-26 10:05:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-11-26T09:49:24Z.


Confirmed on 26c88f1f and closed fork PRs #10 and #11 as requested. Your frame-line test passed in regular Windows and diagnostics builds, including an explicit VICTORY_GPU_OVERLAP=0 run. With overlap enabled, I also reran the foreground two-queue fixture on the 4090 Laptop and WARP: both recorded Completed on the calling thread before the background workers resumed, with all 64 bytes correct. Thanks for fixing this.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188522061 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188522061). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-11-26T09:49:24Z. --- Confirmed on `26c88f1f` and closed fork PRs #10 and #11 as requested. Your frame-line test passed in regular Windows and diagnostics builds, including an explicit `VICTORY_GPU_OVERLAP=0` run. With overlap enabled, I also reran the foreground two-queue fixture on the 4090 Laptop and WARP: both recorded `Completed` on the calling thread before the background workers resumed, with all 64 bytes correct. Thanks for fixing this.
fuzeofficlal commented 2026-11-26 10:22:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:22:49Z.

Review: APPROVED


Re-reviewed 92137df3..c7d538c2 and re-verified on Windows 11 (RTX 5090 + WARP + D3D12 Debug Layer). Both blockers from the previous pass are cleanly resolved, and 26c88f1f also closes a real out-of-bounds indexing panic in account_frame when Why::Completed releases held work.

What was verified

  • Back-buffer lifetime on resize (host.rs:4060-4068): removing copy.keep(&back) while keeping plane textures (for &(texture, _) in planes { copy.keep(texture); }) eliminates the dangling back-buffer COM references across ResizeBuffers. host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame (--features diagnostics) now passes 5/5 on RTX 5090 with overlap on (0.29–0.30s), 5/5 on RTX 5090 with VICTORY_GPU_OVERLAP=0 (0.30–0.33s), and 3/3 on WARP (0.05–0.06s).
  • Completion wakeup ordering (host.rs:1207, host.rs:1960): moving COMPLETED.store(true, Ordering::Release) to the end of Host::finish (after wait_for, copy-backs, bottom-of-pipe writes, and set_title_fence) paired with COMPLETED.swap(false, Ordering::AcqRel) in pump_after_completions removes the premature-clear race.
  • Held-work accounting (queue.rs:89-137, queue.rs:346): Why::ALL with the compile-time discriminant check and released_by fixes the [0u32; 6] out-of-bounds panic for Why::Completed.
  • Checks & hardware suite (git merge-tree against origin/main 63bcca43 clean):
    • cargo clippy --workspace --all-targets --locked -- -D warnings (default & --all-features): clean; cargo xtask policy: 191 files ok.
    • RTX 5090 (OVERLAP=1): draw::tests:: 20/20; queue:: / fence:: / hold:: / resource::tests:: / shadow:: / host::tests:: / a_submission_completes_after_it_returns 77/77 (only the pre-existing NVIDIA 1M-cap descriptor::host::tests::dynamic_slots_are_held_until_released fails).
    • RTX 5090 (VICTORY_GPU_OVERLAP=0): queue:: / fence:: / resource::tests:: 27/27.
    • RTX 5090 + VICTORY_D3D12_DEBUG=1: 47/47 passed with no unexpected debug-layer errors.
    • WARP (--features diagnostics): draw::tests:: 20/20, core + descriptor:: + host::tests:: 78/78; WARP + VICTORY_D3D12_DEBUG=1: 37/37 passed.

Minor doc nit (non-blocking): the PR description still says "keeps its planes and the back buffer alive on its list until that has run", which can be trimmed to match c7d538c2.

<!-- greyfinch-sync:Marvisak/VIctory:review:6072345157 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6072345157). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T10:22:49Z. **Review:** APPROVED --- Re-reviewed `92137df3..c7d538c2` and re-verified on Windows 11 (RTX 5090 + WARP + D3D12 Debug Layer). Both blockers from the previous pass are cleanly resolved, and `26c88f1f` also closes a real out-of-bounds indexing panic in `account_frame` when `Why::Completed` releases held work. ### What was verified - **Back-buffer lifetime on resize (`host.rs:4060-4068`)**: removing `copy.keep(&back)` while keeping plane textures (`for &(texture, _) in planes { copy.keep(texture); }`) eliminates the dangling back-buffer COM references across `ResizeBuffers`. `host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame` (`--features diagnostics`) now passes **5/5** on RTX 5090 with overlap on (`0.29–0.30s`), **5/5** on RTX 5090 with `VICTORY_GPU_OVERLAP=0` (`0.30–0.33s`), and **3/3** on WARP (`0.05–0.06s`). - **Completion wakeup ordering (`host.rs:1207`, `host.rs:1960`)**: moving `COMPLETED.store(true, Ordering::Release)` to the end of `Host::finish` (after `wait_for`, copy-backs, bottom-of-pipe writes, and `set_title_fence`) paired with `COMPLETED.swap(false, Ordering::AcqRel)` in `pump_after_completions` removes the premature-clear race. - **Held-work accounting (`queue.rs:89-137`, `queue.rs:346`)**: `Why::ALL` with the compile-time discriminant check and `released_by` fixes the `[0u32; 6]` out-of-bounds panic for `Why::Completed`. - **Checks & hardware suite** (`git merge-tree` against `origin/main` `63bcca43` clean): - `cargo clippy --workspace --all-targets --locked -- -D warnings` (default & `--all-features`): clean; `cargo xtask policy`: 191 files ok. - RTX 5090 (`OVERLAP=1`): `draw::tests::` 20/20; `queue::` / `fence::` / `hold::` / `resource::tests::` / `shadow::` / `host::tests::` / `a_submission_completes_after_it_returns` 77/77 (only the pre-existing NVIDIA 1M-cap `descriptor::host::tests::dynamic_slots_are_held_until_released` fails). - RTX 5090 (`VICTORY_GPU_OVERLAP=0`): `queue::` / `fence::` / `resource::tests::` 27/27. - RTX 5090 + `VICTORY_D3D12_DEBUG=1`: 47/47 passed with no unexpected debug-layer errors. - WARP (`--features diagnostics`): `draw::tests::` 20/20, core + `descriptor::` + `host::tests::` 78/78; WARP + `VICTORY_D3D12_DEBUG=1`: 37/37 passed. Minor doc nit (non-blocking): the PR description still says *"keeps its planes and the back buffer alive on its list until that has run"*, which can be trimmed to match `c7d538c2`.
imjustprism commented 2026-11-26 11:04:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-26T10:21:08Z.


ran the title with this on an rx 9070 xt, head c7d538c merged onto 63bcca4 plus #2122 (this card's driver crashes in its shader compiler without that one). diag build with the diagnostics feature, no other switches, series-x, scripted key presses, warm shader and pipeline caches, about 5 minutes in the world per run.

with VICTORY_GPU_OVERLAP=1 the title runs: the world comes up, no device removed, no crash, no fence wait that hangs, dropped draws in the same range as before. i did not compare pictures. it is not faster here, as you expected. frame ms from the frame lines, by draws per frame, because the scene moves at a different pace in each run and time does not line up:

draws per frame frame ms, before frame ms, overlap on frame lines before / on
500 to 800 150 160 20 / 15
800 to 1100 176 203 17 / 16
1100 to 1500 216 269 12 / 7
1500 to 2500 300 321 6 / 8
2500 to 3500 368 298 2 / 7

one run each, so i would not read the 10 to 25 percent in the middle rows as a real loss, only that there is no gain. the title's process used 27 to 47 percent of the card's 3d engine in the world with overlap on and 26 to 48 before, so the gpu still idles for about half of the frame.

one thing only shows with overlap on: "two or more queues hold work at the present" is logged on nearly every world frame, 5,546 times in the run, and "a queue holds work at the present" 34 times. both are zero before and zero with the switch off. a late frame's held-work line has 5 held at the present, 11 segments released by "completed" and 139 lists reset or released while held, in a frame of 14 submissions and 178 segments.

with the switch off, one run looked like main in the world (only 14 world lines, so no table). another never entered the world in 11 minutes: the title loaded (as many shaders translated as on main) and stayed on the screen before the world at 30 fps. my scripted key presses stop at 300 s, and with this merged the world came later in the two runs that got there (307 and 335 s after the first frame line, against 251, 267 and 293 s in three runs without it), so that run may simply have missed the last key press. i can't tell from this whether loading is slower with it or the machine was busier; saying it in case someone else sees the same.

for what would make it pay in this title: a world frame here has a median of 16 host submissions and 182 list segments, and the frame is about 56 ms preparing, 82 ms on the gpu and 35 ms copying back, added up. the snapshots and marks per submission you name at the end of the description look like the part this title needs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7189249958 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7189249958). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-26T10:21:08Z. --- ran the title with this on an rx 9070 xt, head c7d538c merged onto 63bcca4 plus #2122 (this card's driver crashes in its shader compiler without that one). diag build with the diagnostics feature, no other switches, series-x, scripted key presses, warm shader and pipeline caches, about 5 minutes in the world per run. with `VICTORY_GPU_OVERLAP=1` the title runs: the world comes up, no device removed, no crash, no fence wait that hangs, dropped draws in the same range as before. i did not compare pictures. it is not faster here, as you expected. frame ms from the frame lines, by draws per frame, because the scene moves at a different pace in each run and time does not line up: | draws per frame | frame ms, before | frame ms, overlap on | frame lines before / on | |---|---|---|---| | 500 to 800 | 150 | 160 | 20 / 15 | | 800 to 1100 | 176 | 203 | 17 / 16 | | 1100 to 1500 | 216 | 269 | 12 / 7 | | 1500 to 2500 | 300 | 321 | 6 / 8 | | 2500 to 3500 | 368 | 298 | 2 / 7 | one run each, so i would not read the 10 to 25 percent in the middle rows as a real loss, only that there is no gain. the title's process used 27 to 47 percent of the card's 3d engine in the world with overlap on and 26 to 48 before, so the gpu still idles for about half of the frame. one thing only shows with overlap on: "two or more queues hold work at the present" is logged on nearly every world frame, 5,546 times in the run, and "a queue holds work at the present" 34 times. both are zero before and zero with the switch off. a late frame's held-work line has 5 held at the present, 11 segments released by "completed" and 139 lists reset or released while held, in a frame of 14 submissions and 178 segments. with the switch off, one run looked like main in the world (only 14 world lines, so no table). another never entered the world in 11 minutes: the title loaded (as many shaders translated as on main) and stayed on the screen before the world at 30 fps. my scripted key presses stop at 300 s, and with this merged the world came later in the two runs that got there (307 and 335 s after the first frame line, against 251, 267 and 293 s in three runs without it), so that run may simply have missed the last key press. i can't tell from this whether loading is slower with it or the machine was busier; saying it in case someone else sees the same. for what would make it pay in this title: a world frame here has a median of 16 host submissions and 182 list segments, and the frame is about 56 ms preparing, 82 ms on the gpu and 35 ms copying back, added up. the snapshots and marks per submission you name at the end of the description look like the part this title needs.
0xkn0wh3r3 commented 2026-11-26 11:04:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T10:23:03Z.


@imjustprism thank you, this is the run Marvisak asked for in point 3. My summary for that point, from your run (c7d538c2, which includes the fixes for fuzeofficlal's re-review): with VICTORY_GPU_OVERLAP=1 the world runs, with no device removal, crash, hung fence wait or new dropped draws, and no gain on an RX 9070 XT. Frame times are within run-to-run spread, the GPU is still idle about half the frame, and one run each isn't enough to read the middle rows as a loss.

No gain matches your read. A world submission writes title memory when it completes (copy-backs, write marks, bottom-of-pipe writes), so with this PR it still completes before the next one is prepared. Only the title's own CPU time between submissions overlaps the GPU. The 56 ms of preparing and 35 ms of copy-back a frame stay serial. Snapshots and marks per submission are the part this title needs, and they aren't in this PR.

Held work at the present is expected with overlap, but it shows a real gap:

  • A queue's segment that waits for a memory value or a fence another queue's list writes or signals now waits until that list's submission has completed, not just been submitted. The 11 segments released by "completed" in your frame line are those.
  • At PresentX the producing submission is often still in flight, so the waiting work is still held. That's the 5,546 "hold work at the present" lines. With the switch off, every submission completes inside the pump, so nothing is left held by then.
  • PresentX doesn't wait for work its queue still holds (an existing shortcut: it shows the frame as far as it has run). With overlap that now happens nearly every frame, so a frame can be shown before held work that should have finished it, such as late compute or a pass behind a queue Wait. Did you notice frames that looked a frame behind, or flicker, in places? If this goes ahead, the fix is to queue PresentX behind the work its queue holds instead of running it at once. I'd do that here before overlap could be turned on, unless Marvisak prefers to leave it out.

Switch off, never entering the world: with the switch off, this PR differs from main in a few places:

  • the present lists rotate, and each keeps its frame's textures;
  • eviction takes pending read marks first;
  • held work is pumped after completions;
  • some expected pipeline-library messages are not stored;
  • a fence wait with no event now blocks until the value is reached, where it used to return E_NOTIMPL at once.

That last one is the only one that could hang: a thread blocking on a value nothing will signal. If the slow load happens again with the switch off, a dump or a debugger's thread list would show whether a title thread is sitting in SetEventOnCompletion. That would settle whether it's this or just the 300 s key script, given the later world entry you saw.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7189292558 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7189292558). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T10:23:03Z. --- @imjustprism thank you, this is the run Marvisak asked for in point 3. My summary for that point, from your run (c7d538c2, which includes the fixes for fuzeofficlal's re-review): **with `VICTORY_GPU_OVERLAP=1` the world runs, with no device removal, crash, hung fence wait or new dropped draws, and no gain on an RX 9070 XT.** Frame times are within run-to-run spread, the GPU is still idle about half the frame, and one run each isn't enough to read the middle rows as a loss. **No gain** matches your read. A world submission writes title memory when it completes (copy-backs, write marks, bottom-of-pipe writes), so with this PR it still completes before the next one is prepared. Only the title's own CPU time between submissions overlaps the GPU. The 56 ms of preparing and 35 ms of copy-back a frame stay serial. Snapshots and marks per submission are the part this title needs, and they aren't in this PR. **Held work at the present** is expected with overlap, but it shows a real gap: - A queue's segment that waits for a memory value or a fence another queue's list writes or signals now waits until that list's submission has *completed*, not just been submitted. The 11 segments released by "completed" in your frame line are those. - At PresentX the producing submission is often still in flight, so the waiting work is still held. That's the 5,546 "hold work at the present" lines. With the switch off, every submission completes inside the pump, so nothing is left held by then. - PresentX doesn't wait for work its queue still holds (an existing shortcut: it shows the frame as far as it has run). With overlap that now happens nearly every frame, so a frame can be shown before held work that should have finished it, such as late compute or a pass behind a queue Wait. Did you notice frames that looked a frame behind, or flicker, in places? If this goes ahead, the fix is to queue PresentX behind the work its queue holds instead of running it at once. I'd do that here before overlap could be turned on, unless Marvisak prefers to leave it out. **Switch off, never entering the world:** with the switch off, this PR differs from `main` in a few places: - the present lists rotate, and each keeps its frame's textures; - eviction takes pending read marks first; - held work is pumped after completions; - some expected pipeline-library messages are not stored; - a fence wait with no event now blocks until the value is reached, where it used to return `E_NOTIMPL` at once. That last one is the only one that could hang: a thread blocking on a value nothing will signal. If the slow load happens again with the switch off, a dump or a debugger's thread list would show whether a title thread is sitting in `SetEventOnCompletion`. That would settle whether it's this or just the 300 s key script, given the later world entry you saw.
0xkn0wh3r3 commented 2026-11-26 13:04:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T12:43:42Z.


PresentX now waits behind the work its queue holds, in 20af9470.

  • With overlap on, a PresentX on a queue that still holds work is held there too, as an action in the queue's order. The frame is shown once the work before it has gone to the host GPU, and anything the title submits to that queue afterwards runs after the present.
  • The planes' states are still taken at the call. The present keeps its textures until it has run, so the title can release them meanwhile.
  • With the switch off, a present runs at once, as on main.
  • The frame line has a new presents_held count of presents queued this way.

Tests: a_present_waits_behind_the_work_its_queue_holds queues a present behind a fence wait on a title queue. It checks that the present stays queued after the title releases the presented texture, and that it runs once the fence moves; with the deferral switched off, the test fails. an_action_waits_for_the_work_before_it checks the order in the held-work queue. Lib tests (parallel, single-threaded, and with VICTORY_GPU_OVERLAP=0) and both clippy configurations pass, apart from the failures that also happen on main listed in the description. The conformance suite passes with the switch off and on, including a 5 s window run with overlap on (295 frames presented).

One problem to flag: in 1 of 5 conformance runs with overlap on, the process crashed with an access violation at exit, after every test had passed. Those runs don't call PresentX (no window), so this change isn't involved. It still needs to be found before overlap is turned on.

@imjustprism, if you have time for another run at this head with VICTORY_GPU_OVERLAP=1, the frame line's presents_held and the "held at the present" lines would show how often this happens in the title, and whether frames still look a step behind or flicker.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192380807 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192380807). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T12:43:42Z. --- PresentX now waits behind the work its queue holds, in 20af9470. - With overlap on, a PresentX on a queue that still holds work is held there too, as an action in the queue's order. The frame is shown once the work before it has gone to the host GPU, and anything the title submits to that queue afterwards runs after the present. - The planes' states are still taken at the call. The present keeps its textures until it has run, so the title can release them meanwhile. - With the switch off, a present runs at once, as on `main`. - The frame line has a new `presents_held` count of presents queued this way. Tests: `a_present_waits_behind_the_work_its_queue_holds` queues a present behind a fence wait on a title queue. It checks that the present stays queued after the title releases the presented texture, and that it runs once the fence moves; with the deferral switched off, the test fails. `an_action_waits_for_the_work_before_it` checks the order in the held-work queue. Lib tests (parallel, single-threaded, and with `VICTORY_GPU_OVERLAP=0`) and both clippy configurations pass, apart from the failures that also happen on `main` listed in the description. The conformance suite passes with the switch off and on, including a 5 s window run with overlap on (295 frames presented). One problem to flag: in 1 of 5 conformance runs with overlap on, the process crashed with an access violation at exit, after every test had passed. Those runs don't call PresentX (no window), so this change isn't involved. It still needs to be found before overlap is turned on. @imjustprism, if you have time for another run at this head with `VICTORY_GPU_OVERLAP=1`, the frame line's `presents_held` and the "held at the present" lines would show how often this happens in the title, and whether frames still look a step behind or flicker.
neonbyte1 commented 2026-11-26 13:04:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T12:44:43Z.


GTA VI in-game A/B with this PR, as asked in the description. Linux, RTX 5090 (driver 620.73.04), GE-Proton11-14 Wine with its vkd3d-proton.

Setup:

  • Build: main plus a few unmerged PRs needed on this setup (#2723, #439, #2118, #2703, #2101, #2312 and others), with this PR merged on top. There were no conflicts. diag build.
  • Scene: the lit prison yard after the opening.
  • Runs: four 10-minute runs, alternating off and on, with no VICTORY_GPU_TIMING and captures only at frames 1500 and 1700. Medians are over the last 30 frame-rate lines of each run.
Run VICTORY_GPU_OVERLAP ms/frame preparing on the GPU copying back
1 off (first run of this build) 891.5 67.9 770.8 50.2
2 on 796.7 65.4 670.2 58.9
3 off 819.1 66.9 703.6 49.6
4 on 784.8 67.0 656.6 52.4

Both "on" runs beat both "off" runs. Against the warm "off" run (3), it's about 28 ms per frame (3–4%). The time comes out of "on the GPU", meaning the CPU waits less, while preparation and copy-back are unchanged. That fits your note that bottom-of-pipe writes limit the overlap in this title.

Frame-rate lines:

off: 1.2 fps, 824.8 ms/frame (62.9 preparing: copies 26.2 ms 120.7 MB, textures 1.4 ms 1.4 MB; 711.1 on the GPU; 49.4 copying back 0.0 MB), 4808 draws/frame, dropped 379 without a host pipeline (6 being made) and 50 indirect
on:  1.3 fps, 790.3 ms/frame (66.0 preparing: copies 39.7 ms 152.1 MB, textures 0.9 ms 0.9 MB; 651.1 on the GPU; 60.9 copying back 0.0 MB), 4967 draws/frame, dropped 380 without a host pipeline (6 being made) and 49 indirect

(This tree doesn't have #2721, so there are no slow frame lines.)

Safety:

  • No device removal, Xid, exception or hang in any of the four runs.
  • The captured frames show the same scene in both modes, not black or stale.
  • a black frame after a frame that was not warnings vary between runs in both modes (3–30), so they're not tied to the switch.
  • With overlap on, the frame draws about 160 more draws, and per-frame copies rise from about 120 to 152 MB.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192403592 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192403592). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-26T12:44:43Z. --- GTA VI in-game A/B with this PR, as asked in the description. Linux, RTX 5090 (driver 620.73.04), GE-Proton11-14 Wine with its vkd3d-proton. **Setup:** - **Build:** `main` plus a few unmerged PRs needed on this setup (#2723, #439, #2118, #2703, #2101, #2312 and others), with this PR merged on top. There were no conflicts. `diag` build. - **Scene:** the lit prison yard after the opening. - **Runs:** four 10-minute runs, alternating off and on, with no `VICTORY_GPU_TIMING` and captures only at frames 1500 and 1700. Medians are over the last 30 frame-rate lines of each run. | Run | `VICTORY_GPU_OVERLAP` | ms/frame | preparing | on the GPU | copying back | |---|---|---|---|---|---| | 1 | off (first run of this build) | 891.5 | 67.9 | 770.8 | 50.2 | | 2 | **on** | **796.7** | 65.4 | 670.2 | 58.9 | | 3 | off | 819.1 | 66.9 | 703.6 | 49.6 | | 4 | **on** | **784.8** | 67.0 | 656.6 | 52.4 | Both "on" runs beat both "off" runs. Against the warm "off" run (3), it's about 28 ms per frame (3–4%). The time comes out of "on the GPU", meaning the CPU waits less, while preparation and copy-back are unchanged. That fits your note that bottom-of-pipe writes limit the overlap in this title. **Frame-rate lines:** ``` off: 1.2 fps, 824.8 ms/frame (62.9 preparing: copies 26.2 ms 120.7 MB, textures 1.4 ms 1.4 MB; 711.1 on the GPU; 49.4 copying back 0.0 MB), 4808 draws/frame, dropped 379 without a host pipeline (6 being made) and 50 indirect on: 1.3 fps, 790.3 ms/frame (66.0 preparing: copies 39.7 ms 152.1 MB, textures 0.9 ms 0.9 MB; 651.1 on the GPU; 60.9 copying back 0.0 MB), 4967 draws/frame, dropped 380 without a host pipeline (6 being made) and 49 indirect ``` (This tree doesn't have #2721, so there are no `slow frame` lines.) **Safety:** - No device removal, Xid, exception or hang in any of the four runs. - The captured frames show the same scene in both modes, not black or stale. - `a black frame after a frame that was not` warnings vary between runs in both modes (3–30), so they're not tied to the switch. - With overlap on, the frame draws about 160 more draws, and per-frame copies rise from about 120 to 152 MB. _AI-assisted (Claude); measured on my machine, no game data shared._
0xkn0wh3r3 commented 2026-11-26 13:04:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T12:47:29Z.


@neonbyte1, thank you for this. Four alternating 10-minute runs with medians is exactly the comparison that was needed, and the safety checks (no removal, Xid or hang, the same scene in the captures) are as useful as the timings.

Your numbers fit what this PR can do in this title. A world submission that writes back to title memory still completes before the next one is prepared, so only part of the GPU wait goes away: in your runs, about 33-47 ms of "on the GPU" against the warm run with it off. Preparing and copying back stay in series. That is in line with imjustprism's run on an RX 9070 XT, which showed no gain and no faults.

I've added a "Measured in the title" section to the description with both runs, credited, and with the one-host, one-or-two-runs caveat.

One question: which head of this PR did you merge? 20af9470 went up shortly before your comment and changes how a present behaves with overlap on: it now waits behind work its queue still holds. If yours was earlier, a run at the current head would also show whether that costs anything. Its frame line has a presents_held count.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192464473 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192464473). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T12:47:29Z. --- @neonbyte1, thank you for this. Four alternating 10-minute runs with medians is exactly the comparison that was needed, and the safety checks (no removal, Xid or hang, the same scene in the captures) are as useful as the timings. Your numbers fit what this PR can do in this title. A world submission that writes back to title memory still completes before the next one is prepared, so only part of the GPU wait goes away: in your runs, about 33-47 ms of "on the GPU" against the warm run with it off. Preparing and copying back stay in series. That is in line with imjustprism's run on an RX 9070 XT, which showed no gain and no faults. I've added a "Measured in the title" section to the description with both runs, credited, and with the one-host, one-or-two-runs caveat. One question: which head of this PR did you merge? 20af9470 went up shortly before your comment and changes how a present behaves with overlap on: it now waits behind work its queue still holds. If yours was earlier, a run at the current head would also show whether that costs anything. Its frame line has a `presents_held` count.
neonbyte1 commented 2026-11-26 14:01:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T13:32:35Z.


A note on the A/B above: it tested this PR at c7d538c ("a present list does not hold the back buffer; completions are flagged once done"), one commit before the current head 20af947. So it doesn't include the newer change where a present waits behind the work its queue holds. I'll rerun on the current head and post the numbers.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7193495220 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7193495220). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-26T13:32:35Z. --- A note on the A/B above: it tested this PR at `c7d538c` ("a present list does not hold the back buffer; completions are flagged once done"), one commit before the current head `20af947`. So it doesn't include the newer change where a present waits behind the work its queue holds. I'll rerun on the current head and post the numbers. _AI-assisted (Claude); measured on my machine, no game data shared._
imjustprism commented 2026-11-26 15:02:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-26T15:02:02Z.


@0xkn0wh3r3 ran 20af947 with VICTORY_GPU_OVERLAP=1, same setup as my first run: merged onto 63bcca4 plus #2122, diag build with the diagnostics feature, rx 9070 xt, series-x, the same scripted key presses, warm shader and pipeline caches. i had to stop this run by hand after 4.4 minutes in the world, so it is a short one: 1,054 world frames, 42 frame lines.

no device removed, no error lines, no fence wait that hangs, dropped draws per frame as before.

in the world
frames with presents_held = 1 942 of 1,054 (89%)
"held at the present" in the held-work line median 5 per frame, 0 in 34 frames
"two or more queues hold work at the present" warnings 4,336, about 4 per frame
fence_waits 0 in every frame

so here nearly every world present is queued behind work its queue holds, and the warning still comes on nearly every frame at this head.

frame ms from the frame lines by draws per frame. still no gain on this card, and with one short run i would not read more into it:

draws per frame frame ms on the gpu ms frame lines
500 to 800 153 62 9
1100 to 1500 257 110 8
1500 to 2500 327 116 15
2500 to 3500 378 155 5
above 3500 377 178 3

not done yet: whether frames look a step behind or flicker. i did not watch the picture in this run. i will capture runs of consecutive world frames with the switch on and off, compare neighbours, and add the result here.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7195684043 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7195684043). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-26T15:02:02Z. --- @0xkn0wh3r3 ran 20af947 with `VICTORY_GPU_OVERLAP=1`, same setup as my first run: merged onto 63bcca4 plus #2122, diag build with the diagnostics feature, rx 9070 xt, series-x, the same scripted key presses, warm shader and pipeline caches. i had to stop this run by hand after 4.4 minutes in the world, so it is a short one: 1,054 world frames, 42 frame lines. no device removed, no error lines, no fence wait that hangs, dropped draws per frame as before. | in the world | | |---|---| | frames with `presents_held` = 1 | 942 of 1,054 (89%) | | "held at the present" in the held-work line | median 5 per frame, 0 in 34 frames | | "two or more queues hold work at the present" warnings | 4,336, about 4 per frame | | `fence_waits` | 0 in every frame | so here nearly every world present is queued behind work its queue holds, and the warning still comes on nearly every frame at this head. frame ms from the frame lines by draws per frame. still no gain on this card, and with one short run i would not read more into it: | draws per frame | frame ms | on the gpu ms | frame lines | |---|---|---|---| | 500 to 800 | 153 | 62 | 9 | | 1100 to 1500 | 257 | 110 | 8 | | 1500 to 2500 | 327 | 116 | 15 | | 2500 to 3500 | 378 | 155 | 5 | | above 3500 | 377 | 178 | 3 | not done yet: whether frames look a step behind or flicker. i did not watch the picture in this run. i will capture runs of consecutive world frames with the switch on and off, compare neighbours, and add the result here.
Jackster commented 2026-11-26 16:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T15:37:43Z.


On the retail title, overlap does not hide the GPU and costs the copy path

Setup: 63bcca4 + this PR, RX 7900 XTX (1002:744c, driver 32.0.32029.2010), Windows 10 26300.10075, retail 1.0.2.1, diagnostics build, warm shader cache, same save, 300 s, VICTORY_GPU_OVERLAP=1 (the log confirms it: "the title's submissions complete after they return"). Control is the same tree and save without the switch, run either side of it.

63bcca4 + this PR, overlap on
frame (last report) 1,229.5 ms 1,769.9 ms
preparing 368.5 ms 700.8 ms
copies 203.0 ms / 379.7 MB 492.1 ms / 597.0 MB
on the GPU 161.6 ms 155.7 ms
copying back 119.9 ms 118.0 ms
draws / dropped 3,926 / 949 3,789 / 1,072

The GPU time is unchanged, which is the point: the frame has only ~120-160 ms of drain to hide, so overlap cannot win much, while the copies and preparation roughly double. My reading is that with submissions still in flight, the ranges a later submission must refresh are no longer settled when it is prepared, so more is copied — 597 MB against 380 MB.

Caveats: one run each and the scenes differ a little (3,926 against 3,789 draws), so the direction is clearer than the magnitude. If you want a matched pair I can alternate the switch three times on the same save, and quote the whole distribution rather than the last line.

Written with an AI assistant.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7196531194 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7196531194). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T15:37:43Z. --- **On the retail title, overlap does not hide the GPU and costs the copy path** Setup: `63bcca4` + this PR, RX 7900 XTX (`1002:744c`, driver 32.0.32029.2010), Windows 10 26300.10075, retail 1.0.2.1, diagnostics build, warm shader cache, same save, 300 s, `VICTORY_GPU_OVERLAP=1` (the log confirms it: "the title's submissions complete after they return"). Control is the same tree and save without the switch, run either side of it. | | `63bcca4` | + this PR, overlap on | |---|---|---| | frame (last report) | 1,229.5 ms | **1,769.9 ms** | | preparing | 368.5 ms | 700.8 ms | | copies | 203.0 ms / 379.7 MB | **492.1 ms / 597.0 MB** | | on the GPU | 161.6 ms | 155.7 ms | | copying back | 119.9 ms | 118.0 ms | | draws / dropped | 3,926 / 949 | 3,789 / 1,072 | The GPU time is unchanged, which is the point: the frame has only ~120-160 ms of drain to hide, so overlap cannot win much, while the copies and preparation roughly double. My reading is that with submissions still in flight, the ranges a later submission must refresh are no longer settled when it is prepared, so more is copied — 597 MB against 380 MB. Caveats: one run each and the scenes differ a little (3,926 against 3,789 draws), so the direction is clearer than the magnitude. If you want a matched pair I can alternate the switch three times on the same save, and quote the whole distribution rather than the last line. Written with an AI assistant.
Kajanos commented 2026-11-26 17:36:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Kajanos on 2026-11-26T17:36:44Z.


World run with VICTORY_GPU_OVERLAP=1 on Windows 11 / RTX 5080: the switch is active and stable, but frames do not overlap. The title waits at present on memory its own GPU work writes.

Setup: Windows 11 Home build 26300, RTX 5080 16 GB, NVIDIA 621.40, Ryzen 9 9950X3D, 64 GB. Retail 1.0.2.1, Series X, diag build, hand-played to the same spot in the world (about 3,000 draws/frame), about 3 min per run, no VICTORY_GPU_TIMING.

Build: main 63bcca4 + #3147 2eb38bb (needed on this 32-lane card) + #3047 + #3048 + this PR at 20af947 + #2051. This PR conflicts with #3147 in shadow.rs: #3147's only change there is HEAP_VIEWS → HEAP_VIEWS_MAX in three places. I took this PR's file and applied those three lines (the bitmap size, read_marks, take_reads). cargo test --release -p victory-gpu -- shadow: 12 passed.

With the switch on (the title's submissions complete after they return (VICTORY_GPU_OVERLAP) in the log):

Frame line ms/frame preparing on the GPU copying back sum of the three
2.9 fps 344.3 98.7 188.0 40.6 327.3
3.0 fps 331.9 94.8 194.8 38.5 328.1
2.9 fps 349.7 103.9 179.4 36.1 319.4

The frame stays 4–30 ms above preparing + GPU + copy back, so nothing runs alongside. A build of the same base with B's CPU-side PRs and without this PR, switch off, ran at 3.0–3.2 fps with ms/frame ≈ the sum (GPU 190–202, copying back 24–26). With overlap on, the GPU time is 5–15 ms lower but copying back is 12–20 ms higher, so the net result is the same. The off run of this exact build was too short and not at the spot, so it is left out.

What holds it, from the log:

  • 1,409 × two or more queues hold work at the present (1,062 on queue=2, 337 on queue=0), waited_ms median 133, p90 369, max 1,106. A typical one: frame=1407 queue=2 items=3 waited_ms=189 unmet=["0xd0417fe10 cmp 7 0x582 (is Some(1409))"]. The present waits for a title memory value that work on queue 2 writes.
  • 422 × held work this frame, e.g. segments that waited, and how many each reason released [("submission", 10)].

That fits your note that the gain stays small while world submissions write title memory when they complete: here the next present waits for exactly such a value. No device removal, exception, hang, crashes.log or new dropped draws (148 untranslated programs, as with the switch off). One line at exit, method not implemented object="command queue" slot=0xb8, also appears in runs without this PR.

AI-assisted (Claude Code)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7199321385 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7199321385). Originally posted by [Kajanos](https://github.com/Kajanos) on 2026-11-26T17:36:44Z. --- **World run with `VICTORY_GPU_OVERLAP=1` on Windows 11 / RTX 5080: the switch is active and stable, but frames do not overlap. The title waits at present on memory its own GPU work writes.** Setup: Windows 11 Home build 26300, RTX 5080 16 GB, NVIDIA 621.40, Ryzen 9 9950X3D, 64 GB. Retail 1.0.2.1, Series X, diag build, hand-played to the same spot in the world (about 3,000 draws/frame), about 3 min per run, no `VICTORY_GPU_TIMING`. Build: `main` `63bcca4` + #3147 `2eb38bb` (needed on this 32-lane card) + #3047 + #3048 + this PR at `20af947` + #2051. This PR conflicts with #3147 in `shadow.rs`: #3147's only change there is `HEAP_VIEWS` → `HEAP_VIEWS_MAX` in three places. I took this PR's file and applied those three lines (the bitmap size, `read_marks`, `take_reads`). `cargo test --release -p victory-gpu -- shadow`: 12 passed. With the switch on (`the title's submissions complete after they return (VICTORY_GPU_OVERLAP)` in the log): | Frame line | ms/frame | preparing | on the GPU | copying back | sum of the three | |---|---:|---:|---:|---:|---:| | 2.9 fps | 344.3 | 98.7 | 188.0 | 40.6 | 327.3 | | 3.0 fps | 331.9 | 94.8 | 194.8 | 38.5 | 328.1 | | 2.9 fps | 349.7 | 103.9 | 179.4 | 36.1 | 319.4 | The frame stays 4–30 ms above preparing + GPU + copy back, so nothing runs alongside. A build of the same base with B's CPU-side PRs and without this PR, switch off, ran at 3.0–3.2 fps with ms/frame ≈ the sum (GPU 190–202, copying back 24–26). With overlap on, the GPU time is 5–15 ms lower but copying back is 12–20 ms higher, so the net result is the same. The off run of this exact build was too short and not at the spot, so it is left out. What holds it, from the log: - 1,409 × `two or more queues hold work at the present` (1,062 on `queue=2`, 337 on `queue=0`), `waited_ms` median 133, p90 369, max 1,106. A typical one: `frame=1407 queue=2 items=3 waited_ms=189 unmet=["0xd0417fe10 cmp 7 0x582 (is Some(1409))"]`. The present waits for a title memory value that work on queue 2 writes. - 422 × `held work this frame`, e.g. `segments that waited, and how many each reason released [("submission", 10)]`. That fits your note that the gain stays small while world submissions write title memory when they complete: here the next present waits for exactly such a value. No device removal, exception, hang, `crashes.log` or new dropped draws (148 untranslated programs, as with the switch off). One line at exit, `method not implemented object="command queue" slot=0xb8`, also appears in runs without this PR. AI-assisted (Claude Code)
imjustprism commented 2026-11-26 17:45:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-26T17:45:39Z.


the flicker check for 20af947. two more runs of the same build, one with VICTORY_GPU_OVERLAP=1 and one without, each saving two blocks of 32 consecutive world frames (VICTORY_CAPTURE_WORLD, frames 100 to 131 and 300 to 331 after the first world frame). in each block i compared every frame with its neighbours: the mean absolute difference per channel on a 0 to 255 scale, and for each frame an outlier score, the smaller of its differences to its two neighbours divided by the difference between those two. a frame that flickers differs from both neighbours while they agree with each other, and scores far above 1.

overlap on, block 1 overlap on, block 2 off, block 1 off, block 2
difference to the next frame, median 0.64 1.12 5.08 5.62
difference to the next frame, max 0.72 1.19 42.1 26.5
outlier score, max 1.08 1.09 1.37 0.92
frames scoring above 3 0 0 0 0

no flicker in the 64 frames with overlap on: the shot is nearly still there and every frame differs from the next by about the same small amount. the two runs entered the world at different moments (the scripted keys land differently), so the blocks are not the same shots, and the larger numbers with the switch off come from a shot that fades and moves, not from the switch. what this cannot show is a picture that is evenly one frame late. i looked at one frame of each run and both are complete pictures.

in the overlap run presents_held was 1 on 429 of 739 world frames and the "hold work at the present" warning came 2,087 times; with the switch off both are 0 over 1,418 world frames. no error lines and no device removed in either run. same setup as above (63bcca4 plus #2122, diag build, rx 9070 xt, series-x, warm caches), about 3 to 4 minutes in the world each.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7199595765 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7199595765). Originally posted by [imjustprism](https://github.com/imjustprism) on 2026-11-26T17:45:39Z. --- the flicker check for 20af947. two more runs of the same build, one with `VICTORY_GPU_OVERLAP=1` and one without, each saving two blocks of 32 consecutive world frames (`VICTORY_CAPTURE_WORLD`, frames 100 to 131 and 300 to 331 after the first world frame). in each block i compared every frame with its neighbours: the mean absolute difference per channel on a 0 to 255 scale, and for each frame an outlier score, the smaller of its differences to its two neighbours divided by the difference between those two. a frame that flickers differs from both neighbours while they agree with each other, and scores far above 1. | | overlap on, block 1 | overlap on, block 2 | off, block 1 | off, block 2 | |---|---|---|---|---| | difference to the next frame, median | 0.64 | 1.12 | 5.08 | 5.62 | | difference to the next frame, max | 0.72 | 1.19 | 42.1 | 26.5 | | outlier score, max | 1.08 | 1.09 | 1.37 | 0.92 | | frames scoring above 3 | 0 | 0 | 0 | 0 | no flicker in the 64 frames with overlap on: the shot is nearly still there and every frame differs from the next by about the same small amount. the two runs entered the world at different moments (the scripted keys land differently), so the blocks are not the same shots, and the larger numbers with the switch off come from a shot that fades and moves, not from the switch. what this cannot show is a picture that is evenly one frame late. i looked at one frame of each run and both are complete pictures. in the overlap run `presents_held` was 1 on 429 of 739 world frames and the "hold work at the present" warning came 2,087 times; with the switch off both are 0 over 1,418 world frames. no error lines and no device removed in either run. same setup as above (63bcca4 plus #2122, diag build, rx 9070 xt, series-x, warm caches), about 3 to 4 minutes in the world each.
0xkn0wh3r3 commented 2026-11-26 18:06:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T18:06:37Z.


Thank you all. This is the in-game evidence the description asked for, and I've put it in a "Measured in the title" section, with each of you credited and linked.

Summary: no host showed a fault with overlap on. Only neonbyte1's showed a gain, and that was small. Jackster's was slower, and the others showed no gain. On this evidence, overlap does not pay in this title as it stands, so it should stay off by default (it is).

@imjustprism, thanks for the rerun and the flicker check. presents_held on 89% of world frames (58% in the second run) confirms the case 20af9470 is for, and 64 consecutive frames with no outlier means queued presents don't flicker. Agreed that a picture evenly one frame late can't be seen this way.

@Kajanos, thanks, and for the note on the #3147 conflict: whichever lands second takes those three HEAP_VIEWS_MAX lines. On what holds the present, a correction to the reading:

  • The unmet wait in your example is on queue 2 (compute): 0xd0417fe10 >= 0x582 while the value is 0x581. That is the next value, which a graphics submission still in flight at the present writes when it completes. With overlap off, that write lands at submission, which is why the warning only shows with it on. The compute work is released by that completion shortly after.
  • The present itself waits only when its own queue holds work: your 337 cases on queue=0.
  • The frame staying at preparing + GPU + copying back added up has a different cause. Each world submission writes title memory when it completes (copy-backs, bottom-of-pipe writes), so it completes before the next one is prepared, and the three stay in series. That is the limit the description names, and your run shows it plainly.

@Jackster, agreed on the GPU time: there is little to hide. The copies are the new finding.

  • I don't think the cause is unsettled ranges. A submission whose completion writes title memory completes before the next one is prepared, and this PR doesn't change what a refresh copies.
  • My guess is that with overlap on, held work is released in more, smaller host submissions (by completions), and each one copies again the pages the title rewrote since the last one. neonbyte1's copies grew too (120 to 152 MB).
  • If you have time for the matched pair you offered (three alternations on the same save), the held-work line's pieces (host submissions) and segments from both modes, next to the copies, would confirm or rule that out.

@neonbyte1, thanks for the correction about the head; the description now says c7d538c2.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7200063752 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7200063752). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T18:06:37Z. --- Thank you all. This is the in-game evidence the description asked for, and I've put it in a "Measured in the title" section, with each of you credited and linked. **Summary:** no host showed a fault with overlap on. Only neonbyte1's showed a gain, and that was small. Jackster's was slower, and the others showed no gain. On this evidence, overlap does not pay in this title as it stands, so it should stay off by default (it is). @imjustprism, thanks for the rerun and the flicker check. `presents_held` on 89% of world frames (58% in the second run) confirms the case 20af9470 is for, and 64 consecutive frames with no outlier means queued presents don't flicker. Agreed that a picture evenly one frame late can't be seen this way. @Kajanos, thanks, and for the note on the #3147 conflict: whichever lands second takes those three `HEAP_VIEWS_MAX` lines. On what holds the present, a correction to the reading: - The unmet wait in your example is on **queue 2** (compute): `0xd0417fe10 >= 0x582` while the value is 0x581. That is the next value, which a graphics submission still in flight at the present writes when it completes. With overlap off, that write lands at submission, which is why the warning only shows with it on. The compute work is released by that completion shortly after. - The present itself waits only when **its own queue** holds work: your 337 cases on `queue=0`. - The frame staying at preparing + GPU + copying back added up has a different cause. Each world submission writes title memory when it completes (copy-backs, bottom-of-pipe writes), so it completes before the next one is prepared, and the three stay in series. That is the limit the description names, and your run shows it plainly. @Jackster, agreed on the GPU time: there is little to hide. The copies are the new finding. - I don't think the cause is unsettled ranges. A submission whose completion writes title memory completes before the next one is prepared, and this PR doesn't change what a refresh copies. - My guess is that with overlap on, held work is released in more, smaller host submissions (by completions), and each one copies again the pages the title rewrote since the last one. neonbyte1's copies grew too (120 to 152 MB). - If you have time for the matched pair you offered (three alternations on the same save), the held-work line's `pieces` (host submissions) and `segments` from both modes, next to the copies, would confirm or rule that out. @neonbyte1, thanks for the correction about the head; the description now says c7d538c2.
neonbyte1 commented 2026-11-26 19:31:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T19:31:06Z.


Rerun at the current head 20af947 on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with vkd3d-proton. Same base as my earlier numbers (main plus a few unmerged PRs this setup needs), with this PR merged cleanly on top.

Method: 10-minute runs in the opening yard, alternating on/off with VICTORY_GPU_OVERLAP=1 / 0, untimed and without frame captures (in diagnostics builds, overlap() is off under VICTORY_GPU_TIMING and on listed capture frames). Medians of the last 30 frame-rate reports.

run overlap ms/frame on the GPU fps
1 on 707.5 585.5 1.4
2 off 857.8 737.2 1.2
3 on 726.3 609.4 1.4
4 off 861.1 740.7 1.2

So about 16% less frame time with overlap on, consistent across both pairs. Earlier, at c7d538c, I measured 797/785 against 891/819. "On the GPU" drops by about the same amount as the frame because the CPU waits less for the GPU, not because the GPU does less work.

No Xid, no device removal, and the same refusals in all four runs.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7201676308 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7201676308). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-26T19:31:06Z. --- Rerun at the current head `20af947` on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with vkd3d-proton. Same base as my earlier numbers (`main` plus a few unmerged PRs this setup needs), with this PR merged cleanly on top. **Method:** 10-minute runs in the opening yard, alternating on/off with `VICTORY_GPU_OVERLAP=1` / `0`, untimed and without frame captures (in diagnostics builds, `overlap()` is off under `VICTORY_GPU_TIMING` and on listed capture frames). Medians of the last 30 frame-rate reports. | run | overlap | ms/frame | on the GPU | fps | |---|---|---|---|---| | 1 | on | 707.5 | 585.5 | 1.4 | | 2 | off | 857.8 | 737.2 | 1.2 | | 3 | on | 726.3 | 609.4 | 1.4 | | 4 | off | 861.1 | 740.7 | 1.2 | So about **16% less frame time with overlap on**, consistent across both pairs. Earlier, at `c7d538c`, I measured 797/785 against 891/819. "On the GPU" drops by about the same amount as the frame because the CPU waits less for the GPU, not because the GPU does less work. No Xid, no device removal, and the same refusals in all four runs. _AI-assisted (Claude); measured on my machine, no game data shared._
0xkn0wh3r3 commented 2026-11-27 07:06:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-27T07:06:20Z.


@neonbyte1, thank you for the rerun at 20af9470, and for keeping the method the same: alternating pairs, no timing, no capture frames.

About 16% less frame time with overlap on, in both pairs, corrects my summary above. Overlap isn't a no-gain change everywhere: on your host it clearly helps, while Kajanos's and imjustprism's gained nothing and Jackster's got slower. I've updated the "Measured in the title" section to match.

A likely reason your host gains and the others don't: on yours, waiting for the GPU is most of the frame with it off (about 740 of 860 ms). On Kajanos's it is about 190 of 330 ms, and on Jackster's 160 of 1,230. Overlap can only hide that wait, and yours has the most of it.

Between your two sessions, the off runs went from 819 to about 860 ms and the on runs from about 790 to about 717 ms. So I'd read the 16% within this session, and not as 20af9470 being faster than c7d538c2.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7212147039 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7212147039). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-27T07:06:20Z. --- @neonbyte1, thank you for the rerun at 20af9470, and for keeping the method the same: alternating pairs, no timing, no capture frames. About 16% less frame time with overlap on, in both pairs, corrects my summary above. Overlap isn't a no-gain change everywhere: on your host it clearly helps, while Kajanos's and imjustprism's gained nothing and Jackster's got slower. I've updated the "Measured in the title" section to match. A likely reason your host gains and the others don't: on yours, waiting for the GPU is most of the frame with it off (about 740 of 860 ms). On Kajanos's it is about 190 of 330 ms, and on Jackster's 160 of 1,230. Overlap can only hide that wait, and yours has the most of it. Between your two sessions, the off runs went from 819 to about 860 ms and the on runs from about 790 to about 717 ms. So I'd read the 16% within this session, and not as 20af9470 being faster than c7d538c2.
zed6000 commented 2026-11-27 17:48:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-27T17:48:17Z.


An AMD data point for this PR combined with #3102, which nobody had tried yet. The idea was that #3102's copies in video memory might remove the title-memory writes that keep submissions from overlapping. They don't: no gain.

Setup: RX 7900 XTX (driver 32.0.32029.2010), Windows 11, intro cutscene, Series X profile, diagnostics builds, warm caches. Runs alternate, each figure is the median of 36 frame-report lines, and each build sits in its own target folder (the exes differ). The combination is this PR at 20af947 with #3102 at 669f428 merged onto it. Its two conflicts in host.rs are trivial (runs → all). It needs one real fix: #3102's snapshot list, built in the submit path, now travels in InFlight to Host::finish, where it is pulled and ended. With that, victory-gpu --lib passes 277 tests.

build ms/frame (run 1, run 2) preparing GPU copying back
main 437, 418 199–203 149–154 62–66
this PR, VICTORY_GPU_OVERLAP=1 459, 424 200–210 150 61–62
+ #3102 (default: read-only copies in video memory) 494, 418 199–213 149 62–63
+ #3102, VICTORY_GPU_UPLOAD_WRITES=1 427, 425 205 149 62–65

All within run-to-run noise. Preparing, the GPU and copying back still add up to the frame, so nothing runs alongside. Overlap is active (the "held work this frame" lines appear), and there are 0 errors and 0 dropped draws in every run.

Why, from the log: about 345 draws and dispatches a frame write title memory, and about 270 of them come from just four compute programs. Every submission that holds one has GpuWrite steps, so HostList::heavy makes it complete before the next submission is prepared. #3102's copies in video memory still produce those steps, so the combination stays serial. That fits this PR's own note that snapshots and bitmaps per submission would lift it: here that's the piece that decides whether overlap can pay off.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7224804005 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7224804005). Originally posted by [zed6000](https://github.com/zed6000) on 2026-11-27T17:48:17Z. --- An AMD data point for this PR combined with #3102, which nobody had tried yet. The idea was that #3102's copies in video memory might remove the title-memory writes that keep submissions from overlapping. **They don't: no gain.** **Setup:** RX 7900 XTX (driver 32.0.32029.2010), Windows 11, intro cutscene, Series X profile, diagnostics builds, warm caches. Runs alternate, each figure is the median of 36 frame-report lines, and each build sits in its own target folder (the exes differ). The combination is this PR at `20af947` with #3102 at `669f428` merged onto it. Its two conflicts in `host.rs` are trivial (`runs` → `all`). It needs one real fix: #3102's snapshot list, built in the submit path, now travels in `InFlight` to `Host::finish`, where it is pulled and ended. With that, `victory-gpu --lib` passes 277 tests. | build | ms/frame (run 1, run 2) | preparing | GPU | copying back | |---|---|---:|---:|---:| | `main` | 437, 418 | 199–203 | 149–154 | 62–66 | | this PR, `VICTORY_GPU_OVERLAP=1` | 459, 424 | 200–210 | 150 | 61–62 | | + #3102 (default: read-only copies in video memory) | 494, 418 | 199–213 | 149 | 62–63 | | + #3102, `VICTORY_GPU_UPLOAD_WRITES=1` | 427, 425 | 205 | 149 | 62–65 | All within run-to-run noise. Preparing, the GPU and copying back still add up to the frame, so nothing runs alongside. Overlap is active (the "held work this frame" lines appear), and there are 0 errors and 0 dropped draws in every run. **Why, from the log:** about 345 draws and dispatches a frame write title memory, and about 270 of them come from just four compute programs. Every submission that holds one has `GpuWrite` steps, so `HostList::heavy` makes it complete before the next submission is prepared. #3102's copies in video memory still produce those steps, so the combination stays serial. That fits this PR's own note that snapshots and bitmaps per submission would lift it: here that's the piece that decides whether overlap can pay off.
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/3120:upstream-pr/3120'
git switch 'upstream-pr/3120'

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