Thin lists: split a big list across translating threads (VICTORY_THIN_SPLIT) #52

Manually merged
github merged 25 commits from github-bot/gh-51 into main 2026-12-04 21:58:03 +00:00 AGit
Owner

@⁠JonasGMorsch on GitHub · 2026-12-04 19:10 UTC · original
JonasGMorsch:thin-split → main · +1123 −23 · 4 files · 1 commits · merged 2026-12-04 21:55 UTC

Thin lists: split a big list across translating threads (VICTORY_THIN_SPLIT, off by default)

Human preamble:
On CPU-bound PCs the frame waits for one translating thread to finish the game's one huge list of draws, while most cores do nothing. This splits that list across threads. The goal was fewer stutters, and higher fps came with it. It should also leave room for the list ordering work in #43, which fixes flicker but makes lists wait for each other and so costs thin time.

Based on main at 01852c0. One commit, 4 files (list/thin.rs, list.rs, draw.rs, live.rs). Both switches are off by default, and nothing changes while they are off.

What was slow

Every frame the title hands over one direct list of about 1,500 draws (about 9,000 calls). One translating thread takes 30-47 ms for it, and the submitting thread waits for it (the thin part of the frame line). Its words arrive long before that thread gets to them: up to 50-60 pieces of 384 words are queued behind it, while the other threads have nothing to do.

What is changed

  • The split. When a direct list has 8 or more pieces queued behind its thread, the later half goes to a new part with a host list of its own, translated by another thread. Every piece handed over after that goes to the last part. A part can split again, up to VICTORY_THIN_SPLIT_PARTS parts (default 4).
  • Where a part begins. A later part begins with the state the title had set at that point (pipeline, roots, heaps, vertex and index buffers, targets, viewports, scissors, blend, stencil, depth bounds, topology). Threads of their own follow each piece's words into a draw::checkpoint::TitleShadow, without translating them, and keep a copy at each piece's start. The split applies that copy to a fresh State and checks its digest before the part begins. If no copy is ready, the list is not split.
  • Order on the GPU. When all parts are translated, each joins the part before it, as cut parts do (list::join_split). Its host lists run after the earlier part's, in recording order, and each part keeps its own draw state until it has run. Nothing changes in what the GPU is asked to do, or in what order.
  • Live switches (F1 > Pipelines): "Thin: split the big list across threads" (VICTORY_THIN_SPLIT=1), and a diagnostic, "Thin: check split points (no split)" (VICTORY_THIN_SPLIT_CHECK=1). The check compares the followed state with the translating thread's state at every piece, in 8 groups.
  • Statistics. A line every 5 s gives the splits, the pieces taken by later parts, parts begun with a wrong state (should be 0), and the most parts one list had. The longest-list line now also says how many pieces the list had and how many were queued behind its thread.

Measured

RX 6800 + Xeon E5-2696 v3 (18 cores), Windows 11, Series S mode, 1080p. Standing at one busy spot, switched off → on → off live from F1. Lows are taken from the per-second frame pacing lines.

This exact commit (5526c3b):

Off On Off again
Average fps 30.9 35.0 32.6
1% low 17.5 24.3 17.2
0.1% low 11.1 19.5 13.8
Worst frame 104 ms 57 ms 82 ms
Frames over 50 ms 71 5 55
Thin 10.6 ms 6.1 ms 9.3 ms
Longest list 31.9 ms 20.7 ms 29.9 ms
Late lists: ms late a second, latest 75.5, 22.4 ms 47.7, 14.5 ms 85.5, 21.8 ms
Draws 6,752 6,047 6,166

The same split, on the play build it was developed in, at a heavier spot (~9k draws): 1% low 15.0 → 18.1 fps, 0.1% low 13.4 → 16.2, frames over 50 ms 219 → 83, worst frame 75 → 71 ms, thin 14.7 → 10.7 ms, average 25.5 → 27.4 fps.

  • With the split on, 0 parts began with a wrong state, and the check mode matched about 2.8 million pieces in a 3-minute run.
  • No visual difference was noticed with it on.
  • Draw counts drift with the time of day in the game, which can't be held still. The "off again" window is the closest match to "on".

Should help #43

#43 orders lists after the culling lists. Its first form (every list waits for every list closed before it) stopped the flicker on RDNA 3 too, but made thin 5.6 → 35.4 ms on an 8-core CPU and 4.7 → 29.8 ms on a 9800X3D, because lists then run one after another. The light forms are fast but still flicker on a 7900 XTX. When lists run one after another, the time is set by the longest lists, which is exactly what the split shortens: the longest list went from about 31 to 21 ms here. The split should make an ordering strict enough to stop the flicker much cheaper.

If both are merged, #43's per-piece marks and numbers (kept beside chunks) must move with the pieces when a list is split (chunks.split_off). The "translated to its end" signal of a culling list (order_finished) should be given once all its parts are translated, not when its last piece is. I can do that rebase after whichever lands first.

Not tested

  • NVIDIA cards and Intel CPUs; CPUs with few cores (the gain should shrink when no threads are free).
  • Series X mode at 1440p in this exact commit (the play build was also run in Series X mode by a second tester, results pending).
  • Long sessions with it on (about 10 minutes at most so far).

Tested

  • cargo test -p victory-gpu: 99 pass, including following_a_stream_gives_what_the_title_set (the followed state matches what the title set, and a left-out call is noticed) and hand_over_goes_to_the_last_part.
  • Clippy (-D warnings) on the changed crate: clean.

🤖 Generated with Claude Code

**@⁠JonasGMorsch** on GitHub · 2026-12-04 19:10 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/51) `JonasGMorsch:thin-split` → `main` · +1123 −23 · 4 files · 1 commits · merged 2026-12-04 21:55 UTC ## Thin lists: split a big list across translating threads (`VICTORY_THIN_SPLIT`, off by default) Human preamble: On CPU-bound PCs the frame waits for one translating thread to finish the game's one huge list of draws, while most cores do nothing. This splits that list across threads. The goal was fewer stutters, and higher fps came with it. It should also leave room for the list ordering work in #43, which fixes flicker but makes lists wait for each other and so costs thin time. Based on `main` at 01852c0. One commit, 4 files (`list/thin.rs`, `list.rs`, `draw.rs`, `live.rs`). Both switches are off by default, and nothing changes while they are off. ### What was slow Every frame the title hands over one direct list of about 1,500 draws (about 9,000 calls). One translating thread takes 30-47 ms for it, and the submitting thread waits for it (the `thin` part of the frame line). Its words arrive long before that thread gets to them: up to 50-60 pieces of 384 words are queued behind it, while the other threads have nothing to do. ### What is changed - **The split.** When a direct list has 8 or more pieces queued behind its thread, the later half goes to a new part with a host list of its own, translated by another thread. Every piece handed over after that goes to the last part. A part can split again, up to `VICTORY_THIN_SPLIT_PARTS` parts (default 4). - **Where a part begins.** A later part begins with the state the title had set at that point (pipeline, roots, heaps, vertex and index buffers, targets, viewports, scissors, blend, stencil, depth bounds, topology). Threads of their own follow each piece's words into a `draw::checkpoint::TitleShadow`, without translating them, and keep a copy at each piece's start. The split applies that copy to a fresh `State` and checks its digest before the part begins. If no copy is ready, the list is not split. - **Order on the GPU.** When all parts are translated, each joins the part before it, as cut parts do (`list::join_split`). Its host lists run after the earlier part's, in recording order, and each part keeps its own draw state until it has run. Nothing changes in what the GPU is asked to do, or in what order. - **Live switches** (F1 > Pipelines): "Thin: split the big list across threads" (`VICTORY_THIN_SPLIT=1`), and a diagnostic, "Thin: check split points (no split)" (`VICTORY_THIN_SPLIT_CHECK=1`). The check compares the followed state with the translating thread's state at every piece, in 8 groups. - **Statistics.** A line every 5 s gives the splits, the pieces taken by later parts, parts begun with a wrong state (should be 0), and the most parts one list had. The longest-list line now also says how many pieces the list had and how many were queued behind its thread. ### Measured RX 6800 + Xeon E5-2696 v3 (18 cores), Windows 11, Series S mode, 1080p. Standing at one busy spot, switched off → on → off live from F1. Lows are taken from the per-second frame pacing lines. **This exact commit (5526c3b):** | | Off | **On** | Off again | |---|---|---|---| | Average fps | 30.9 | **35.0** | 32.6 | | 1% low | 17.5 | **24.3** | 17.2 | | 0.1% low | 11.1 | **19.5** | 13.8 | | Worst frame | 104 ms | **57 ms** | 82 ms | | Frames over 50 ms | 71 | **5** | 55 | | Thin | 10.6 ms | **6.1 ms** | 9.3 ms | | Longest list | 31.9 ms | **20.7 ms** | 29.9 ms | | Late lists: ms late a second, latest | 75.5, 22.4 ms | **47.7, 14.5 ms** | 85.5, 21.8 ms | | Draws | 6,752 | 6,047 | 6,166 | **The same split, on the play build it was developed in, at a heavier spot (~9k draws):** 1% low 15.0 → 18.1 fps, 0.1% low 13.4 → 16.2, frames over 50 ms 219 → 83, worst frame 75 → 71 ms, thin 14.7 → 10.7 ms, average 25.5 → 27.4 fps. - With the split on, 0 parts began with a wrong state, and the check mode matched about 2.8 million pieces in a 3-minute run. - No visual difference was noticed with it on. - Draw counts drift with the time of day in the game, which can't be held still. The "off again" window is the closest match to "on". ### Should help #43 #43 orders lists after the culling lists. Its first form (every list waits for every list closed before it) stopped the flicker on RDNA 3 too, but made thin 5.6 → 35.4 ms on an 8-core CPU and 4.7 → 29.8 ms on a 9800X3D, because lists then run one after another. The light forms are fast but still flicker on a 7900 XTX. When lists run one after another, the time is set by the longest lists, which is exactly what the split shortens: the longest list went from about 31 to 21 ms here. The split should make an ordering strict enough to stop the flicker much cheaper. If both are merged, #43's per-piece `marks` and `numbers` (kept beside `chunks`) must move with the pieces when a list is split (`chunks.split_off`). The "translated to its end" signal of a culling list (`order_finished`) should be given once all its parts are translated, not when its last piece is. I can do that rebase after whichever lands first. ### Not tested - NVIDIA cards and Intel CPUs; CPUs with few cores (the gain should shrink when no threads are free). - Series X mode at 1440p in this exact commit (the play build was also run in Series X mode by a second tester, results pending). - Long sessions with it on (about 10 minutes at most so far). ### Tested - `cargo test -p victory-gpu`: 99 pass, including `following_a_stream_gives_what_the_title_set` (the followed state matches what the title set, and a left-out call is noticed) and `hand_over_goes_to_the_last_part`. - Clippy (`-D warnings`) on the changed crate: clean. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Every frame the title hands one direct list of ~1,500 draws / ~9,000 calls
to a single translating thread: 33-47 ms on one core, which the submitting
thread waits for ("thin") while most cores idle. Its words arrive long
before that thread gets to them (up to 50-60 pieces queued behind it).

With VICTORY_THIN_SPLIT=1 (F1 > Pipelines, off by default): when a direct
list has 8 or more pieces queued behind its thread, another thread takes
the later ones from about the middle, plus everything handed over after,
into a list of ours of its own. A later part can split again, up to
VICTORY_THIN_SPLIT_PARTS (4). Each part begins with what the title set
where it begins, followed from the words by threads of their own
(draw::checkpoint::TitleShadow, applied to a fresh State). When all parts
are translated, each joins the one before it as cut parts do
(list::join_split): its host lists run after the earlier part's, in
recording order, each part keeping its own draw state (dynamic slots)
until it has run.

VICTORY_THIN_SPLIT_CHECK=1 (F1, off by default) compares the followed
state with the translating thread's at every piece, in 8 parts; ~2.8M
pieces matched in a 3-minute run. The longest list's line also says how
many pieces it had and how many were queued behind its thread.

Measured on RX 6800 + Xeon E5-2696 v3 (Series S mode, same spot, off ->
on -> off, ~2 min each): 1% low 15.0 -> 18.1 fps, 0.1% low 13.4 -> 16.2,
frames over 50 ms 219 -> 83, average 25.5 -> 27.4, thin 14.7 -> 10.7 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 19:12:34 +00:00
Author
Owner

@⁠thiagohille on GitHub · 2026-12-04 20:04 UTC · original

@⁠JonasGMorsch
ReVIctory-PR51-ThinSplit-RX7900XTX-9800X3D-20261204.zip
Tested v5-split (VICTORY_THIN_SPLIT, PR #52) live in-game on a Ryzen 7 9800X3D (8C/16T, threads=16) + RX 7900 XTX 24 GB (1440p, Series X mode, FSR 4.1.2 + FG 3.1.6).

what a good job, man!

exact live toggle logged at 16:47:08.429 (menu: VICTORY_THIN_SPLIT = 1), stationary at the same busy city spot (~8.2k–8.6k draws), followed by ~8 min of active driving and running (out of gas haha) with Split ON:

Metric (focused=true, draws >= 2000) Stationary Split OFF (16:44:55–16:46:55, n=20) Stationary Split ON (16:47:08–16:49:55, n=32) Delta (Same Spot) Active Driving Split ON (16:50:05–16:57:50, n=84)
Thin ms (med / p90 / max) 4.10 / 4.90 / 4.90 ms 2.15 / 2.50 / 3.30 ms -47.6% (-1.95 ms) 2.00 / 2.90 / 4.10 ms
Real FPS (med / mean / max) 35.25 / 35.04 / 37.00 35.95 / 35.71 / 38.70 +2.0% (+0.70 fps) 41.40 / 41.56 / 50.90
Frame time (med / p90 / max) 28.35 / 30.50 / 30.80 ms 27.80 / 30.10 / 32.00 ms -0.55 ms 24.20 / 27.50 / 30.40 ms
Errors / Crashes 0 / 0 0 / 0 clean 0 / 0
  • Thin ms was literally cut in half (4.10 → 2.15 ms median), and active driving stayed rock-solid (max frame = 30.40 ms, zero big stutters!).
  • No split-specific visual glitches (no stretched meshes or wrong textures; normal upstream 01852c0 flickering was present as expected without PR #43).

Full report + raw log (play-1796413134-jonas-v5-split-lab.log) attached in the .zip!

**@⁠thiagohille** on GitHub · 2026-12-04 20:04 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/51#issuecomment-7422784277) @⁠JonasGMorsch [ReVIctory-PR51-ThinSplit-RX7900XTX-9800X3D-20261204.zip](https://github.com/user-attachments/files/35890253/ReVIctory-PR51-ThinSplit-RX7900XTX-9800X3D-20261204.zip) Tested `v5-split` (`VICTORY_THIN_SPLIT`, PR #52) live in-game on a **Ryzen 7 9800X3D (8C/16T, `threads=16`) + RX 7900 XTX 24 GB** (`1440p`, Series X mode, FSR 4.1.2 + FG 3.1.6). what a good job, man! exact live toggle logged at **`16:47:08.429`** (`menu: VICTORY_THIN_SPLIT = 1`), stationary at the same busy city spot (`~8.2k–8.6k` draws), followed by ~8 min of active driving and running (out of gas haha) with Split ON: | Metric (`focused=true`, `draws >= 2000`) | Stationary `Split OFF` (`16:44:55–16:46:55`, `n=20`) | Stationary `Split ON` (`16:47:08–16:49:55`, `n=32`) | Delta (Same Spot) | Active Driving `Split ON` (`16:50:05–16:57:50`, `n=84`) | | :--- | :---: | :---: | :---: | :---: | | **`Thin ms` (med / p90 / max)** | `4.10` / `4.90` / `4.90 ms` | **`2.15` / `2.50` / `3.30 ms`** | **`-47.6%` (-1.95 ms)** | **`2.00` / `2.90` / `4.10 ms`** | | **Real FPS (med / mean / max)** | `35.25` / `35.04` / `37.00` | **`35.95` / `35.71` / `38.70`** | **`+2.0%` (+0.70 fps)** | **`41.40` / `41.56` / `50.90`** | | **Frame time (med / p90 / max)** | `28.35` / `30.50` / `30.80 ms` | **`27.80` / `30.10` / `32.00 ms`** | `-0.55 ms` | **`24.20` / `27.50` / `30.40 ms`** | | **Errors / Crashes** | `0` / `0` | **`0` / `0`** | clean | **`0` / `0`** | - **`Thin ms` was literally cut in half (`4.10 → 2.15 ms` median)**, and active driving stayed rock-solid (`max frame = 30.40 ms`, zero big stutters!). - No split-specific visual glitches (no stretched meshes or wrong textures; normal upstream `01852c0` flickering was present as expected without PR #43). Full report + raw log (`play-1796413134-jonas-v5-split-lab.log`) attached in the `.zip`!
github-bot force-pushed github-bot/gh-51 from 5526c3bcec to 0a29302e7c 2026-12-04 21:58:02 +00:00 Compare
github manually merged commit f27750291d into main 2026-12-04 21:58:03 +00:00
Author
Owner

@⁠ReTerryDavis on GitHub · 2026-12-04 21:55 UTC · original

Awesome work on this — rebased onto main with two safety fixes in list/thin.rs:

  1. for_external split race: loop re-checking inner.child until !scheduled && child.is_none(), and refuse to split in Recording::split() while inner.waiting_for_back is true so FSR/DLSS/FrameGen can never get an earlier part's HostList out of order.
  2. State-digest mismatch handling: abort the split early (letting child's Drop reclaim back) if begin_split detects a state mismatch rather than proceeding with the split.

Verified Clippy (default + --all-features) and all list:: and draw::checkpoint:: tests pass — merging now!

**@⁠ReTerryDavis** on GitHub · 2026-12-04 21:55 UTC · [original](https://github.com/ReTerryDavis/ReVIctory/pull/51#issuecomment-7425300979) Awesome work on this — rebased onto `main` with two safety fixes in `list/thin.rs`: 1. **`for_external` split race:** loop re-checking `inner.child` until `!scheduled && child.is_none()`, and refuse to split in `Recording::split()` while `inner.waiting_for_back` is true so FSR/DLSS/FrameGen can never get an earlier part's `HostList` out of order. 2. **State-digest mismatch handling:** abort the split early (letting `child`'s `Drop` reclaim `back`) if `begin_split` detects a state mismatch rather than proceeding with the split. Verified Clippy (default + `--all-features`) and all `list::` and `draw::checkpoint::` tests pass — merging now!
This discussion has been locked. Commenting is limited to contributors.
No description provided.