GPU: honor command-list 64-bit memory waits without blocking submissions (#700) #1388
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1388"
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?
Imported from Marvisak/VIctory. Originally posted by wbkepler on 2026-11-24T17:41:01Z.
Summary
Rebased cleanly onto
upstream/main(ffe310e):wait_value64, slot 72) with full 64-bitD3D12_COMPARISON_FUNCevaluation,Acquire/Releasememory ordering, and segmentedHostList/CpuOpexecution.victory-gpu-waitscheduler so submitting CPU threads never deadlock on consumer-first submission orders.draw::State::rebind_segment, clearsfresh_tablesper segment, and ties upload/HostList/dynamic-slot lifetimes toArc-retained segments.queue::testscovering full 64-bit comparison ops, both producer-first and consumer-first 2-queue ordering (#700), and mid-list pre-wait work preservation.Verification
cargo clippy -p victory-gpu --all-targets&-p victory --features diagnostics --all-targets— passedcargo test -p victory-gpu— passedVICTORY_D3D12_DEBUG=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib queue— passedcargo xtask policy— passedImported from Marvisak/VIctory. Originally posted by HenriqueSBueno on 2026-11-24T19:22:46Z.
Field data for this PR from a retail run (RTX 3080, Series S profile,
main@ffe310e+ #189 + #89 + this PR, diag build).I added a counter at the point where this PR defers a list tail behind an unsatisfied 64-bit memory wait, and a queue-level
ID3D12CommandQueue::Waitimplemented as the same kind of wait on the fence's value (GREATER_EQUAL) through this PR's pending stream:held=32)Queue::Wait)So on this title the producer/consumer ordering goes through command-list memory waits, not queue fence waits. Without this PR those consumers ran before their producers. That matches #700 and the "GPU waits on itself in the wrong order" explanation for the black world.
This run did not light the world by itself: the stack is plain
mainwithout translator changes (603 shaders refused, so the lighting compute passes are still dropped), and the GPU was removed at ~300 s after reaching the world. The next step on our side is to combine this PR with our translator changes. Background and the related hypotheses are in #1317 (H-6.14, H-6.7).AI-assisted (Claude Code)
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:49:54Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; this is source review of a large diff plus the PR's own Windows tests.
64-bit command-list memory waits (D3D12_WRITEBUFFERIMMEDIATE-style address/comparison/reference) no longer block submissions: waits are recorded as MemoryWait and split host command-list segments (decision 0007), with persistent graphics state re-applied per segment and queue::notify_memory_waiters on satisfaction (Acquire fence). compare()/satisfied() implement the D3D12 comparison funcs. This is a substantial scheduling change — the segment-split correctness (state replay, CPU segments) needs the Windows playability runs; statically the design is coherent.
Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-24T20:55:36Z.
Tested in the title on a 6 GB / 16 GB laptop (RTX 3050, diag build, title 1.0.2.1, story load). Full table: https://github.com/Marvisak/VIctory/issues/700#issuecomment-7144235622.
mainffe310e+ #208 + the wave64 stack + #452 + #579 + #431, this PR (9d84135, clean merge) lost the device in 2 of 2 runs without DRED: at 2:46 and 3:29,0x887A0007, after submissions of 29 and 3 lists. The same tree without it ran 7:26 and 8:21 (2 runs) to a title stop, with no removal.VICTORY_D3D12_DRED=1did not reproduce it (9:29, no removal), so it looks timing-dependent, and I have no DRED breadcrumbs for it.HostListthroughhost.new_list()(two allocators, two lists). This title records thousands of waits per load, so reusing segment lists might be where the time goes. Not measured separately.AI use: Claude Code (Claude Opus 5.5) ran the title on my machine and drafted this; results are from the runs described.
Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-25T01:14:07Z.
Rebased onto main
42363ab6and ran it on AMD. It conflicted in 9 places; four of them needed more than picking a side. #700 is still open on main (wait_valueis still the empty stub), so this seemed worth carrying forward.What the rebase had to change
list.rsuploads. Main replaced theVec<u8>upload blocks withUpload(VirtualAlloc'd, notClone), soArc<Vec<Vec<u8>>>plusArc::make_mutno longer works. Uploads are nowVec<Arc<Upload>>(pub(crate) type Uploads).Arcs, and reset just clears the list's ownVec.draw.rsdynamic slots. This PR moves them fromStateto the host list segment (keep_dynamic). Main has since added two more users ofState::dynamic: root views (root_view,ROOT_VIEW_RUN) andclear_unordered. Both now calllist.keep_dynamic(..).rebind_segmentnow also resetsroot_runandroot_slots. Otherwise a new segment keeps handing out slots from a run the sealed segment owns, and those slots are freed when that segment retires.Deferred::dropgives slots of our own view heap (memory::OURS) back tomemory::heap(), as main's oldState::dropdid.descriptor::release_dynamicdoesn't know that heap.list.rscreate_listkeeps main's initialset_pipeline.resetkeepspipeline::bound.external.rsuses the nowArc-returninghost_list(madepub(crate)).host.rskeeps main's frame dump and then callsnotify_memory_waiters, after thesubmittedlock is dropped.draw.rskeeps main's diagnostics lines.Results on
42363ab6+ this, RX 6750 XT (RDNA2), Windows 11, Rust 1.98.1 MSVC:command_list_memory_wait_orders_producer_and_consumer_both_waysandmid_list_memory_wait_preserves_pre_wait_work_and_releases_post_wait_tail(the producer-first and consumer-first cases from #700): 8 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.Not covered: how this interacts with #1828 (asynchronous submissions). Both rework
host.rssubmission, so whichever lands second will need a rebase. Not tested with the title.The rebase on top of a plain
git merge -X theirsof this PR into42363ab6(what differs from taking this PR's side of every conflict)Unit tests only, no game files. AI-assisted (Claude rebased it; I ran it on my machine).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:25:02Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-gpu/src/draw.rs,crates/victory-gpu/src/host.rs,crates/victory-gpu/src/list.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View 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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.