Skip to content

perf(gpu,hle): Phase 1-3 CPU & GPU pipeline optimizations (-45% frame time, -48% GPU list time) - #1053

Open
x0sman wants to merge 2 commits into
fxceless:mainfrom
x0sman:perf/rtx5070-gta6-p123
Open

x0sman wants to merge 2 commits into
fxceless:mainfrom
x0sman:perf/rtx5070-gta6-p123

Conversation

@x0sman

@x0sman x0sman commented Nov 25, 2026

Copy link
Copy Markdown

Summary

Hardware-verified performance & stability optimizations for heavy D3D12 workloads (tested in 95s live 3D gameplay on RTX 5070 Laptop GPU 8 GB / 7,123 MiB VRAM budget, 0 crashes).

Base note: Built on \

…t time)

Hardware-verified on RTX 5070 Laptop GPU (8 GB) in 95s 3D gameplay (0 crashes).

Includes upstream PRs (#1677, fxceless#987, fxceless#188, fxceless#610) plus Phase 1-3 changes:
- descriptor/host.rs: lock-free AtomicU64 + 64-striped slot_locks/kept in HostHeap::mirror
- host.rs & queue.rs: victory-reaper background thread for COM/late-wait drops; Held::Present 2nd MPO plane support for VICTORY_ASYNC_PRESENT=1
- xmem.rs: XMemMapPhysicalPagesScatter single-lock hoisting, no-op skipping, exact 64 KiB placeholder fast path (preserving 64 KiB page independence)
- shadow.rs: move D3D12 buffer allocations (shared_buffer, card_for, window_card_for, place_for) outside BUFFERS/LOOSE write locks
- draw.rs, host.rs, indirect.rs, list.rs: 2-slot isolated indirect_window_scratch ring synced with draw::State::windows, remove post-clamp global UAV(None) barrier, use targeted uav_barrier_for(src/count) via UAV cleanliness tracking, default VICTORY_TEXTURE_STAGE_MB=48

Measured 1000 Hz profile (baseline -> Phase 3):
- usual frame: 183.2 ms -> 102 ms (-45%)
- GPU all other lists: 70.3 ms -> 36.4 ms (-48%)
- GPU card busy: 47% -> 68%
- shadow RwLock wait: 93.46 ms (P1+2) -> 0.00 ms (-100%)
- execute_indirect: 167.05 ms (P1+2) -> 78.10 ms (-53%)
# Conflicts:
#	crates/victory-gpu/src/draw.rs
#	crates/victory-gpu/src/shadow.rs
#	crates/victory-gpu/src/watch.rs
@MKmajster

Copy link
Copy Markdown

Tried on one machine: RTX 3070 8 GB, 16 GB RAM, Series S profile. The tree was main ca8829f with #1016/#1014/#1020/#1032 and the fast switches (INDIRECT_WINDOW, INDIRECT_GATHER, COPY_PLAIN, JOIN_PARTS, BACK_OWN_VIEW, ASYNC_SUBMIT, QUEUE2). Merging this PR on top needed three small resolutions:

Result: a 142 ms median against 144 and 155 ms for two runs without it. That is within this machine's run-to-run spread, so I could not see the −45 % here. Most of what the PR removes may already be gone on this tree with those switches. No errors. The xmem tests (25) pass.

AI-assisted (Claude Code). No game data attached.

ExoCalibra added a commit to ExoCalibra/victory-exo that referenced this pull request Nov 25, 2026
PiloteCode pushed a commit to PiloteCode/victory-fork that referenced this pull request Nov 25, 2026
VICTORY_SKIP_BINK=1 skips the movies that play once (the intro);
VICTORY_SKIP_BINK=all also the looping ones. Unset, nothing changes.

The title's own Bink DLL still opens each movie. The exports a player
loop calls on an open movie (BinkWait, BinkDoFrame*, BinkNextFrame,
BinkGoto, BinkShouldSkip, BinkClose) are bound to wrappers; on the first
of these calls for a movie that is skipped, the movie is put on its last
frame, and from then on nothing is decoded, so the title's own
end-of-movie check ends it at once. Whether a movie loops is read from
its open flags at that first call, after any BinkSetWillLoop.

In a run of the title with VICTORY_SKIP_BINK=1, the one movie it opened
(3840x2160, 450 frames, not looping) was skipped.

The idea comes from XCL PR fxceless#1053 (xcl-dev/xcl); the code is written anew
for VIctory's loader.

Assisted-by: Claude Code (Claude Opus 5.5)
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…ws are found under a shared lock (after fxceless fxceless#1053)

A buffer's or a window's host copy was made (a committed buffer: a driver
call of milliseconds) under BUFFERS' exclusive lock or LOOSE's mutex, and
every ask outside a buffer took LOOSE's mutex even to find a window made
long ago: the recording threads took turns. fxceless measured 93 ms of
lock wait a frame gone with this part of fxceless#1053.

- LOOSE is a read-write lock; an ask that finds its window shares it.
- One maker at a time (MAKING_BUFFER, MAKING_WINDOW), so a copy is still
  made once; the host buffer is made under no lock of the tables.
- In-place copies are still opened under the exclusive lock, where
  in_place_let_go takes them out.
- A buffer the title gave up while its copy was made: the copy is
  retired and the ask is looked up once more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017V7WBBU55HJVgqSgZRhMqc
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
…kes no lock (after fxceless fxceless#1053)

HostHeap::mirror took the heap's one mutex for every descriptor a list
bound, to find, nearly always, that the slot was made from the very
record the title still has there. What each slot was made from is now
also kept in an atomic per slot, published once the slot is written and
its resource kept, and zeroed before a slot is made anew or made null:
a look that finds its key there returns the view without the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017V7WBBU55HJVgqSgZRhMqc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants