Descriptors: search dynamic slots a word at a time #1294

Open
HenriqueSBueno wants to merge 1 commit from upstream-pr/1297 into main
HenriqueSBueno commented 2026-11-26 12:23:43 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HenriqueSBueno on 2026-11-26T12:23:43Z.


The dynamic slot ring is a Vec<bool> walked one slot at a time under the lock every recording thread takes. On NVIDIA, view heaps stop at 1,000,000 views, so 2^18 dynamic slots fit; when they fragment, every table that finds no run walks the whole ring before it is refused (the cost runs 299–300 point at).

Taken keeps one bit per slot and skips whole free or whole taken 64-bit words. The search keeps both parts of 4d0c6345 (from next on, then from the start and on past next by n − 1) and the DYNAMIC_WHY[3] count of runs found across next.

Measured on an RTX 3080 (10 GB) / i5-10400F, a 9-minute run, on an AMD-fork base that has the same ring:

before after
slot search (all recording threads) 558–572 ms/frame 73–85 ms/frame
recording (all threads) 830–852 ms/frame 350–384 ms/frame
median frame 185 ms 160 ms

A new test checks Taken against the slot-at-a-time search on random patterns across word ends; the existing dynamic-slot tests pass. Clippy is clean with and without diagnostics.

On why the ring fills: on that AMD-fork base, counters of slots given out / back showed ~239,000 of 262,144 slots held while a frame takes ~38,000 — landed flights kept their lists, and with them their table slots, for a 64-submission bury lag. Giving table slots back at landing took refusals from ~2,300 a frame to 0 there (avatarmanz/VIctory-7900XTX#237). This tree has no such lag, so the cause here may differ, but the counters may help.

AI-assisted (Claude Code)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6626571778 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1297). Originally posted by [HenriqueSBueno](https://github.com/HenriqueSBueno) on 2026-11-26T12:23:43Z. --- The dynamic slot ring is a `Vec<bool>` walked one slot at a time under the lock every recording thread takes. On NVIDIA, view heaps stop at 1,000,000 views, so 2^18 dynamic slots fit; when they fragment, every table that finds no run walks the whole ring before it is refused (the cost runs 299–300 point at). `Taken` keeps one bit per slot and skips whole free or whole taken 64-bit words. The search keeps both parts of `4d0c6345` (from `next` on, then from the start and on past `next` by n − 1) and the `DYNAMIC_WHY[3]` count of runs found across `next`. Measured on an RTX 3080 (10 GB) / i5-10400F, a 9-minute run, on an AMD-fork base that has the same ring: | | before | after | |---|---|---| | slot search (all recording threads) | 558–572 ms/frame | 73–85 ms/frame | | recording (all threads) | 830–852 ms/frame | 350–384 ms/frame | | median frame | 185 ms | 160 ms | A new test checks `Taken` against the slot-at-a-time search on random patterns across word ends; the existing dynamic-slot tests pass. Clippy is clean with and without `diagnostics`. On why the ring fills: on that AMD-fork base, counters of slots given out / back showed ~239,000 of 262,144 slots held while a frame takes ~38,000 — landed flights kept their lists, and with them their table slots, for a 64-submission bury lag. Giving table slots back at landing took refusals from ~2,300 a frame to 0 there (avatarmanz/VIctory-7900XTX#237). This tree has no such lag, so the cause here may differ, but the counters may help. AI-assisted (Claude Code)
slauko commented 2026-11-26 14:03:30 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by slauko on 2026-11-26T13:29:47Z.


Ported to a Linux/Wine line (RTX 3080 Ti, vkd3d-proton ec20719, uiliannn's base) and it earns its keep there, smaller than on your RTX 3080 because this line's ring is used differently:

before after
preparing thread, per frame (median) 103.8–105.9 ms 101.2 ms
frame, cell median 214.7 ms 208.1 ms

(three runs each side, same build otherwise: m44/m45 against m47; the frame number sits inside this line's run-to-run spread of 210–272, the preparing number does not.)

The Taken unit test came over too (word-at-a-time against slot-at-a-time, 400 random patterns across word ends). It compiles under the xwin target; this Linux host cannot build victory-gpu's tests at all, so the in-game A/B is the evidence here.

One note for the next porter: the recipe on this line asks for VICTORY_DYNAMIC_SLOTS=524288, twice the ring your numbers use, and the search only walks when a table finds no run — so the win is the refused tables' walk, not the common case.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7193430314 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1297#issuecomment-7193430314). Originally posted by [slauko](https://github.com/slauko) on 2026-11-26T13:29:47Z. --- Ported to a Linux/Wine line (RTX 3080 Ti, vkd3d-proton `ec20719`, uiliannn's base) and it earns its keep there, smaller than on your RTX 3080 because this line's ring is used differently: | | before | after | |---|---:|---:| | preparing thread, per frame (median) | 103.8–105.9 ms | **101.2 ms** | | frame, cell median | 214.7 ms | **208.1 ms** | (three runs each side, same build otherwise: `m44`/`m45` against `m47`; the frame number sits inside this line's run-to-run spread of 210–272, the preparing number does not.) The `Taken` unit test came over too (word-at-a-time against slot-at-a-time, 400 random patterns across word ends). It compiles under the `xwin` target; this Linux host cannot build `victory-gpu`'s tests at all, so the in-game A/B is the evidence here. One note for the next porter: the recipe on this line asks for `VICTORY_DYNAMIC_SLOTS=524288`, twice the ring your numbers use, and the search only walks when a table finds no run — so the win is the *refused* tables' walk, not the common case.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1297:upstream-pr/1297'
git switch 'upstream-pr/1297'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1297'
git switch 'upstream-pr/1297'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1297'
git switch 'upstream-pr/1297'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1297'
git switch 'main'
git merge --squash 'upstream-pr/1297'
git switch 'main'
git merge --ff-only 'upstream-pr/1297'
git switch 'main'
git merge 'upstream-pr/1297'
git push origin 'main'
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
fxceless/victory-fork!1294
No description provided.