Skip to content

GPU: do not wait for title-memory remaps when refreshing textures by default - #393

Closed
relativespace2K wants to merge 1 commit into
fxceless:mainfrom
relativespace2K:texture-no-wait-default
Closed

relativespace2K wants to merge 1 commit into
fxceless:mainfrom
relativespace2K:texture-no-wait-default

Conversation

@relativespace2K

Copy link
Copy Markdown

What

VICTORY_TEXTURE_NO_WAIT is now on by default: a texture refresh asks for the title-memory mapping lock without waiting. If the runtime is remapping, it reads through the kernel instead (or leaves the texture for its next refresh, a frame later); it never reads a partly mapped texture. VICTORY_TEXTURE_NO_WAIT=0 restores the old waiting behaviour.

This follows the proposal in #178 (RX 7900 XT, RADV) with a second AMD data point on native Windows D3D12.

Measurements

Machine: RX 6800 XT 16 GB (RDNA2), driver 32.0.21045.29003, Ryzen 5 5600, 32 GB, Windows 11 26100, Series X profile, diagnostics build, 1920x1080.

Opening cutscene, same phase, warm shader cache:

fps ms/frame textures
before (default wait) 0.2 4,363-5,658 3,124-4,958 ms
VICTORY_TEXTURE_NO_WAIT=1 0.3-0.7 1,390-3,095 9-11 ms

The texture line names the wait as the whole cost: texture refreshes per frame ... 0.0 ms waiting for title memory to hold still with the switch, against seconds without it.

Prologue (same checkpoint, 180 s runs):

fps ms/frame textures wait
default after this PR 1.4 695 39 ms 0.0 ms
VICTORY_TEXTURE_NO_WAIT=0 1.2-1.4 725-807 59-107 ms 0-43 ms

The large win is while the world is streaming in; once the prologue settles the wait is small, so the default does not change the steady state much there. The run reached the prologue with ~5,000 draws/frame, ~17 GB working set and no device loss.

Checks

  • cargo test --workspace --locked -- --test-threads=1: 497 passed, 0 failed, 7 ignored.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • cargo xtask policy: 169 files ok.
  • New unit test texture::title_memory_tests::texture_refreshes_do_not_wait_unless_asked_to covers the unset/1/0 parsing.

No game files, shaders or captures are included; the runs were on the reporter's own copy.

AI-assisted: the patch and the runs above were made with an AI agent on my machine; I reviewed the result and the logs.

Refs #178.

The refresh asks for the mapping lock without waiting; if the runtime is remapping, it reads through the kernel (or retries a frame later). On an RX 6800 XT the wait was 3.1-4.5 s of a 4.4-5.6 s frame in the opening cutscene, and 1.2-1.5 s without it; in the prologue, 0.0 ms of waits and 695 ms/frame against 725-807 ms with VICTORY_TEXTURE_NO_WAIT=0. VICTORY_TEXTURE_NO_WAIT=0 restores the wait.

Refs fxceless#178.
@relativespace2K

Copy link
Copy Markdown
Author

Superseded by #175, which fixes the root cause by scoping the mapping lock to the affected ranges and keeping the in-place texture read. I validated #175 on an RX 6800 XT (Windows 11, native D3D12): mapping wait median 0.0 ms and max 35.5 ms over 107 windows, against a 7,886.5 ms worst window before; prologue at 1.2-1.5 fps with no device loss. Details in #175. Closing this in favor of #175.

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.

1 participant