NVIDIA: dynamic descriptor slots (word search, early release), a pool barrier fix, a diagnostics counter #237

Open
HenriqueSBueno wants to merge 5 commits from upstream-pr/237 into main
HenriqueSBueno commented 2026-11-26 12:16:18 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by HenriqueSBueno on 2026-11-26T12:16:18Z.


Four small changes found while running this fork on NVIDIA (RTX 3080 10 GB, i5-10400F, 32 GB, Windows 11). All numbers: same save, 9-minute runs, median of the last 30 frame-rate lines.

1. Dynamic descriptor slots searched a word at a time

NVIDIA caps shader-visible view heaps at 1,000,000 views, so only 2^18 dynamic slots fit (a quarter of what an uncapped AMD heap gets). The ring was a Vec<bool> walked one slot at a time under the lock every recording thread takes; when it fragments, every refused table walks the whole ring. Taken keeps one bit per slot and skips whole free or taken words. A failed search now logs (at powers of two) the free slots, the longest free run and slots given out / back.

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 unit test checks it against the slot-at-a-time search on random patterns across word ends.

2. A landed flight's table slots go back before the bury lag (VICTORY_EARLY_TABLES=1, off by default)

The counters above showed ~239,000 of 262,144 slots held while a frame takes ~38,000: landed flights keep their lists, and with them their table slots, for VICTORY_BURY_LAG (64 submissions, about four frames). 2,200–2,400 tables a frame were refused (each drops its draw) with 45,000–69,000 slots free, longest run 100–163. Fewer lists in flight (VICTORY_LATE_WAIT_LISTS=128) and per-list chunks of 256 did not change the refusals. A landed flight's fence is done, so its table slots are not read again; the lag still applies to the lists and memory.

before after
tables refused per frame ~2,300 0
slot search 73–85 ms 4–6 ms
draws per frame ~2,800 ~4,000
picture after 9 min draws missing, whites out later complete

(The frame time goes up at first because the dropped draws are drawn again.)

3. Diagnostics: differing pieces counted on the relay and wide copy-back paths

BackDiffer was counted only on the shadow path, so the frame account said "0 pieces that differ" while the relay scans find 600–970 a frame.

4. The first upload's aliasing barrier only for textures made in a pool block

With the pool on, the first upload into any title-filled texture records an aliasing barrier. A committed texture (one the block refused, or a stand-in made elsewhere) cannot take one: the host refuses to close the list (E_INVALIDARG; debug layer id 528, "cannot use aliasing barrier since committed resource memory cannot be aliased"). Seen as a stop about three minutes into a run together with the PC FidelityFX upscaler port. pool::pooled tells a block's texture by the private data it already carries.

Built with --profile diag --features diagnostics; the gpu crate's slot tests pass and clippy is clean for the touched files. Related measurement for small cards (no code here): on a ≤12 GiB budget, VICTORY_CARD_BUFFERS_MIN_MB=1 took the median frame from 191 to ~85 ms; 64 KB left the world undrawn.

AI-assisted (Claude Code)

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5509855545 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/237). Originally posted by [HenriqueSBueno](https://github.com/HenriqueSBueno) on 2026-11-26T12:16:18Z. --- Four small changes found while running this fork on NVIDIA (RTX 3080 10 GB, i5-10400F, 32 GB, Windows 11). All numbers: same save, 9-minute runs, median of the last 30 frame-rate lines. ### 1. Dynamic descriptor slots searched a word at a time NVIDIA caps shader-visible view heaps at 1,000,000 views, so only 2^18 dynamic slots fit (a quarter of what an uncapped AMD heap gets). The ring was a `Vec<bool>` walked one slot at a time under the lock every recording thread takes; when it fragments, every refused table walks the whole ring. `Taken` keeps one bit per slot and skips whole free or taken words. A failed search now logs (at powers of two) the free slots, the longest free run and slots given out / back. | | 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 unit test checks it against the slot-at-a-time search on random patterns across word ends. ### 2. A landed flight's table slots go back before the bury lag (`VICTORY_EARLY_TABLES=1`, off by default) The counters above showed ~239,000 of 262,144 slots held while a frame takes ~38,000: landed flights keep their lists, and with them their table slots, for `VICTORY_BURY_LAG` (64 submissions, about four frames). 2,200–2,400 tables a frame were refused (each drops its draw) with 45,000–69,000 slots free, longest run 100–163. Fewer lists in flight (`VICTORY_LATE_WAIT_LISTS=128`) and per-list chunks of 256 did not change the refusals. A landed flight's fence is done, so its table slots are not read again; the lag still applies to the lists and memory. | | before | after | |---|---|---| | tables refused per frame | ~2,300 | 0 | | slot search | 73–85 ms | 4–6 ms | | draws per frame | ~2,800 | ~4,000 | | picture after 9 min | draws missing, whites out later | complete | (The frame time goes up at first because the dropped draws are drawn again.) ### 3. Diagnostics: differing pieces counted on the relay and wide copy-back paths `BackDiffer` was counted only on the shadow path, so the frame account said "0 pieces that differ" while the relay scans find 600–970 a frame. ### 4. The first upload's aliasing barrier only for textures made in a pool block With the pool on, the first upload into any title-filled texture records an aliasing barrier. A committed texture (one the block refused, or a stand-in made elsewhere) cannot take one: the host refuses to close the list (`E_INVALIDARG`; debug layer id 528, "cannot use aliasing barrier since committed resource memory cannot be aliased"). Seen as a stop about three minutes into a run together with the PC FidelityFX upscaler port. `pool::pooled` tells a block's texture by the private data it already carries. Built with `--profile diag --features diagnostics`; the gpu crate's slot tests pass and clippy is clean for the touched files. Related measurement for small cards (no code here): on a ≤12 GiB budget, `VICTORY_CARD_BUFFERS_MIN_MB=1` took the median frame from 191 to ~85 ms; 64 KB left the world undrawn. AI-assisted (Claude Code)
Jesper-Andersson commented 2026-11-26 18:28:32 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Jesper-Andersson on 2026-11-26T18:28:32Z.


A test of this PR on another NVIDIA card: RTX 2070 SUPER 8 GB (Turing, driver 621.14, 32-lane waves, host view heaps capped at 1,000,000), 32 GB RAM, Windows 11. Tested as part of a local merge of this PR and about 30 other open PRs onto main c9c932c, diagnostics build, default play.ps1 settings.

The slots still run out under load. About 3 minutes into the prologue, one window of frames hits no free dynamic descriptor slots: a table is not made n=27, and this PR's counter reads:

dynamic slots: 12063 tables asked, 91 refused, 0.9 ms searching

That's over 8 frames with 45,057 list calls (0.6 fps there). Earlier, quieter windows had 0 refused, with searching at or below 1 ms.

Those refusals are what #70 sees as indirect kind 0/1/2/10: prepare failed. With a diagnostics change that names the failing exit, every indirect drop in this run was descriptor table: no free slots (354 dispatches, 55 mesh dispatches and 4 draws in that frame). Details are in #70.

Compared with main without this PR (a 4.5-minute run on the same card), slot shortages came up in more and bigger windows: up to 2,504 dropped mesh dispatches in one frame. The runs differ in length, place in the game and frame rate, so I can't put a number on the improvement. It looks like this PR helps, but the pool can still run out on an 8 GB card.

This comment was written with AI assistance (Claude Code).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7200504467 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/237#issuecomment-7200504467). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-26T18:28:32Z. --- A test of this PR on another NVIDIA card: **RTX 2070 SUPER 8 GB** (Turing, driver 621.14, 32-lane waves, host view heaps capped at 1,000,000), 32 GB RAM, Windows 11. Tested as part of a local merge of this PR and about 30 other open PRs onto main `c9c932c`, diagnostics build, default `play.ps1` settings. **The slots still run out under load.** About 3 minutes into the prologue, one window of frames hits `no free dynamic descriptor slots: a table is not made n=27`, and this PR's counter reads: ``` dynamic slots: 12063 tables asked, 91 refused, 0.9 ms searching ``` That's over 8 frames with 45,057 list calls (0.6 fps there). Earlier, quieter windows had 0 refused, with searching at or below 1 ms. Those refusals are what #70 sees as `indirect kind 0/1/2/10: prepare failed`. With a diagnostics change that names the failing exit, every indirect drop in this run was `descriptor table: no free slots` (354 dispatches, 55 mesh dispatches and 4 draws in that frame). Details are in #70. Compared with main without this PR (a 4.5-minute run on the same card), slot shortages came up in more and bigger windows: up to 2,504 dropped mesh dispatches in one frame. The runs differ in length, place in the game and frame rate, so I can't put a number on the improvement. It looks like this PR helps, but the pool can still run out on an 8 GB card. This comment was written with AI assistance (Claude Code).
Jesper-Andersson commented 2026-11-26 23:10:36 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Jesper-Andersson on 2026-11-26T23:10:36Z.


A follow-up to my comment above, this time with this PR alone on main: with VICTORY_EARLY_TABLES=1 the slots no longer run out on an 8 GB card. With the default (off), they still do.

Setup: RTX 2070 SUPER 8 GB (driver 621.14, host view heap capped at 1,000,000), Ryzen 7 5800X, 32 GB, Windows 11. Builds:

  • base: main 126acb3 + #360 (names the failing exit of prepare failed) + #203 (DLSS).
  • tip: base + this PR (77e4543). The two differ only in this PR's files.

Diagnostics build, play.ps1 settings of 126acb3, Series S profile with DLSS (quality 2). Each run is the same stretch of the open world, about 1 to 1.5 minutes after loading. The numbers are the range over the 5 s lines in the world.

per frame base tip, defaults tip, VICTORY_EARLY_TABLES=1
tables asked 11,300–14,400 9,000–14,700 9,900–15,500
tables refused 1,950–3,620 (20–27%) 1,130–3,980 (10–27%) 0 (every line)
slot search 29–61 ms 2.3–4.8 ms 0.7–1.6 ms
indirect draws dropped (prepare failed (descriptor table: no free slots)) 1,440–2,420 0–2,340, mostly 800–2,000 0 (every line in the world)
draws 2,600–4,600 2,800–4,600 2,900–7,100
frame 2.2–4.0 fps (248–456 ms) 1.7–4.1 fps (242–588 ms) 1.9–3.0 fps (329–515 ms)
on screen meshes vanish and come back the same no missing meshes
  • The word search alone makes the search 10 to 15 times faster, but at its default the pool runs out as often as on main. VICTORY_EARLY_TABLES=1 is what removes the refusals here, as in your RTX 3080 numbers.
  • With it on, the log never says "a list ran again after its descriptor tables were given back", and nothing crashed or was removed.
  • The frame time goes up somewhat with it on, as you saw: the draws that used to be dropped get drawn. Preparing stayed about the same (51–103 ms a frame with it on, 48–127 ms on base), so the extra time isn't spent preparing. These are single runs of 1 to 1.5 minutes, so the fps ranges are rough.
  • Another run here, in a different stretch of the world, with a larger dynamic part of the capped heap (393,215 title / 606,784 dynamic; mgrein/victory-nvidia d4b8094a, after DexNom/VIctory#68, the same idea as #96's heap sizing) on top of this PR with VICTORY_EARLY_TABLES=1, also had 0 refused and 0 indirect dropped. On this card the early release alone is enough with 2^18 slots.

So on capped (NVIDIA) heaps, VICTORY_EARLY_TABLES=1 looks worth having on by default.

Separate from this PR but in the same code: #392, a list gives its dynamic slots back to whatever heap now has the old heap's address.

Not checked: AMD (no card here), runs longer than 1.5 minutes in the world, and Series X.

This comment was written with AI assistance (Claude Code).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7205318874 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/237#issuecomment-7205318874). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-26T23:10:36Z. --- A follow-up to my comment above, this time with this PR alone on main: **with `VICTORY_EARLY_TABLES=1` the slots no longer run out on an 8 GB card. With the default (off), they still do.** Setup: RTX 2070 SUPER 8 GB (driver 621.14, host view heap capped at 1,000,000), Ryzen 7 5800X, 32 GB, Windows 11. Builds: - **base:** main `126acb3` + #360 (names the failing exit of `prepare failed`) + #203 (DLSS). - **tip:** base + this PR (`77e4543`). The two differ only in this PR's files. Diagnostics build, `play.ps1` settings of `126acb3`, Series S profile with DLSS (quality 2). Each run is the same stretch of the open world, about 1 to 1.5 minutes after loading. The numbers are the range over the 5 s lines in the world. | per frame | base | tip, defaults | tip, `VICTORY_EARLY_TABLES=1` | |---|---|---|---| | tables asked | 11,300–14,400 | 9,000–14,700 | 9,900–15,500 | | tables refused | 1,950–3,620 (20–27%) | 1,130–3,980 (10–27%) | **0** (every line) | | slot search | 29–61 ms | 2.3–4.8 ms | 0.7–1.6 ms | | indirect draws dropped (`prepare failed (descriptor table: no free slots)`) | 1,440–2,420 | 0–2,340, mostly 800–2,000 | **0** (every line in the world) | | draws | 2,600–4,600 | 2,800–4,600 | 2,900–7,100 | | frame | 2.2–4.0 fps (248–456 ms) | 1.7–4.1 fps (242–588 ms) | 1.9–3.0 fps (329–515 ms) | | on screen | meshes vanish and come back | the same | no missing meshes | - The word search alone makes the search 10 to 15 times faster, but at its default the pool runs out as often as on main. `VICTORY_EARLY_TABLES=1` is what removes the refusals here, as in your RTX 3080 numbers. - With it on, the log never says "a list ran again after its descriptor tables were given back", and nothing crashed or was removed. - The frame time goes up somewhat with it on, as you saw: the draws that used to be dropped get drawn. Preparing stayed about the same (51–103 ms a frame with it on, 48–127 ms on base), so the extra time isn't spent preparing. These are single runs of 1 to 1.5 minutes, so the fps ranges are rough. - Another run here, in a different stretch of the world, with a larger dynamic part of the capped heap (393,215 title / 606,784 dynamic; mgrein/victory-nvidia `d4b8094a`, after DexNom/VIctory#68, the same idea as #96's heap sizing) on top of this PR with `VICTORY_EARLY_TABLES=1`, also had 0 refused and 0 indirect dropped. On this card the early release alone is enough with 2^18 slots. So on capped (NVIDIA) heaps, `VICTORY_EARLY_TABLES=1` looks worth having on by default. Separate from this PR but in the same code: #392, a list gives its dynamic slots back to whatever heap now has the old heap's address. Not checked: AMD (no card here), runs longer than 1.5 minutes in the world, and Series X. This comment was written with AI assistance (Claude Code).
akimfomin commented 2026-11-26 23:30:31 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by akimfomin on 2026-11-26T23:30:31Z.


The current rebase of #237 onto 014d52dedf837d1ac660a0bd256c4704be9eeb40 conflicts in host.rs and texture.rs. PortBridge checked 77e4543 against that exact Git tree. Jesper's isolated RTX 2070 SUPER run establishes the slot-exhaustion benefit of early release. I also verified that the #237 head still releases ranges by heap address alone, the separate lifetime case in #392.

After resolving the two files, carry the fxceless #1324 two-heaps regression to verify early release does not free another heap's live range. The source check establishes the missing identity guard. It does not attribute a 2070 artifact to it. PortBridge · AI-assisted comparison.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7205598787 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/237#issuecomment-7205598787). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-26T23:30:31Z. --- The current rebase of #237 onto `014d52dedf837d1ac660a0bd256c4704be9eeb40` conflicts in `host.rs` and `texture.rs`. PortBridge checked `77e4543` against that exact Git tree. Jesper's [isolated RTX 2070 SUPER run](https://github.com/avatarmanz/VIctory-7900XTX/pull/237#issuecomment-7205318874) establishes the slot-exhaustion benefit of early release. I also verified that [the #237 head still releases ranges by heap address alone](https://github.com/avatarmanz/VIctory-7900XTX/blob/77e4543121a687aa17d30347f9ed161bb327c818/crates/victory-gpu/src/descriptor.rs#L784-L802), the separate lifetime case in [#392](https://github.com/avatarmanz/VIctory-7900XTX/issues/392). After resolving the two files, carry the [fxceless #1324 two-heaps regression](https://github.com/fxceless/victory-fork/pull/1324) to verify early release does not free another heap's live range. The source check establishes the missing identity guard. It does not attribute a 2070 artifact to it. [PortBridge](https://github.com/akimfomin/PortBridge/issues/98) · AI-assisted comparison.
Jesper-Andersson commented 2026-11-26 23:49:47 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Jesper-Andersson on 2026-11-26T23:49:47Z.


A correction to my last comment: main already does part 2. Since 1e72861 (now in main 014d52d), a landed flight's lists give their tables' slots back through HostList::release_tables() in both settle paths (host.rs:5165 and :5635), always, with no switch. That's what VICTORY_EARLY_TABLES=1 does here, so the "on by default" I suggested is already main's behaviour. It's also probably why this PR now conflicts in host.rs and list.rs.

From reading main at 014d52d, the other three parts still apply:

  1. The slot search: main still keeps the dynamic slots as a Vec<bool> searched one slot at a time (descriptor/host.rs:180). In my runs above the word search alone took the search from 29–61 ms to 2.3–4.8 ms a frame.
  2. BackDiffer is still counted only on the shadow path (shadow.rs:3410).
  3. With the pool on, the first upload into a texture still records an aliasing barrier whatever the texture is (host.rs:6971), committed ones included.

So a rebase onto main could drop part 2 and keep 1, 3 and 4. I haven't run main 014d52d itself in game. This is from the code only.

This comment was written with AI assistance (Claude Code).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7205899562 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/237#issuecomment-7205899562). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-26T23:49:47Z. --- A correction to my last comment: main already does part 2. Since 1e72861 (now in main `014d52d`), a landed flight's lists give their tables' slots back through `HostList::release_tables()` in both settle paths (`host.rs:5165` and `:5635`), always, with no switch. That's what `VICTORY_EARLY_TABLES=1` does here, so the "on by default" I suggested is already main's behaviour. It's also probably why this PR now conflicts in `host.rs` and `list.rs`. From reading main at `014d52d`, the other three parts still apply: 1. The slot search: main still keeps the dynamic slots as a `Vec<bool>` searched one slot at a time (`descriptor/host.rs:180`). In my runs above the word search alone took the search from 29–61 ms to 2.3–4.8 ms a frame. 3. `BackDiffer` is still counted only on the shadow path (`shadow.rs:3410`). 4. With the pool on, the first upload into a texture still records an aliasing barrier whatever the texture is (`host.rs:6971`), committed ones included. So a rebase onto main could drop part 2 and keep 1, 3 and 4. I haven't run main `014d52d` itself in game. This is from the code only. This comment was written with AI assistance (Claude Code).
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/237:upstream-pr/237'
git switch 'upstream-pr/237'

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/237'
git switch 'upstream-pr/237'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/237'
git switch 'upstream-pr/237'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/237'
git switch 'main'
git merge --squash 'upstream-pr/237'
git switch 'main'
git merge --ff-only 'upstream-pr/237'
git switch 'main'
git merge 'upstream-pr/237'
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
avatarmanz/VIctory-7900XTX!237
No description provided.