perf(victory-gpu): the relay retires ~70k kept views per frame one lock at a time (120-360 ms per frame on an 8-core CPU) #607

Open
opened 2026-12-01 18:11:52 +00:00 by AlphaVIE · 0 comments
AlphaVIE commented 2026-12-01 18:11:52 +00:00 (Migrated from github.com)
Contributor

Imported from LooperSalty/AnyXboxX. Originally posted by AlphaVIE on 2026-12-01T18:11:52Z.


What I measured

On my machine the world ran at 4-6 fps (Series S profile) to 2-10 fps (Series X), while the card sat mostly idle: 4-30% busy by VIctory's own card clock and nvidia-smi. The submitting thread waited 120-200 ms per frame for the relay ("settles", title memory read).

To find out where the relay's time goes, I split the "read-backs and lists" part of the landing line (local instrumentation, not part of the PR). Nearly all of it was Detached::release_tables -> State::tables_done -> HostHeap::release -> retire_resource:

  • tables released: 270-363 ms per frame
  • allocator lock waited: 0.00 ms, held: ~1 ms
  • kept views retired: 120-310 ms per frame, ~70,000 of them per frame

Every kept view goes through retire_resource on its own, and each call takes the RETIRED shard lock that the recording threads use as well.

Proposed change (PR to follow)

Give a list's dynamic slots back in one pass (release_dynamic_many / HostHeap::release_many), and retire the kept views of that pass with one stamp, one lock and one ordered merge (retire_resources, using the existing merge_retired_batch). Retirement still waits for the same stamp, so nothing is dropped earlier than before.

Measured with the change (same machine, Series S, world, release build, how: VIctory log lines plus the local split):

  • tables released: 270-363 ms -> 3-7 ms per frame
  • GPU wait per frame: 120-200 ms -> 22-31 ms
  • world: about 4-6 fps -> about 12 fps (5,400 draws per frame)

Machine: Ryzen 7 5700X (8 cores / 16 threads), 32 GB RAM, RTX 5060 Ti 16 GB (PCIe 4.0 x8), Windows 11, Xbox Series build 1.0.2.1, anyxboxx run with the tuned settings.

Note: VICTORY_BATCH_RETIRE=1 (the existing opt-in batching for recording threads) gave a black picture at a constant 3.6 fps in one run here, so I did not build on it.

This work was done with AI assistance (Claude Code).

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:6727295702 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/issues/607). Originally posted by [AlphaVIE](https://github.com/AlphaVIE) on 2026-12-01T18:11:52Z. --- ## What I measured On my machine the world ran at 4-6 fps (Series S profile) to 2-10 fps (Series X), while the card sat mostly idle: 4-30% busy by VIctory's own card clock and `nvidia-smi`. The submitting thread waited 120-200 ms per frame for the relay ("settles", title memory read). To find out where the relay's time goes, I split the "read-backs and lists" part of the landing line (local instrumentation, not part of the PR). Nearly all of it was `Detached::release_tables` -> `State::tables_done` -> `HostHeap::release` -> `retire_resource`: - tables released: 270-363 ms per frame - allocator lock waited: 0.00 ms, held: ~1 ms - kept views retired: 120-310 ms per frame, ~70,000 of them per frame Every kept view goes through `retire_resource` on its own, and each call takes the `RETIRED` shard lock that the recording threads use as well. ## Proposed change (PR to follow) Give a list's dynamic slots back in one pass (`release_dynamic_many` / `HostHeap::release_many`), and retire the kept views of that pass with one stamp, one lock and one ordered merge (`retire_resources`, using the existing `merge_retired_batch`). Retirement still waits for the same stamp, so nothing is dropped earlier than before. Measured with the change (same machine, Series S, world, release build, how: VIctory log lines plus the local split): - tables released: 270-363 ms -> 3-7 ms per frame - GPU wait per frame: 120-200 ms -> 22-31 ms - world: about 4-6 fps -> about 12 fps (5,400 draws per frame) Machine: Ryzen 7 5700X (8 cores / 16 threads), 32 GB RAM, RTX 5060 Ti 16 GB (PCIe 4.0 x8), Windows 11, Xbox Series build 1.0.2.1, `anyxboxx run` with the tuned settings. Note: `VICTORY_BATCH_RETIRE=1` (the existing opt-in batching for recording threads) gave a black picture at a constant 3.6 fps in one run here, so I did not build on it. This work was done with AI assistance (Claude Code).
Sign in to join this conversation.
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
LooperSalty/AnyXboxX#607
No description provided.