GPU: with VICTORY_GPU_OVERLAP=1, the title's submissions return before the host GPU has run them #3120
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3120
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3120"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@0xkn0wh3r3 on GitHub · 2026-11-26 08:51 UTC · original
0xkn0wh3r3:gpu/submission-overlap→main· +1329 −196 · 8 files · 9 commits · openWith
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.
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
main. The frame line counts queued presents.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.
c7d538c2,20af9470c7d538c220af9470What the runs show:
20af9470.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 head92137df3:VICTORY_GPU_OVERLAP=1Every 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
VICTORY_GPU_OVERLAP=0.cargo test -p victory-gpu --lib, in parallel and single-threaded, with and withoutVICTORY_GPU_OVERLAP=0: everything passes exceptdynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, which fail the same way onmainon this card (its view heap is smaller thanHEAP_VIEWS).views_bound_while_another_slot_gets_its_texture_do_not_waitandframe::tests::waits_end_on_ticks_and_count_framesfail now and then onmaintoo.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.GPU: the title's submissions return before the host GPU has run themto GPU: with VICTORY_GPU_OVERLAP=1, the title's submissions return before the host GPU has run them@fuzeofficlal on GitHub · 2026-11-26 09:05 UTC · original · requested changes
Really strong async submission architecture overall — the
Arc::try_unwraphandling inlist::recyclekeepsPresenter's copy ring out ofSPARE,retire_anyattaches evicted textures cleanly to the currentInFlight.retired(so they outlive earlier submissions on the single queue), and the newhold_gpugate 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) andcargo xtask policy(191 files ok): clean.fence::,hold::,queue::,resource::,shadow::passed 46/46 serially and 28/28 in parallel (includinga_submission_completes_after_it_returns).VICTORY_D3D12_DEBUG=1(--features diagnostics):fence::,hold::,queue::,resource::,shadow::passed 46/46.VICTORY_D3D12_DEBUG=1:host::present_plane_tests::compositor_failure_presents_primary_in_the_same_framestill exits2173(pre-existing#3084gap:ResizeBufferswaits for submitted copy lists viacomplete_all(), not for the queuedPresentafter them).Three real concurrency/lifetime issues turned up during code review that should be fixed before merging:
1. Async
present_with_compositordoes not keep sourceplanesalive oncopy(crates/victory-gpu/src/host.rs:3785-3985)Previously
present_with_compositorcalled synchronousself.execute(&[&p.copy]), so&ID3D12Resourceentries inplanesstayed alive until the copy/composite finished on the GPU. Now that it submits asynchronously viaself.submit(0, vec![copy.clone()])and returns whilecopyis still in flight,copynever callscopy.keep(tex)on any plane inplanes(nor on&backif anything could drop it). If the title releases or evicts a presented texture beforecopyfinishes on the host GPU, the GPU reads a destroyed resource. Addingfor &(tex, _) in planes { copy.keep(tex); }beforecopy.close()closes this UAF window.2. Non-atomic
&mut [u32]+std::mem::takeon read-mark bitmaps while the GPU writes them (crates/victory-gpu/src/shadow.rs:828-885)With overlapping submissions, the host GPU can execute
InterlockedOron the mapped read-mark bitmap concurrently withtake_reads()/reads_since(). Forming&mut [u32]viastd::slice::from_raw_parts_mutand runningstd::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]withword.swap(0, Ordering::AcqRel)eliminates both the UB and the lost-bit window on coherent memory.3. Completions drained by
complete_whiledo not pump held queue work (crates/victory-gpu/src/host.rs:544-550, 598-612)complete_in_backgroundcallscrate::queue::pump_held_if_free(Why::Completed)after drainingsubmitted.flight, whereascomplete_while(used bycomplete_all,complete_held,Host::execute, andHost::submit) does not. If a non-queue::pumpcaller (such asPresentcallingcomplete_held/complete_all, orHost::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_backgroundwakes to an emptyflight(completed == false) and skips pumping — leaving held work stalled until the next title call or background timer tick. Callingpump_held_if_free(Why::Completed)aftercomplete_all/complete_held/executefinishes any in-flight record (oncesubmittedis dropped) closes this gap.@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 (includinga_submission_completes_after_it_returnsanda_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 andqueue::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).
@0xkn0wh3r3 on GitHub · 2026-11-26 09:09 UTC · original
Thanks for testing on the 5090 and WARP. All three are fixed in
a75fc056: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.take_reads,reads_sinceand the test helpermark_readnow see the read marks as&[AtomicU32].reads_sinceloads each word and swaps in 0 only where a word is set;take_readsloads and does afetch_andfor 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.finishnotes that a submission completed.execute,submit,complete_allandcomplete_heldthen callpump_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 exceptdynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, which fail the same way onmainon this card (its view heap is smaller thanHEAP_VIEWS). Workspace clippy is clean with and without--features victory-gpu/diagnostics.Agreed on
compositor_failure_presents_primary_in_the_same_frameunder the debug layer: that's #3084, and this PR doesn't change it.@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::submitreturn before the host GPU has run a submission.complete_in_backgrounddoes copy-backs and sets title fences later,HostList::heavysubmissions complete before the next one is prepared, andfence.rsgains a blockingSetEventOnCompletionwait. The ordering incomplete_while/finishis consistent: copy-backs, then work after the lists, then title fences, all under the submission lock. Moving retired objects into eachInFlightandkeep_until_resetalso look right. Still needed:main's submission model, so the maintainer has to decide on it.docs/submission-overlap.mdand ademobranch, and neither is inmain. Please remove the reference, since design documents do not go into the repo.mainplus this change, with overlap on and off, and no new fence or copy-back problems.shadow::read_marksnow treats the mapped bitmap asAtomicU32, 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:
checkpassing.Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 09:29 UTC · original
Thanks. All four points are addressed in
cb88757dand92137df3, and the description is updated:Decision. Overlap is now off by default. Without
VICTORY_GPU_OVERLAP=1, every submission is waited for as onmain, 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.Docs. The module doc and the description no longer point to a design document or another branch.
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
mainplus this PR, once withVICTORY_GPU_OVERLAP=1and once without, and post the frame-rate and slow-frame lines, plus any fence or copy-back problems?Read marks. I took the second option. The CPU now clears read marks only when no submission whose shaders mark reads is in flight:
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.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_sinceand the order inHost::execute, so whichever of the two lands second will need a merge there.@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
d362e501the timer submitted the copy only after the workers resumed. Ona75fc056the foreground thread submitted it beforecomplete_all()returned, with release reasonCompleted. Four runs per revision per adapter on the RTX 4090 Laptop and WARP, plus one more each with explicit opt-in oncb88757d. Test and reproduction.One follow-up for
92137df3: an actualCompletedrelease 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.@fuzeofficlal on GitHub · 2026-11-26 09:39 UTC · original · requested changes
Re-reviewed through
92137df3. Making overlap opt-in (VICTORY_GPU_OVERLAP=1), movingshadow.rsread marks to&[AtomicU32]with quiet-only clearing, keepingplanesalive on the present list, and avoiding frame stalls in92137df3are all solid improvements.However, two regressions/bugs were caught in
a75fc056..92137df3:1.
copy.keep(&back)breaksResizeBufferson every swap-chain resize (reproduced on RTX 5090 and WARP, even withVICTORY_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 incopy.deferred().keep, which is only cleared whencopy.reset()runs. When a resize is needed (host.rs:3814-3828),self.complete_all()waits for in-flight work but never clearskeeponp.copies, so the ring's present lists still hold references to the old back buffers whenp.swap_chain.ResizeBuffers(...)is called, causing it to fail withDXGI_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):overlap=1,debug=0anddebug=1): FAILED athost.rs:4708(compositor initialization can be retried after failure)overlap=1andoverlap=0,debug=0anddebug=1): FAILED athost.rs:4708Note this also breaks the default non-overlap path (
VICTORY_GPU_OVERLAP=0) becausecopy.keep(&back)runs unconditionally. Clearingkeepon every list inp.copiesright afterself.complete_all()(beforeResizeBuffers) — or releasingkeepon completion — fixes it.2. Lost-wakeup race on
COMPLETEDinHost::finish(host.rs:1171-1185, 1790, 1933-1935)COMPLETED.store(true, Ordering::Relaxed)runs on the very first line ofHost::finish(host.rs:1790), beforeself.wait_for(record.value), copy-backs, bottom-of-pipe writes, andset_title_fence(fence, value)(host.rs:1934).If Thread A drops the
submittedlock after S1 (just before callingpump_after_completions()) while Thread B entersfinish()for S2, setsCOMPLETED = true, and blocks inwait_for(S2)(potentially milliseconds):COMPLETED.swap(false, Relaxed)-> observestrue, resets it tofalse, and callspump_held_if_freebefore S2's writes or fence signals happen.wait_for(S2), performs S2's writes andset_title_fence, dropssubmitted, and callspump_after_completions()->swap(false)returnsfalse, skippingpump_held_if_freeand leaving S2's held work un-woken.Moving
COMPLETED.store(true, Ordering::Release)to the end offinish()(after theset_title_fenceloop) and pairing it withCOMPLETED.swap(false, Ordering::AcqRel)inpump_after_completions()ensures any thread that consumes the flag is guaranteed to observe all writes and fence signals fromfinish()before pumping.Other verification on
92137df3:cargo clippy --workspace --all-targets [--all-features] -- -D warnings: clean;cargo xtask policy:191 files okfence::+hold::+queue::+resource::+shadow::46/46 passed (includinga_submission_completes_after_it_returns)--features diagnostics,VICTORY_D3D12_DEBUG=1): 81/82 passed acrosshost::+fence::+hold::+queue::+resource::+shadow::(the sole failure iscompositor_failure_presents_primary_in_the_same_frameabove).@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]withby[r.2 as usize] += 1, so the first present after aCompletedrelease 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::ALLlists 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_bysizes its counts withWhy::ALL.len()and labels them withWhy::name, an exhaustive match. The frame line now shows names with counts (for example[("completed", 1)]) instead of a fixed list of labels.every_reason_held_work_is_released_by_is_counted_in_the_frame_linereleases with every reason, includingCompleted, 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 onmainon this card. Workspace clippy is clean with and without--features victory-gpu/diagnostics.@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 in26c88f1f.--features diagnostics,compositor_failure_presents_primary_in_the_same_framefailed 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 atResizeBuffers. The test now gets past 4708. On this machine it then exits with 2173, which plainmain(63bcca43) does too: that is #3084, as you said.finishnow setsCOMPLETEDlast, withRelease, after the copy-backs, the bottom-of-pipe writes and the title fences.pump_after_completionstakes it withswap(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 twofinishcalls: it would need hooks insidefinishto 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 diagnosticsand overlap on.placed_uav_textures_create_real_host_uavsfailed in 5 of 6 runs on a debug-layer message from another test:CreatePipelineLibrarygiven 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::libraryexpects 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 onmainon this card. Workspace clippy is clean with and without the diagnostics feature.@passerbyyhx on GitHub · 2026-11-26 09:49 UTC · original
Confirmed on
26c88f1fand closed fork PRs #10 and #11 as requested. Your frame-line test passed in regular Windows and diagnostics builds, including an explicitVICTORY_GPU_OVERLAP=0run. With overlap enabled, I also reran the foreground two-queue fixture on the 4090 Laptop and WARP: both recordedCompletedon the calling thread before the background workers resumed, with all 64 bytes correct. Thanks for fixing this.@imjustprism on GitHub · 2026-11-26 10:21 UTC · original
ran the title with this on an rx 9070 xt, head
c7d538cmerged onto63bcca4plus #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=1the 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: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.
@fuzeofficlal on GitHub · 2026-11-26 10:22 UTC · original · approved these changes
Re-reviewed
92137df3..c7d538c2and re-verified on Windows 11 (RTX 5090 + WARP + D3D12 Debug Layer). Both blockers from the previous pass are cleanly resolved, and26c88f1falso closes a real out-of-bounds indexing panic inaccount_framewhenWhy::Completedreleases held work.What was verified
host.rs:4060-4068): removingcopy.keep(&back)while keeping plane textures (for &(texture, _) in planes { copy.keep(texture); }) eliminates the dangling back-buffer COM references acrossResizeBuffers.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 withVICTORY_GPU_OVERLAP=0(0.30–0.33s), and 3/3 on WARP (0.05–0.06s).host.rs:1207,host.rs:1960): movingCOMPLETED.store(true, Ordering::Release)to the end ofHost::finish(afterwait_for, copy-backs, bottom-of-pipe writes, andset_title_fence) paired withCOMPLETED.swap(false, Ordering::AcqRel)inpump_after_completionsremoves the premature-clear race.queue.rs:89-137,queue.rs:346):Why::ALLwith the compile-time discriminant check andreleased_byfixes the[0u32; 6]out-of-bounds panic forWhy::Completed.git merge-treeagainstorigin/main63bcca43clean):cargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): clean;cargo xtask policy: 191 files ok.OVERLAP=1):draw::tests::20/20;queue::/fence::/hold::/resource::tests::/shadow::/host::tests::/a_submission_completes_after_it_returns77/77 (only the pre-existing NVIDIA 1M-capdescriptor::host::tests::dynamic_slots_are_held_until_releasedfails).VICTORY_GPU_OVERLAP=0):queue::/fence::/resource::tests::27/27.VICTORY_D3D12_DEBUG=1: 47/47 passed with no unexpected debug-layer errors.--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.@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): withVICTORY_GPU_OVERLAP=1the 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:
Switch off, never entering the world: with the switch off, this PR differs from
mainin a few places:E_NOTIMPLat 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 12:43 UTC · original
PresentX now waits behind the work its queue holds, in
20af9470.main.presents_heldcount of presents queued this way.Tests:
a_present_waits_behind_the_work_its_queue_holdsqueues 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_itchecks the order in the held-work queue. Lib tests (parallel, single-threaded, and withVICTORY_GPU_OVERLAP=0) and both clippy configurations pass, apart from the failures that also happen onmainlisted 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'spresents_heldand the "held at the present" lines would show how often this happens in the title, and whether frames still look a step behind or flicker.@neonbyte1 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:
mainplus 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.diagbuild.VICTORY_GPU_TIMINGand captures only at frames 1500 and 1700. Medians are over the last 30 frame-rate lines of each run.VICTORY_GPU_OVERLAPBoth "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:
(This tree doesn't have #2721, so there are no
slow framelines.)Safety:
a black frame after a frame that was notwarnings vary between runs in both modes (3–30), so they're not tied to the switch.AI-assisted (Claude); measured on my machine, no game data shared.
@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?
20af9470went 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 apresents_heldcount.@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 head20af947. So it doesn't include the newer change where a present waits behind the work its queue holds. I'll rerun on the current head and post the numbers.AI-assisted (Claude); measured on my machine, no game data shared.
@imjustprism on GitHub · 2026-11-26 15:02 UTC · original
@0xkn0wh3r3 ran
20af947withVICTORY_GPU_OVERLAP=1, same setup as my first run: merged onto63bcca4plus #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.
presents_held= 1fence_waitsso 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:
not done yet: whether frames look a step behind or flicker. i did not watch the picture in this run. i will capture runs of consecutive world frames with the switch on and off, compare neighbours, and add the result here.
@Jackster 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.63bcca4The GPU time is unchanged, which is the point: the frame has only ~120-160 ms of drain to hide, so overlap cannot win much, while the copies and preparation roughly double. My reading is that with submissions still in flight, the ranges a later submission must refresh are no longer settled when it is prepared, so more is copied — 597 MB against 380 MB.
Caveats: one run each and the scenes differ a little (3,926 against 3,789 draws), so the direction is clearer than the magnitude. If you want a matched pair I can alternate the switch three times on the same save, and quote the whole distribution rather than the last line.
Written with an AI assistant.
@Kajanos on GitHub · 2026-11-26 17:36 UTC · original
World run with
VICTORY_GPU_OVERLAP=1on 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:
main63bcca4+ #31472eb38bb(needed on this 32-lane card) + #3047 + #3048 + this PR at20af947+ #2051. This PR conflicts with #3147 inshadow.rs: #3147's only change there isHEAP_VIEWS→HEAP_VIEWS_MAXin 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):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:
two or more queues hold work at the present(1,062 onqueue=2, 337 onqueue=0),waited_msmedian 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.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.logor new dropped draws (148 untranslated programs, as with the switch off). One line at exit,method not implemented object="command queue" slot=0xb8, also appears in runs without this PR.AI-assisted (Claude Code)
@imjustprism on GitHub · 2026-11-26 17:45 UTC · original
the flicker check for
20af947. two more runs of the same build, one withVICTORY_GPU_OVERLAP=1and 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.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_heldwas 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 (63bcca4plus #2122, diag build, rx 9070 xt, series-x, warm caches), about 3 to 4 minutes in the world each.@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_heldon 89% of world frames (58% in the second run) confirms the case20af9470is 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_MAXlines. On what holds the present, a correction to the reading:0xd0417fe10 >= 0x582while 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.queue=0.@Jackster, agreed on the GPU time: there is little to hide. The copies are the new finding.
pieces(host submissions) andsegmentsfrom both modes, next to the copies, would confirm or rule that out.@neonbyte1, thanks for the correction about the head; the description now says
c7d538c2.@neonbyte1 on GitHub · 2026-11-26 19:31 UTC · original
Rerun at the current head
20af947on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with vkd3d-proton. Same base as my earlier numbers (mainplus 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 underVICTORY_GPU_TIMINGand on listed capture frames). Medians of the last 30 frame-rate reports.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.
maincan take merges more often #3347View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.