GPU/draw: reduce CPU work when preparing descriptor tables #1192

Open
github-bot wants to merge 3 commits from github-bot/gh-1192 into main AGit
Owner

@⁠nicolasveilleux on GitHub · 2026-11-25 23:24 UTC · original
nicolasveilleux:perf/descriptor-preparation → main · +217 −52 · 2 files · 3 commits · open

What changes

  • Build the static descriptor-table layout once per host pipeline stage. Preserve shader order on cache hits and keep the first declared resource for aliases in the same 32-byte record; use one ordered pass when rebuilding a table.
  • Use a fixed slot set instead of sorting and deduplicating a temporary vector. Keep the first eight remapped offsets inline, with overflow for larger sets.
  • Group dynamic view expressions by table at pipeline creation and avoid allocating the selection list for zero or one expression. Evaluate the expressions with live root constants on each bind.

Descriptor contents, cache keys, fallback paths and GPU commands are unchanged. The expected benefit is less CPU work while recording draws and dispatches; no gameplay FPS gain has been measured.

Validation

On Windows 11 with an RTX 2070 Super, using public code and synthetic test data only, release build with diagnostics:

  • cargo test -p victory-gpu --lib --release --offline --locked --features diagnostics table_: 3 passed.
  • cargo test -p victory-gpu --lib --release --offline --locked --features diagnostics descriptor::: 28 passed.
  • git diff --check: clean.
**@⁠nicolasveilleux** on GitHub · 2026-11-25 23:24 UTC · [original](https://github.com/fxceless/victory-fork/pull/1192) `nicolasveilleux:perf/descriptor-preparation` → `main` · +217 −52 · 2 files · 3 commits · open ## What changes - Build the static descriptor-table layout once per host pipeline stage. Preserve shader order on cache hits and keep the first declared resource for aliases in the same 32-byte record; use one ordered pass when rebuilding a table. - Use a fixed slot set instead of sorting and deduplicating a temporary vector. Keep the first eight remapped offsets inline, with overflow for larger sets. - Group dynamic view expressions by table at pipeline creation and avoid allocating the selection list for zero or one expression. Evaluate the expressions with live root constants on each bind. Descriptor contents, cache keys, fallback paths and GPU commands are unchanged. The expected benefit is less CPU work while recording draws and dispatches; no gameplay FPS gain has been measured. ## Validation On Windows 11 with an RTX 2070 Super, using public code and synthetic test data only, release build with diagnostics: - `cargo test -p victory-gpu --lib --release --offline --locked --features diagnostics table_`: 3 passed. - `cargo test -p victory-gpu --lib --release --offline --locked --features diagnostics descriptor::`: 28 passed. - `git diff --check`: clean.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:14 +00:00
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-25 23:52 UTC · original · edited 2026-11-26 00:04 UTC

I tried this with #927. Its half-precision buffer views can lie past the range's first declared descriptor, so they still need to contribute to the table length after indexed expressions move into the stage layout. Otherwise the slot containing the half view can end up outside the fresh table.

I pushed the combined three commits on top of #927. The path with zero or one expression still avoids allocating when there are no extra half views. The slot-set, inline offset and layout tests passed, and the existing a_fresh_table_holds_the_half_views_past_its_range_starts regression passed under Wine 11.22 with RADV 26.3.1 on the RX 7900 XT. This is useful if both PRs land.

I also tried an integration build with both changes and our other renderer patches. With scripted input enabled the run ended in device loss 95.7 seconds into startup, before the first-room timing window. I excluded it from the performance results. That run does not isolate the cause. The synthetic compatibility test above passed.

**@⁠UwUCammie** on GitHub · 2026-11-25 23:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/1192#issuecomment-7178160485) · edited 2026-11-26 00:04 UTC I tried this with #927. Its half-precision buffer views can lie past the range's first declared descriptor, so they still need to contribute to the table length after indexed expressions move into the stage layout. Otherwise the slot containing the half view can end up outside the fresh table. I pushed [the combined three commits on top of #927](https://github.com/UwUCammie/victory-amd/tree/test/1192-half-views). The path with zero or one expression still avoids allocating when there are no extra half views. The slot-set, inline offset and layout tests passed, and the existing `a_fresh_table_holds_the_half_views_past_its_range_starts` regression passed under Wine 11.22 with RADV 26.3.1 on the RX 7900 XT. This is useful if both PRs land. I also tried an integration build with both changes and our other renderer patches. With scripted input enabled the run ended in device loss 95.7 seconds into startup, before the first-room timing window. I excluded it from the performance results. That run does not isolate the cause. The synthetic compatibility test above passed.
Author
Owner

@⁠alpz1000 on GitHub · 2026-11-26 05:09 UTC · original

I built cee1b7d into a local Windows diagnostics build and ran it on an i5-8400, RTX 3060 12 GB (610.88), 32 GB RAM. Both builds used the same local base and settings, the same stationary Series S checkpoint, and separate copies of the same initial pipeline library. The candidate adds only this PR and the merge resolution that retained the base's diagnostic counters.

Warm checkpoint metric Base With this PR
Frames measured 286 319
FPS 5.09 4.83
p90 frame time 239 ms 261 ms
Combined recording time per frame 400.6 ms 382.6 ms
Recording calls per frame 38,822 38,803
Submission preparation per frame 158.4 ms 163.3 ms

I selected windows with 4,250–4,750 draws and under 1 ms of pipeline waiting. FPS and p90 include long frames. Recording time sums all recording threads, so the 18 ms reduction does not imply an 18 ms change in frame time. This was one run per build. It shows lower recording time, with no gameplay FPS gain in this sample.

In the integrated tree, cargo test --profile diag --locked -p victory-gpu --features diagnostics --lib table_ -- --test-threads=1 passed 3/3, and the corresponding descriptor:: filter passed 30/30. AI-assisted test and write-up.

**@⁠alpz1000** on GitHub · 2026-11-26 05:09 UTC · [original](https://github.com/fxceless/victory-fork/pull/1192#issuecomment-7183225532) I built `cee1b7d` into a local Windows diagnostics build and ran it on an i5-8400, RTX 3060 12 GB (610.88), 32 GB RAM. Both builds used the same local base and settings, the same stationary Series S checkpoint, and separate copies of the same initial pipeline library. The candidate adds only this PR and the merge resolution that retained the base's diagnostic counters. | Warm checkpoint metric | Base | With this PR | |---|---:|---:| | Frames measured | 286 | 319 | | FPS | 5.09 | 4.83 | | p90 frame time | 239 ms | 261 ms | | Combined recording time per frame | 400.6 ms | 382.6 ms | | Recording calls per frame | 38,822 | 38,803 | | Submission preparation per frame | 158.4 ms | 163.3 ms | I selected windows with 4,250–4,750 draws and under 1 ms of pipeline waiting. FPS and p90 include long frames. Recording time sums all recording threads, so the 18 ms reduction does not imply an 18 ms change in frame time. This was one run per build. It shows lower recording time, with no gameplay FPS gain in this sample. In the integrated tree, `cargo test --profile diag --locked -p victory-gpu --features diagnostics --lib table_ -- --test-threads=1` passed 3/3, and the corresponding `descriptor::` filter passed 30/30. AI-assisted test and write-up.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1192/head:github-bot/gh-1192'
git switch 'github-bot/gh-1192'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1192'
git switch 'github-bot/gh-1192'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1192'
git switch 'github-bot/gh-1192'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1192'
git switch 'main'
git merge --squash 'github-bot/gh-1192'
git switch 'main'
git merge --ff-only 'github-bot/gh-1192'
git switch 'main'
git merge 'github-bot/gh-1192'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.