GPU: fresh descriptor tables take only their used range (port of upstream #1349) #218

Closed
m335671 wants to merge 1 commit from upstream-pr/218 into main
m335671 commented 2026-11-24 22:39:56 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by m335671 on 2026-11-24T22:39:56Z.


Summary

A fresh descriptor table took dynamic slots for entries 0..=last used. A draw that reads entries 120..=123 of a table therefore held 124 slots. On a capped NVIDIA view heap (2^18 dynamic slots), heavy scenes asked for more than the pool holds:

WARN no free dynamic descriptor slots: a table is not made n=26
WARN a draw whose descriptor table found no free slots is dropped

The indirect draws behind those tables were then dropped (indirect kind 0/2: prepare failed, about 190 + 120–285 per frame) until the scene got lighter. In the prologue that shows as floors and walls disappearing a few minutes in.

This ports the table trimming of upstream Marvisak/VIctory#1349 (wrothgaril). The 2^18 reservation part of that PR is already in this fork. The port is adapted to this fork's picked indices (selected).

Changes

crates/victory-gpu/src/draw.rs:

  • fresh_table_range: a fresh table spans from its first used entry or picked index to its last, instead of from entry 0.
  • Its virtual slot 0 moves back by that start (base = first - start), so entry k still lies at base + k and the translated shaders' (user_data + offset) >> 5 lands on the slots taken. start is clamped to the mirrored count, so base stays whole.
  • The cache key hashes only the used range, plus its start. Only start..end is made, and the title-slot bookkeeping (texture_slot_tabled, mirror) covers only that range.
  • Tests:
    • fresh_tables_take_their_used_range: used entries, picked indices on either side, no entry, and the clamp.
    • trimmed_tables_index_the_slots_they_take: on a real host heap, entries 120 and 123 land on first and first + 3, and the next table starts at first + 4 (returns early without a GPU).

Verification

  • NVIDIA GeForce RTX 4070 12 GB (driver 32.0.16.2124), AMD Ryzen 9 7900, 32 GB, Windows 11 Pro 26300, Rust 1.97.1. Branch on 2119b0e.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and with --all-features: 0 warnings.
  • cargo test --workspace --locked: 498 passed, 0 failed, 7 ignored (both new tests included).
  • cargo xtask policy: 169 files ok.
  • In game (Series X, prologue checkpoint, VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024, warm pipeline library, diagnostics builds; counts only):
without (base + #77) with this change (+ #77, #51, #81)
run length ~11 min ~5 min and ~10 min
dynamic slots: … refused (sum of samples) 3,504 0 and 0
no free dynamic descriptor slots yes (21:39:31) none
indirect … prepare failed ~190 + 120–285 / frame for ~1 min none
peak tables asked per sample 26,962 18,574 / 18,782
  • Visual, at the same window of the first gameplay room. Same checkpoint, pad untouched until the character stands there, the same build otherwise (90228a7 + #77 + #51 + #81):
runs walls around the window
without this change (2 release, 1 diagnostics) 3 missing in all 3: sky on both sides, posters missing, stair-stepped stale patches where nothing was drawn
with this change 2 present in both, posters too

An earlier run without the change (on 1684989 + #77) had the room's walls at first, before the pool ran out. So walls are missing much more often without it, not always.

I could not compare one fixed frame: VICTORY_CAPTURE_FRAMES frame numbers fall at different moments from run to run, because loading time varies.

Not tested / caveats

  • The runs with this change did not reach the same peak demand as the run without (18.8k vs 27k tables asked), so the scene with the worst starvation is not covered one-to-one.
  • With the walls present, closed rooms are dark (no ray-traced or indirect light yet, as the README says). That is not a change in lighting.
  • A shader that indexes a descriptor array below its first used entry or picked index would now read outside the range made. Upstream #1349 takes the same range; I saw no a table entry without a view and no new warning in these runs.
  • AMD, other NVIDIA cards, scenes past the prologue's first minutes.

AI use: Claude Code (Claude Opus 5.5) found the starvation in the diagnostics logs, ported and adapted the change, wrote the tests, ran the checks and the title on my machine, and wrote this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592842488 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/218). Originally posted by [m335671](https://github.com/m335671) on 2026-11-24T22:39:56Z. --- ## Summary A fresh descriptor table took dynamic slots for entries `0..=last used`. A draw that reads entries 120..=123 of a table therefore held 124 slots. On a capped NVIDIA view heap (2^18 dynamic slots), heavy scenes asked for more than the pool holds: ``` WARN no free dynamic descriptor slots: a table is not made n=26 WARN a draw whose descriptor table found no free slots is dropped ``` The indirect draws behind those tables were then dropped (`indirect kind 0/2: prepare failed`, about 190 + 120–285 per frame) until the scene got lighter. In the prologue that shows as floors and walls disappearing a few minutes in. This ports the table trimming of upstream Marvisak/VIctory#1349 (wrothgaril). The 2^18 reservation part of that PR is already in this fork. The port is adapted to this fork's picked indices (`selected`). ## Changes `crates/victory-gpu/src/draw.rs`: - `fresh_table_range`: a fresh table spans from its first used entry *or picked index* to its last, instead of from entry 0. - Its virtual slot 0 moves back by that start (`base = first - start`), so entry `k` still lies at `base + k` and the translated shaders' `(user_data + offset) >> 5` lands on the slots taken. `start` is clamped to the mirrored count, so `base` stays whole. - The cache key hashes only the used range, plus its start. Only `start..end` is made, and the title-slot bookkeeping (`texture_slot_tabled`, `mirror`) covers only that range. - Tests: - `fresh_tables_take_their_used_range`: used entries, picked indices on either side, no entry, and the clamp. - `trimmed_tables_index_the_slots_they_take`: on a real host heap, entries 120 and 123 land on `first` and `first + 3`, and the next table starts at `first + 4` (returns early without a GPU). ## Verification - NVIDIA GeForce RTX 4070 12 GB (driver 32.0.16.2124), AMD Ryzen 9 7900, 32 GB, Windows 11 Pro 26300, Rust 1.97.1. Branch on `2119b0e`. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and with `--all-features`: 0 warnings. - `cargo test --workspace --locked`: 498 passed, 0 failed, 7 ignored (both new tests included). - `cargo xtask policy`: 169 files ok. - In game (Series X, prologue checkpoint, `VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024`, warm pipeline library, diagnostics builds; counts only): | | without (base + #77) | with this change (+ #77, #51, #81) | |---|---|---| | run length | ~11 min | ~5 min and ~10 min | | `dynamic slots: … refused` (sum of samples) | **3,504** | **0** and **0** | | `no free dynamic descriptor slots` | yes (21:39:31) | none | | `indirect … prepare failed` | ~190 + 120–285 / frame for ~1 min | none | | peak tables asked per sample | 26,962 | 18,574 / 18,782 | - Visual, at the same window of the first gameplay room. Same checkpoint, pad untouched until the character stands there, the same build otherwise (`90228a7` + #77 + #51 + #81): | | runs | walls around the window | |---|---|---| | without this change (2 release, 1 diagnostics) | 3 | **missing in all 3**: sky on both sides, posters missing, stair-stepped stale patches where nothing was drawn | | with this change | 2 | **present in both**, posters too | An earlier run without the change (on `1684989` + #77) had the room's walls at first, before the pool ran out. So walls are missing much more often without it, not always. I could not compare one fixed frame: `VICTORY_CAPTURE_FRAMES` frame numbers fall at different moments from run to run, because loading time varies. ## Not tested / caveats - The runs with this change did not reach the same peak demand as the run without (18.8k vs 27k tables asked), so the scene with the worst starvation is not covered one-to-one. - With the walls present, closed rooms are dark (no ray-traced or indirect light yet, as the README says). That is not a change in lighting. - A shader that indexes a descriptor array *below* its first used entry or picked index would now read outside the range made. Upstream #1349 takes the same range; I saw no `a table entry without a view` and no new warning in these runs. - AMD, other NVIDIA cards, scenes past the prologue's first minutes. AI use: Claude Code (Claude Opus 5.5) found the starvation in the diagnostics logs, ported and adapted the change, wrote the tests, ran the checks and the title on my machine, and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
m335671 commented 2026-11-25 07:06:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by m335671 on 2026-11-25T06:59:08Z.


Rebased onto main 8dd30ab (now fa5ec43). The only conflict was the end of draw.rs, where main added depth_bounds (#82) at the same place as this PR's helper and tests. Both are kept. The loop over the table keeps title + k for the picked-index texture slots added in a803c87, with k in start..end.

  • cargo test -p victory-gpu --release: 133 passed, 0 failed, 3 ignored (the two tests of this PR included).
  • cargo clippy -p victory-gpu: no new warning.

A data point against the need for it: one run of 8dd30ab without this PR (RTX 4070, diagnostics build, ~7 minutes to the first gameplay room) had 0 refused dynamic slots (11,277 tables asked per sample), and the walls were there. Before, the refusals started some minutes into a run, so a run this short does not show whether main still needs the trim. I'll post a longer run when I have one.

AI use: Claude Code (Claude Opus 5.5) did the rebase and ran the tests and the run on my machine, and wrote this comment.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7155363593 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/218#issuecomment-7155363593). Originally posted by [m335671](https://github.com/m335671) on 2026-11-25T06:59:08Z. --- Rebased onto `main` `8dd30ab` (now `fa5ec43`). The only conflict was the end of `draw.rs`, where `main` added `depth_bounds` (#82) at the same place as this PR's helper and tests. Both are kept. The loop over the table keeps `title + k` for the picked-index texture slots added in `a803c87`, with `k` in `start..end`. - `cargo test -p victory-gpu --release`: 133 passed, 0 failed, 3 ignored (the two tests of this PR included). - `cargo clippy -p victory-gpu`: no new warning. A data point against the need for it: one run of `8dd30ab` **without** this PR (RTX 4070, diagnostics build, ~7 minutes to the first gameplay room) had `0 refused` dynamic slots (11,277 tables asked per sample), and the walls were there. Before, the refusals started some minutes into a run, so a run this short does not show whether `main` still needs the trim. I'll post a longer run when I have one. AI use: Claude Code (Claude Opus 5.5) did the rebase and ran the tests and the run on my machine, and wrote this comment.
upstream-sync closed this pull request 2026-11-25 11:10:10 +00:00
m335671 commented 2026-11-25 11:10:35 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by m335671 on 2026-11-25T10:19:16Z.


A/B on main 8dd30ab, RTX 4070, diagnostics build, the first gameplay room, 20 minutes each: without this PR, 207 samples and 0 refused dynamic slots. With it, 216 samples and 0 refused. The walls were there in both, at 1.8 against 1.9 fps. The overflow this PR fixed on 2119b0e no longer happens on main here, so I'm closing it. If refusals come back in a heavier scene, it can be reopened.

AI use: Claude Code (Claude Opus 5.5) ran the A/B on my machine and wrote this comment.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7159533846 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/218#issuecomment-7159533846). Originally posted by [m335671](https://github.com/m335671) on 2026-11-25T10:19:16Z. --- A/B on `main` `8dd30ab`, RTX 4070, diagnostics build, the first gameplay room, 20 minutes each: **without** this PR, 207 samples and 0 refused dynamic slots. **With** it, 216 samples and 0 refused. The walls were there in both, at 1.8 against 1.9 fps. The overflow this PR fixed on `2119b0e` no longer happens on `main` here, so I'm closing it. If refusals come back in a heavier scene, it can be reopened. AI use: Claude Code (Claude Opus 5.5) ran the A/B on my machine and wrote this comment.

Pull request closed

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!218
No description provided.