Repository navigation
Conversation
Submissions are no longer waited for: each signals the next host fence value and joins a timeline of up to 16 in flight, finished in order (copy back, then bottom-of-pipe writes, then title fence signals) by a finisher thread or whichever thread first needs one. Allocators, preludes, scratch, kept objects, twins, dynamic descriptor leases and retired heap resources are released behind their submission's fence. A step touching title memory, host copies or texture staging waits only for in-flight submissions that write (or read) it. Rebased onto the page table, bindless heap views, twins and change journal: a list's after-run work and missed-memory checks move into the pending submission; bindless texture uploads, view heap refreshes and page table refreshes wait for in-flight writers like other steps, a page table is rewritten only with no reader in flight, and a page table user counts as writing every copy it names. A list named again in one submission gets its own prelude, and what its steps write into the list's own memory (upload memory, scratch, budget word) goes into an upload buffer of the submission that the repeat's prelude copies in on the GPU, so each run reads its own data with no CPU wait. List memory is a CPU-visible custom heap the GPU can copy into. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Grand Theft Auto VI submits from one thread: for each batch it calls ExecuteX, PresentX and Signal, and only then gives its ring slots back to the producers its main thread waits on (#1118). With submissions asynchronous, `Host::present` still drained every submission after `Present`, so that thread waited for the frame's whole GPU time inside PresentX. The title waits for its fences, not for the present, so the shortcut's condition holds: a present now finishes the previous frame's submissions (and its copy, whose list it reuses) before it records this frame's, and leaves this frame's running. ResizeBuffers still drains; a saved capture settles its frame before reading it back. The copy list now holds the presented texture, since the title may release it while the copy still runs. Diagnostics: the black-frame probe of a frame is read at the next present, once that frame's work has finished, and reported with that frame's own number, resource and draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VIctory V2: community PRs, merged and testedOpen PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: Unofficial community fork of Marvisak/VIctory, GPL-3.0. |
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Present waits for the previous frame's GPU work before flipping: sync fix for frame pacing; check it doesn't serialize the queue unnecessarily.
|
Ran this on AMD hardware. One of the PR's own tests fails there; I found why and have a small fix, tested on the same card. Setup: main 70564ae + this PR (dfac3b4, 3a85ae5; merges cleanly). RX 6750 XT (RDNA2, driver 32.0.21045.29003), Windows 11, Rust 1.98.1 MSVC. What fails. Narrowing it down. I ran a print-only diagnostic with the test's lists and
So it isn't a memory or cache problem. The lists before the cut don't run when the same list is submitted again in the next Why. The My best explanation, which I haven't verified inside the driver: AMD chains the lists of one call by patching their ends. Resubmitting Fix. Before a later group (the cut a repeat makes), wait on the CPU for the previous group's fence. Only submissions that name a list twice wait; every other submission stays asynchronous. The two-preludes test held the first group behind a gate and asserted that nothing waits, so with the fix it can't finish. It now runs without the gate and checks the same things: the repeat makes its own prelude (counted from the spares pool once it has run), and the final texture state is COPY_SOURCE. Results with the fix, same card:
Patch on top of this PR (host.rs)--- a/crates/victory-gpu/src/host.rs
+++ b/crates/victory-gpu/src/host.rs
@@ -1057,6 +1057,16 @@
let started = std::time::Instant::now();
#[cfg(feature = "diagnostics")]
crate::resource::life::note(0, crate::resource::life::SUBMITTED, *submitted, 0);
+ // A later group starts with a list the earlier one names (a
+ // repeat). The driver may patch submitted lists, and the GPU must
+ // not be reading one from a previous execution when it is
+ // submitted again (`ExecuteCommandLists`): resubmitted while the
+ // earlier group was pending, the lists before the cut never ran
+ // on an RX 6750 XT. A GPU-side wait is not enough, the patching
+ // happens at submission.
+ if i > 0 {
+ self.wait_gpu(*submitted - 1, true);
+ }
// SAFETY: closed lists, not running (waited for above); our fence.
let signalled = unsafe {
#[cfg(test)]
@@ -3639,8 +3649,9 @@
}
/// A submission naming one list twice: the repeat's prelude records into
- /// its own allocator and list while the first is still pending, so both
- /// run with their own barriers, and nothing waits on the CPU.
+ /// its own allocator and list, so both runs get their own barriers. The
+ /// repeat's group is submitted once the first has run (a list must not
+ /// be resubmitted while the GPU may still read it), so no gate here.
#[test]
fn a_list_named_twice_in_a_submission_has_two_preludes() {
use std::sync::atomic::Ordering;
@@ -3680,20 +3691,15 @@
)]);
}
list.close();
- let gate = Gate::new(host);
// COMMON -> RENDER_TARGET before the first run, COPY_SOURCE ->
// RENDER_TARGET before the second: two different barriers.
- host.execute_gated(&[&list, &list], &gate.0);
- assert!(list.running());
- let mut spares = 0;
- host.timeline.each_work(|w| {
- if w.lists.iter().any(|l| std::ptr::eq(l.0, &list)) {
- spares += w.preludes.len();
- }
- });
- assert_eq!(spares, 1, "the repeat records into its own prelude");
- gate.release();
+ // With no spares, the repeat makes its own prelude, which goes to
+ // the spares once it has run.
+ let kept = std::mem::take(&mut *super::pool(&super::SPARE_PRELUDES));
+ host.execute(&[&list, &list]);
host.drain();
+ let spares = std::mem::replace(&mut *super::pool(&super::SPARE_PRELUDES), kept).len();
+ assert_eq!(spares, 1, "the repeat records into its own prelude");
let copy = crate::resource::host_copy(tex).unwrap();
assert_eq!(copy.state.load(Ordering::Relaxed), 0x800);
// SAFETY: a plain query.Unit tests only, no game files. AI-assisted (Claude found the cause and wrote the fix; I ran everything on my machine). |
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
|
Closing: this was opened against |
Grand Theft Auto VI submits from one thread: for each batch it calls
ExecuteX, PresentX and Signal, and only then gives its ring slots back
to the producers its main thread waits on (#1118). With submissions
asynchronous,
Host::presentstill drained every submission afterPresent, so that thread waited for the frame's whole GPU time insidePresentX. The title waits for its fences, not for the present, so the
shortcut's condition holds: a present now finishes the previous
frame's submissions (and its copy, whose list it reuses) before it
records this frame's, and leaves this frame's running. ResizeBuffers
still drains; a saved capture settles its frame before reading it back.
The copy list now holds the presented texture, since the title may
release it while the copy still runs.
Diagnostics: the black-frame probe of a frame is read at the next
present, once that frame's work has finished, and reported with that
frame's own number, resource and draws.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com