Relay thread spends 50-70 ms a frame dropping ~75k retired objects (RTX 5080); dropping them on another thread: 91 -> 65 ms #1349

Open
opened 2026-11-26 17:32:31 +00:00 by github-bot · 4 comments
Owner

@⁠Ym1r1710 on GitHub · 2026-11-26 17:31 UTC · original

Not sure if this is already known. Posting the numbers in case they help with deciding on VICTORY_REAPER.

Setup: RTX 5080, driver 621.24, 7800X3D, 32 GB. The build is upstream ffe310eb plus the CGBJ patches, which carry this fork's relay code from a few days ago (VICTORY_RELAY=2). Diag profile, --console series-s. Spot: Jason's balcony after the first mission, same camera every run, measured around world+696.

What I saw: a timeline of one frame showed the victory-relay thread spending ~73 ms of a 128 ms frame inside bury(last), after it had already told the title the list ran. It drops 70-83k objects a frame there, mostly descriptor slot references and host copies. The submitting thread's settles ("title memory read", "lists in the air") were waiting on that, not on the card.

I added a counter and moved the drop to a thread of its own. It's the same idea as your reap() / VICTORY_REAPER: objects are handed over at the same point as before, never earlier.

frame "on the GPU" drops per frame
drop on the relay thread (2 runs) 86-95 ms ~33 ms ~80k in 51-63 ms
drop on its own thread (4 runs) 65-73 ms < 1 ms ~74k in 58-73 ms (now off the frame's path)

Pictures are the same, and there were no device removals.

The odd part is that the drops themselves are slow, about 0.8 µs each. In one run without the separate thread, Windows got low on RAM (~3 GB free) and the log showed host memory pressure: limiting texture prefetch and idle upload storage. After that, the same ~75k objects a frame dropped in 1-4 ms, and the frame went down to 56-57 ms. So something on the prefetch/upload side makes those releases contend (a driver lock? the heap?). I haven't found out what yet.

VICTORY_REAPER is off by default and the README has no numbers for it, so it may be worth a run on your side. I haven't tried your REAPER itself; mine is a separate patch on an older base.

**@⁠Ym1r1710** on GitHub · 2026-11-26 17:31 UTC · [original](https://github.com/fxceless/victory-fork/issues/1349) Not sure if this is already known. Posting the numbers in case they help with deciding on `VICTORY_REAPER`. **Setup:** RTX 5080, driver 621.24, 7800X3D, 32 GB. The build is upstream ffe310eb plus the CGBJ patches, which carry this fork's relay code from a few days ago (`VICTORY_RELAY=2`). Diag profile, `--console series-s`. Spot: Jason's balcony after the first mission, same camera every run, measured around world+696. **What I saw:** a timeline of one frame showed the `victory-relay` thread spending ~73 ms of a 128 ms frame inside `bury(last)`, after it had already told the title the list ran. It drops 70-83k objects a frame there, mostly descriptor slot references and host copies. The submitting thread's settles ("title memory read", "lists in the air") were waiting on that, not on the card. I added a counter and moved the drop to a thread of its own. It's the same idea as your `reap()` / `VICTORY_REAPER`: objects are handed over at the same point as before, never earlier. | | frame | "on the GPU" | drops per frame | |---|---|---|---| | drop on the relay thread (2 runs) | 86-95 ms | ~33 ms | ~80k in 51-63 ms | | drop on its own thread (4 runs) | 65-73 ms | < 1 ms | ~74k in 58-73 ms (now off the frame's path) | Pictures are the same, and there were no device removals. **The odd part** is that the drops themselves are slow, about 0.8 µs each. In one run without the separate thread, Windows got low on RAM (~3 GB free) and the log showed `host memory pressure: limiting texture prefetch and idle upload storage`. After that, the same ~75k objects a frame dropped in 1-4 ms, and the frame went down to 56-57 ms. So something on the prefetch/upload side makes those releases contend (a driver lock? the heap?). I haven't found out what yet. `VICTORY_REAPER` is off by default and the README has no numbers for it, so it may be worth a run on your side. I haven't tried your REAPER itself; mine is a separate patch on an older base.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:32:31 +00:00
Author
Owner

@⁠CarverXI on GitHub · 2026-11-26 17:41 UTC · original

Where did you find the CGBJ patches, I thought that repository was made private.

**@⁠CarverXI** on GitHub · 2026-11-26 17:41 UTC · [original](https://github.com/fxceless/victory-fork/issues/1349#issuecomment-7199451479) Where did you find the CGBJ patches, I thought that repository was made private.
Author
Owner

@⁠Layikon on GitHub · 2026-11-26 17:53 UTC · original

Some guy managed to make a copy for himself—I even saved it. But when I tried running it, all I got was a black screen. https://github.com/DoubleGhosty/cool_fox.git

**@⁠Layikon** on GitHub · 2026-11-26 17:53 UTC · [original](https://github.com/fxceless/victory-fork/issues/1349#issuecomment-7199814245) Some guy managed to make a copy for himself—I even saved it. But when I tried running it, all I got was a black screen. https://github.com/DoubleGhosty/cool_fox.git
Author
Owner

@⁠Victorywillbeours222 on GitHub · 2026-11-26 18:28 UTC · original

A data point from another tree, in case it helps narrow this down. I ported VICTORY_REAPER into Proudnoob4/VIctory-NVIDIA nvidia-hybrid-v2 (f53aa2b): bury() hands what it would drop to the reaper thread, plus a frame-log line that times the drops on each side. I ran it with =alt (flipping every 20 s).

Machine and run: RTX 5080 16 GB, Ryzen 7 5800X, 32 GB, Windows 11; diagnostics build, Series S at 720p; hands-off in the opening cell; 600 s; 0 errors.

reaper clean 5 s windows retired objects dropped a frame time dropping them a frame frame
off 32 ~47,000, on the threads that buried them 1.0 ms 51.9 ms
on 31 ~47,000, on the reaper's thread 1.3 ms 52.0 ms

So on that tree a similar number of retired objects costs about 1 ms to drop, and the reaper changes nothing there. That points at what fork main retires, rather than how many objects there are. If your log can split the drop time by kind of object, it would show which kind takes the 50–70 ms.

Numbers and text only. AI-assisted (Claude Code).

**@⁠Victorywillbeours222** on GitHub · 2026-11-26 18:28 UTC · [original](https://github.com/fxceless/victory-fork/issues/1349#issuecomment-7200495238) A data point from another tree, in case it helps narrow this down. I ported `VICTORY_REAPER` into Proudnoob4/VIctory-NVIDIA `nvidia-hybrid-v2` (`f53aa2b`): `bury()` hands what it would drop to the reaper thread, plus a frame-log line that times the drops on each side. I ran it with `=alt` (flipping every 20 s). Machine and run: RTX 5080 16 GB, Ryzen 7 5800X, 32 GB, Windows 11; diagnostics build, Series S at 720p; hands-off in the opening cell; 600 s; 0 errors. | reaper | clean 5 s windows | retired objects dropped a frame | time dropping them a frame | frame | |---|---|---|---|---| | off | 32 | ~47,000, on the threads that buried them | **1.0 ms** | 51.9 ms | | on | 31 | ~47,000, on the reaper's thread | 1.3 ms | 52.0 ms | So on that tree a similar number of retired objects costs about 1 ms to drop, and the reaper changes nothing there. That points at what fork main retires, rather than how many objects there are. If your log can split the drop time by kind of object, it would show which kind takes the 50–70 ms. Numbers and text only. AI-assisted (Claude Code).
Author
Owner

@⁠Ym1r1710 on GitHub · 2026-11-26 19:02 UTC · original

Thanks, that matches what I found after splitting the drops by kind. The count was never the problem. On the balcony, of ~73-75k objects dropped a frame:

per frame time
resources whose last reference it was 50-54 63-64 ms
everything else (references still held elsewhere) ~73-75k 2.7 ms

All of the expensive ones were list scratch chunks, committed upload buffers:

  • 256 KiB ones: 30-42 a frame, ~1 ms each;
  • 4 MiB ones: 11-12 a frame, 1.8-2.5 ms each.

The spare pool sat at its 128 MiB bound the whole run, and it was all 4 MiB chunks. take only matches the exact size, so every small first chunk was made new, and chunks coming back past the bound got freed.

The fix is in #1367. With it, the same ~75k drops take 7.5-8 ms a frame, with 0 resources destroyed, and the frame went from 63-84 to 52-56 ms.

My guess for why you see ~1 ms in the opening cell: fewer or smaller lists there, so the spares stay under the bound and nothing gets freed. If your log shows how many scratch chunks get made per frame, that would confirm it.

**@⁠Ym1r1710** on GitHub · 2026-11-26 19:02 UTC · [original](https://github.com/fxceless/victory-fork/issues/1349#issuecomment-7201132790) Thanks, that matches what I found after splitting the drops by kind. The count was never the problem. On the balcony, of ~73-75k objects dropped a frame: | | per frame | time | |---|---|---| | resources whose last reference it was | 50-54 | 63-64 ms | | everything else (references still held elsewhere) | ~73-75k | 2.7 ms | All of the expensive ones were list scratch chunks, committed upload buffers: - 256 KiB ones: 30-42 a frame, ~1 ms each; - 4 MiB ones: 11-12 a frame, 1.8-2.5 ms each. The spare pool sat at its 128 MiB bound the whole run, and it was all 4 MiB chunks. `take` only matches the exact size, so every small first chunk was made new, and chunks coming back past the bound got freed. The fix is in #1367. With it, the same ~75k drops take 7.5-8 ms a frame, with 0 resources destroyed, and the frame went from 63-84 to 52-56 ms. My guess for why you see ~1 ms in the opening cell: fewer or smaller lists there, so the spares stay under the bound and nothing gets freed. If your log shows how many scratch chunks get made per frame, that would confirm it.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#1349
No description provided.