texback, host: keep readback pool under pressure, recycle at landing, and offload relay bury #3482

Merged
Maverick0351a merged 1 commit from upstream-pr/3482 into main 2026-11-30 14:12:01 +00:00
Maverick0351a commented 2026-11-29 23:48:22 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-29T23:48:22Z.


Summary

In open-world water/city gameplay (~20–25 ocean/water texture readbacks per frame, 149,760 texture readbacks in 14 minutes), landing per frame on the single ictory-relay thread spent 10.76–25.57 ms/frame in
ead-backs and lists and 17.36–20.92 ms/frame in he rest:

  1. In crates/victory-gpu/src/texback.rs, ake_read_back and give_read_back checked !crate::residency::pressured(), and sweep() called rim_read_backs() (READBACK_POOL.clear()) every second when pressured() was true. On 32 GB hosts where pressured() stays latched (physical_free < 5 GiB), READBACK_POOL was completely disabled, forcing CreateCommittedResource + Map ~365 times/sec and Unmap + D3DKMTDestroyAllocation2 ~365 times/sec.
  2. Detached flight lists held their ReadBack buffers across the full 16-to-64-submission ury_lag until HostList::reset() instead of recycling them immediately at landing after
    ead_backs(...) copied their contents into title memory.
  3. In Host::relay_land, ury(last) (17–21 ms/frame of D3DKMTDestroyAllocation2 calls) ran synchronously on ictory-relay before updating line() (written,
    arrow, *settling = false) and waking LINE_MOVED / LINE_LANDED.
  4. card_steps::Taken::landed called drop(std::mem::take(&mut *self.own.list.deferred())) instead of self.own.list.deferred().clear(), discarding internal Vec/HashMap capacities on every landed flight.

Fix

  1. crates/victory-gpu/src/texback.rs & crates/victory-gpu/src/host.rs:
    • Keep READBACK_POOL active unless crate::residency::critical_commit() is true, and add sweep_read_backs() to trim only the unborrowed 1 Hz low-water surplus ( rim_window()) under normal pressure.
    • Call detached.host().recycle_read_backs() at flight landing alongside
      elease_tables() and
      elease_scratch().
  2. crates/victory-gpu/src/host.rs & crates/victory-gpu/src/host/card_steps.rs:
    • In Host::relay_land, call fast uav_pool::drain_retired_uavs(last) and offload ury(FINISHED.load(Ordering::Acquire)) to late_helper ( ictory-late-wait thread, woken on every landing by line.poke = true) while also running ury(FINISHED.load(Ordering::Acquire)) in synchronous Host::settle.
    • In card_steps::Taken::landed, guard late::landed / late::landed_cpu with if late::on() and call self.own.list.deferred().clear().

Testing

  • cargo test -p victory-gpu --lib texback (4 passed; 0 failed)
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556471935 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3482). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-11-29T23:48:22Z. --- ### Summary In open-world water/city gameplay (~20–25 ocean/water texture readbacks per frame, 149,760 texture readbacks in 14 minutes), landing per frame on the single ictory-relay thread spent **10.76–25.57 ms/frame** in ead-backs and lists and **17.36–20.92 ms/frame** in he rest: 1. In crates/victory-gpu/src/texback.rs, ake_read_back and give_read_back checked !crate::residency::pressured(), and sweep() called rim_read_backs() (READBACK_POOL.clear()) every second when pressured() was true. On 32 GB hosts where pressured() stays latched (physical_free < 5 GiB), READBACK_POOL was completely disabled, forcing CreateCommittedResource + Map ~365 times/sec and Unmap + D3DKMTDestroyAllocation2 ~365 times/sec. 2. Detached flight lists held their ReadBack buffers across the full 16-to-64-submission ury_lag until HostList::reset() instead of recycling them immediately at landing after ead_backs(...) copied their contents into title memory. 3. In Host::relay_land, ury(last) (17–21 ms/frame of D3DKMTDestroyAllocation2 calls) ran synchronously on ictory-relay before updating line() (written, arrow, *settling = false) and waking LINE_MOVED / LINE_LANDED. 4. card_steps::Taken::landed called drop(std::mem::take(&mut *self.own.list.deferred())) instead of self.own.list.deferred().clear(), discarding internal Vec/HashMap capacities on every landed flight. ### Fix 1. **crates/victory-gpu/src/texback.rs & crates/victory-gpu/src/host.rs**: - Keep READBACK_POOL active unless crate::residency::critical_commit() is true, and add sweep_read_backs() to trim only the unborrowed 1 Hz low-water surplus ( rim_window()) under normal pressure. - Call detached.host().recycle_read_backs() at flight landing alongside elease_tables() and elease_scratch(). 2. **crates/victory-gpu/src/host.rs & crates/victory-gpu/src/host/card_steps.rs**: - In Host::relay_land, call fast uav_pool::drain_retired_uavs(last) and offload ury(FINISHED.load(Ordering::Acquire)) to late_helper ( ictory-late-wait thread, woken on every landing by line.poke = true) while also running ury(FINISHED.load(Ordering::Acquire)) in synchronous Host::settle. - In card_steps::Taken::landed, guard late::landed / late::landed_cpu with if late::on() and call self.own.list.deferred().clear(). ### Testing - cargo test -p victory-gpu --lib texback (4 passed; 0 failed)
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!3482
No description provided.