perf(gpu): texture read-backs written by a thread of their own #7

Merged
Indy2l merged 1 commit from upstream-pr/7 into main 2026-11-26 17:18:36 +00:00
Indy2l commented 2026-11-26 16:55:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Indy2l on 2026-11-26T16:55:01Z.


Problem

texback::land runs on the thread that lands submissions. It takes watch::title_memory_reading() before writing the water maps into title memory. While the world streams, the title changes mappings constantly, and on the 16 GB machine from #6 that wait stood at 124–416 ms per frame in some stretches, for 2–10 maps of 350 KB. Every other submission's landing waited with it.

Change

  • Finer timing: "read-backs and lists" in the landing line is split into texture read-backs, buffer read-backs, and the flights' card plans and own work. Texture read-backs were the whole of it.
  • Off the landing thread: the landing thread now only copies a read-back's texels out of its buffer. Waiting for the locks, tiling and writing into title memory go to a thread of their own.
  • Newest copy wins: of several copies of one allocation waiting there, only the newest is written. The title reads the frame before at most, as the module's comment already allows.
  • A switch: VICTORY_TEXBACK_ASYNC=0 writes them where they land, as before.
  • A fallback: if the thread can't be started, they're written inline.
  • A new log line: the writer's lock waits and work per frame.

Validation

  • Build and tests: cargo build --locked --profile diag -p victory --features diagnostics, and cargo test --locked -p victory-gpu --lib (331 passed, including only_readbacks_for_changed_allocations_are_invalidated).
  • In game, same machine, Series S at 540p with VICTORY_WINDOWS_BAR_MB=3072, 7- and 8-minute runs:
    • texture read-backs on the landing thread went from up to 416 ms per frame to under 3 ms
    • the writer still waits up to 320–500 ms some frames, which no longer holds up landings
    • windows under 2 fps went from 6–14 per run to 3, with 17 under 5 fps
    • median fps barely moved (8.6–9.2). The remaining stalls are the title paging (see #6).

Not covered: a check that boats still float as well as before. The written data is unchanged, but it can now arrive a frame later.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5514055380 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/7). Originally posted by [Indy2l](https://github.com/Indy2l) on 2026-11-26T16:55:01Z. --- ## Problem `texback::land` runs on the thread that lands submissions. It takes `watch::title_memory_reading()` before writing the water maps into title memory. While the world streams, the title changes mappings constantly, and on the 16 GB machine from #6 that wait stood at 124–416 ms per frame in some stretches, for 2–10 maps of 350 KB. Every other submission's landing waited with it. ## Change - **Finer timing:** "read-backs and lists" in the landing line is split into texture read-backs, buffer read-backs, and the flights' card plans and own work. Texture read-backs were the whole of it. - **Off the landing thread:** the landing thread now only copies a read-back's texels out of its buffer. Waiting for the locks, tiling and writing into title memory go to a thread of their own. - **Newest copy wins:** of several copies of one allocation waiting there, only the newest is written. The title reads the frame before at most, as the module's comment already allows. - **A switch:** `VICTORY_TEXBACK_ASYNC=0` writes them where they land, as before. - **A fallback:** if the thread can't be started, they're written inline. - **A new log line:** the writer's lock waits and work per frame. ## Validation - **Build and tests:** `cargo build --locked --profile diag -p victory --features diagnostics`, and `cargo test --locked -p victory-gpu --lib` (331 passed, including `only_readbacks_for_changed_allocations_are_invalidated`). - **In game,** same machine, Series S at 540p with `VICTORY_WINDOWS_BAR_MB=3072`, 7- and 8-minute runs: - texture read-backs on the landing thread went from up to 416 ms per frame to under 3 ms - the writer still waits up to 320–500 ms some frames, which no longer holds up landings - windows under 2 fps went from 6–14 per run to 3, with 17 under 5 fps - median fps barely moved (8.6–9.2). The remaining stalls are the title paging (see #6). Not covered: a check that boats still float as well as before. The written data is unchanged, but it can now arrive a frame later. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!7
No description provided.