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

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

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 08:51 UTC · original
0xkn0wh3r3:gpu/submission-overlap → main · +1329 −196 · 8 files · 9 commits · open

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, 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) RTX 5090, Linux (vkd3d-proton) c7d538c2 About 28 ms faster a frame (3-4%), four alternating 10-minute runs: 784.8-796.7 ms on against 819.1 ms warm off. Less time on the GPU (656.6-670.2 against 703.6 ms); 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 world barely overlaps. Its 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 stay in series. Only neonbyte1's host showed a gain, and it was small.
  • 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 does not pay in this title as it stands. Per-submission snapshots and marks would be needed first, and the extra copies would need to be explained.

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.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 08:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120) `0xkn0wh3r3:gpu/submission-overlap` → `main` · +1329 −196 · 8 files · 9 commits · open 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, 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://git.gtahub.st/github/Marvisak--VIctory/pulls/3120), [2](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3120), [3](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3120)) | 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://git.gtahub.st/github/Marvisak--VIctory/pulls/3120), [2](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3120)) | RTX 5090, Linux (vkd3d-proton) | c7d538c2 | About 28 ms faster a frame (3-4%), four alternating 10-minute runs: 784.8-796.7 ms on against 819.1 ms warm off. Less time on the GPU (656.6-670.2 against 703.6 ms); copies up from about 120 to 152 MB a frame. | | Jackster ([1](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3120)) | 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://git.gtahub.st/github/Marvisak--VIctory/pulls/3120)) | 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 world barely overlaps.** Its 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 stay in series. Only neonbyte1's host showed a gain, and it was small. - **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 does not pay in this title as it stands. Per-submission snapshots and marks would be needed first, and the extra copies would need to be explained. ### 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.
ExecuteCommandLists no longer waits for the host GPU. A submission's
lists go to the host queue with a Signal of the host fence, and the
title's call returns; the submission completes later (what shaders
wrote goes back to title memory, then the lists' work after them and
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 with no call of its own,
as on the console. A title that keeps frames in flight now gets them:
it records the next frame while the GPU runs the last.

What still needs a submission done first completes it first, waiting
without the submission lock:
- a submission whose completion writes title memory or reads the marks
  bitmaps (copy-backs, write and read marks, title memory through page
  tables, work after its lists, bottom-of-pipe writes) completes before
  the next is prepared, whose refreshes read title memory;
- 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 last run, and a host list for its own.
So only submissions without such writes overlap for now
(docs/submission-overlap.md, phase 3, would lift that with
per-submission snapshots and bitmaps).

- A queue's Signal behind work in flight is owed by the queue's last
  submission and set when it completes, in order.
- A blocking fence wait (SetEventOnCompletion with no event) now blocks
  until the value is reached instead of failing.
- Present copies into the swap chain with a ring of three lists and does
  not wait for the frame; a resize, multi-plane composition and
  diagnostics read-backs still wait for what they need.
- Host textures given up and resources retired while work is in flight
  are released after the next submission completes.
- A list reset while a queue still runs it keeps what it owned until its
  host list is reset, not as work after the list.
- VICTORY_GPU_OVERLAP=0 waits for each submission as before; per-list
  timing and listed capture frames do too.

Tests: a submission held at a GPU gate returns, and its fence and its
copy into a title buffer move only once it has completed; tests that read
results after ExecuteCommandLists now wait for a fence as a title does.
Every list the conformance title's frame records binds the views'
bitmaps (its shaders mark the views they read), so each submission was
completed before the next was prepared and the title's ExecuteCommandLists
still waited for the GPU (23 of 25 ms a frame).

Only write marks need that: taken by an earlier submission's completion
while a later one still writes, they would go back early and be lost to
it. Writes through tables and root views are declared per list, so a list
marks writes only through the heap's views. A list counts as heavy for
marks only with heap indexing; write marks are taken only at the
completion of a heavy (or waited-for) submission. Read marks are taken by
any completion that bound them: taken early, they only make views early.

A present no longer waits for its frame, and with two swap chain buffers
the queue stalled until the shown one was let go (the frame rate stayed
at about 31). Three let the next frame be drawn meanwhile.

Waits for submissions in flight count in the frame-rate line's GPU wait.
The once-a-frame eviction pass clears every read mark of the views'
bitmaps (`shadow::reads_since`), which it ran after the previous
submission's completion had taken them (`shadow::take_reads`). With that
submission still in flight, its marks were cleared before it completed:
a null view only it reads would never be made. The pass now takes them
first, as the completion would, and makes their views.

The bitmaps' safety notes say which marks are taken while a submission
may still set more (read marks: a later call takes them) and which only
with none in flight (write marks, page read marks).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:06 +00:00
github-bot changed title from GPU: the title's submissions return before the host GPU has run them to GPU: with VICTORY_GPU_OVERLAP=1, the title's submissions return before the host GPU has run them 2026-11-26 11:10:41 +00:00
From review:
- A present no longer waits for its copy, so the planes it copies or
  composes (and the back buffer) are kept on the present list until it
  has run: the title may release or give up a presented texture
  meanwhile.
- The views' read marks are taken as atomics (a load, then a swap or an
  and), not through a `&mut [u32]` over memory a submission still in
  flight ORs into: no data race, and no mark set between the read and the
  clear is lost.
- Held queue work is pumped after submissions complete on any thread, not
  only on the completion thread: a value written or a fence signalled by a
  submission that a present, an execute or the next submission completed
  no longer waits for the title's next call or the 2 ms timer.
From triage:
- Submissions are waited for by default, as before; VICTORY_GPU_OVERLAP=1
  lets the title's submissions complete after they return. The swap chain
  keeps two buffers unless overlap is on. Tests run with it on (unless it
  is set to 0): theirs are the paths it adds, and our own lists take the
  waited path.
- The GPU's ORs into the read-mark bitmap are not atomic with the CPU's
  operations, so the CPU now clears read marks only with no submission
  that marks reads in flight: a completion takes the forgotten slots'
  clears only then (else a later one does), and the eviction pass, which
  clears every mark, runs only then; once a frame, the submission it is
  due before completes those first. Reads alone stay safe while a
  submission marks: what is not seen yet is seen by a later call.
- The module doc no longer points to a design document.
The once-a-frame wait for submissions that mark reads, before the
eviction pass clears the marks, fell on the first submission of each
frame: the present's, which then waited for the whole frame it shows
(41 fps where 60 held). It now falls on the title's first submission of
the frame instead.
A completion releasing held work (Why::Completed, index 6) indexed past
the frame line's six counts: the next present panicked, overlap on or
off, since any completion pumps held work. The counts and their names
come from Why::ALL now, checked at compile time to hold every reason at
its own index.
From review:
- The present list kept the swap chain's back buffer until the list was
  next reset, so ResizeBuffers found a reference held and failed
  (overlap on or off; compositor_failure_presents_primary_in_the_same_frame
  at its retry). The swap chain keeps its buffers, and a resize completes
  every list first: only the frame's planes are kept now.
- `Host::finish` flagged its completion first, so another thread's pump
  could take the flag before this completion's writes and fences landed,
  and this completion's own pump find it taken: held work waiting on it
  slept until the next call or the timer. The flag is set last (Release)
  and taken with AcqRel.
- Pipeline library messages the host gives for a library blob it rejects
  (another adapter or driver, damage) are no longer stored by the debug
  info queue: `pipeline::library` expects them and opens an empty library.
  With completions later on another thread, one left there from the
  library tests was found by another test's check for errors.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 09:05 UTC · original · requested changes

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 09:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6071173604) · **requested changes** 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.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 09:08 UTC · original · approved these changes

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).

**@⁠Dukestar69** on GitHub · 2026-11-26 09:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6071236090) · **approved these changes** 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).
Author
Owner

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

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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 09:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7187521295) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 09:20 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-26 09:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7187802642) <!-- 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)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 09:29 UTC · original

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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 09:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188060265) 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.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 09:34 UTC · original

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.

**@⁠passerbyyhx** on GitHub · 2026-11-26 09:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188180803) 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 09:39 UTC · original · requested changes

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).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 09:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6071704815) · **requested changes** 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).
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 09:39 UTC · original

@⁠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** on GitHub · 2026-11-26 09:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188293955) @⁠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`.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 09:45 UTC · original

@⁠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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 09:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188427758) @⁠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.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-26 09:49 UTC · original

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.

**@⁠passerbyyhx** on GitHub · 2026-11-26 09:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7188522061) 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.
Author
Owner

@⁠imjustprism on GitHub · 2026-11-26 10:21 UTC · original

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.

**@⁠imjustprism** on GitHub · 2026-11-26 10:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7189249958) 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 10:22 UTC · original · approved these changes

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 10:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#pullrequestreview-6072345157) · **approved these changes** 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`.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 10:23 UTC · original

@⁠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** on GitHub · 2026-11-26 10:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7189292558) @⁠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.
With overlap on, a queue waiting on another queue's fence or memory value
waits until that submission has completed, which at PresentX it often has
not: imjustprism's run of the title logged work held at the present about
5.5k times. PresentX did not wait behind that work, so the frame could be
shown before its last held work ran.

A PresentX on a queue that holds work is now held there as well, as an
action run in its place once the work before it has gone to the host GPU.
The planes' states are taken at the call, as before. Without overlap a
present still runs at once, as on main. The frame line counts queued
presents.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 12:43 UTC · original

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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 12:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192380807) 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.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 12:44 UTC · original

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.

**@⁠neonbyte1** on GitHub · 2026-11-26 12:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192403592) 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._
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 12:47 UTC · original

@⁠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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 12:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7192464473) @⁠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.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 13:32 UTC · original

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.

**@⁠neonbyte1** on GitHub · 2026-11-26 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7193495220) 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._
Author
Owner

@⁠imjustprism on GitHub · 2026-11-26 15:02 UTC · original

@⁠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.

**@⁠imjustprism** on GitHub · 2026-11-26 15:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7195684043) @⁠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.
Author
Owner

@⁠Jackster on GitHub · 2026-11-26 15:37 UTC · original

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.

**@⁠Jackster** on GitHub · 2026-11-26 15:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7196531194) **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.
Author
Owner

@⁠Kajanos on GitHub · 2026-11-26 17:36 UTC · original

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)

**@⁠Kajanos** on GitHub · 2026-11-26 17:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7199321385) **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)
Author
Owner

@⁠imjustprism on GitHub · 2026-11-26 17:45 UTC · original

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.

**@⁠imjustprism** on GitHub · 2026-11-26 17:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7199595765) 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.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 18:06 UTC · original

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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 18:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7200063752) 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.
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-26 19:31 UTC · original

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.

**@⁠neonbyte1** on GitHub · 2026-11-26 19:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/3120#issuecomment-7201676308) 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._
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3120/head:github-bot/gh-3120'
git switch 'github-bot/gh-3120'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3120'
git switch 'github-bot/gh-3120'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3120'
git switch 'github-bot/gh-3120'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3120'
git switch 'main'
git merge --squash 'github-bot/gh-3120'
git switch 'main'
git merge --ff-only 'github-bot/gh-3120'
git switch 'main'
git merge 'github-bot/gh-3120'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

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