GPU: hash small PSO descriptions in one frame, borrow shader bytecode #1202

Open
github-bot wants to merge 17 commits from github-bot/gh-1202 into main AGit
Owner

@⁠Jineggegg on GitHub · 2026-11-28 15:28 UTC · original
Jineggegg:hot-pso-prebuild → main · +80 −29 · 2 files · 17 commits · open

What this changes

Hot prebuild of the 16 hot pipelines hashed every short shader chunk with its own update call, and each pipeline name was built from a fresh copy of every stage's DXIL bytes.

  • pipeline::name now puts small descriptions (framing + bytes up to 8 BLAKE3 chunks) into one contiguous frame and hashes it in a single update, so BLAKE3 can hash the short chunks together. Large descriptions keep the original streaming path.
  • The name callers in pipeline/host.rs now borrow the translated DXIL slices instead of copying them through code_bytes, which is removed.
  • The length framing is unchanged, so names written before still load: the test pins a known name (9402d2bc...), and a new test checks the framing at the 8 KiB frame boundary (8191/8192/8193 bytes).

Adapted from Jineggegg/VIctory round 1 item 5 (commit 2b98109), rebased onto current main. The graphics path has moved on since then: it now names "graphics rectangles" and "graphics" separately with a retry without the geometry stage, so all four name call sites (compute, mesh, graphics with/without the rectangle stage) take the borrowed slices.

Testing

  • On an RTX 5090 (driver 621.14, Rust 1.98.1) in the original round 1 acceptance, the same change cut hot prebuild of the 16 pipelines from 104.0 to 84.0 us (paired -18.85%, 30 pairs, forward window) and from 103.9 to 83.6 us (paired -19.91%, reverse window). The 1 MiB writeback soak showed no stable change (p50 +0.36%, intervals crossing zero). Caveat from that acceptance: the two descriptor-sync timings rose in the same windows and round 1 could not attribute them, so it held the merge; this port changes nothing about descriptor sync.
  • On this checkout: cargo check -p victory-gpu is clean, and cargo test -p victory-gpu --lib pipeline::library passes all 7 tests, including the pinned-name and frame-boundary tests.

Notes on nearby open PRs

  • #1114 (static-sampler places in the name): still open. This change keeps one hasher for both paths, so a places suffix appended after the frame/stream choice still works as before; if #1114 lands first, the rebase needs the places bytes inside the frame too.
  • #1127 (a Stage argument for pipeline()): still open. It does not touch name(), and this PR does not touch pipeline() calls.
  • #891 (root-signature cache, new code after code_bytes): still open. It does not use code_bytes, so removing that helper stays fine if it lands first.
**@⁠Jineggegg** on GitHub · 2026-11-28 15:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1202) `Jineggegg:hot-pso-prebuild` → `main` · +80 −29 · 2 files · 17 commits · open ## What this changes Hot prebuild of the 16 hot pipelines hashed every short shader chunk with its own `update` call, and each pipeline name was built from a fresh copy of every stage's DXIL bytes. - `pipeline::name` now puts small descriptions (framing + bytes up to 8 BLAKE3 chunks) into one contiguous frame and hashes it in a single `update`, so BLAKE3 can hash the short chunks together. Large descriptions keep the original streaming path. - The name callers in `pipeline/host.rs` now borrow the translated DXIL slices instead of copying them through `code_bytes`, which is removed. - The length framing is unchanged, so names written before still load: the test pins a known name (`9402d2bc...`), and a new test checks the framing at the 8 KiB frame boundary (8191/8192/8193 bytes). Adapted from Jineggegg/VIctory round 1 item 5 (commit `2b98109`), rebased onto current `main`. The graphics path has moved on since then: it now names `"graphics rectangles"` and `"graphics"` separately with a retry without the geometry stage, so all four name call sites (compute, mesh, graphics with/without the rectangle stage) take the borrowed slices. ## Testing - On an RTX 5090 (driver 621.14, Rust 1.98.1) in the original round 1 acceptance, the same change cut hot prebuild of the 16 pipelines from 104.0 to 84.0 us (paired -18.85%, 30 pairs, forward window) and from 103.9 to 83.6 us (paired -19.91%, reverse window). The 1 MiB writeback soak showed no stable change (p50 +0.36%, intervals crossing zero). Caveat from that acceptance: the two descriptor-sync timings rose in the same windows and round 1 could not attribute them, so it held the merge; this port changes nothing about descriptor sync. - On this checkout: `cargo check -p victory-gpu` is clean, and `cargo test -p victory-gpu --lib pipeline::library` passes all 7 tests, including the pinned-name and frame-boundary tests. ## Notes on nearby open PRs - #1114 (static-sampler places in the name): still open. This change keeps one hasher for both paths, so a places suffix appended after the frame/stream choice still works as before; if #1114 lands first, the rebase needs the places bytes inside the frame too. - #1127 (a `Stage` argument for `pipeline()`): still open. It does not touch `name()`, and this PR does not touch `pipeline()` calls. - #891 (root-signature cache, new code after `code_bytes`): still open. It does not use `code_bytes`, so removing that helper stays fine if it lands first.
Hot prebuild hashed every short shader chunk with its own update and copied each stage's DXIL bytes to name a pipeline. Small descriptions now go into one contiguous frame so BLAKE3 hashes them together, and the name callers borrow the translated DXIL slices instead of copying them. Large descriptions keep the original streaming path, and the length framing is unchanged, so names from before still load.

Adapted from Jineggegg/VIctory round 1 item 5 (2b98109) to current main.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 15:32:52 +00:00
`slots_showing` took the slot's `Made` key with `?`, but `Made` has keys
for the title's `count` slots only while `kept` also has the dynamic
ones: a host texture shown by a dynamic slot was no longer reported, so
it was no longer blocked and could be chosen (freeing nothing, as the
dynamic slot holds a reference, while the title made a second copy).
Those slots are reported again with key 0, as before the key was carried;
they are never put back to waiting, only counted as blocking. Test:
`a_dynamic_slot_showing_a_texture_still_blocks_its_eviction`.

`SLOT_LOOKING` is now cleared by a drop guard, so a look that panics does
not stop every later look.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b23c0c4038)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts in pipeline/library.rs name() and pipeline/host.rs:
- name(): main's static-sampler places (PLACES) are appended after both the
  framed and the streaming path, through the same hasher, so names with and
  without places are unchanged from main.
- host.rs: main's primed_places and root-signature cache are kept; code_bytes
  is dropped (no callers left). The mesh path borrows the bytes the pipeline is
  made from: the linked DXIL when main links the stages, the translated DXIL
  otherwise, which are the bytes main hashed (no copy).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
main appends the static samplers' places (PLACES) to a pipeline's name hash;
after the merge they go after either the framed or the streaming path, through
the same hasher. The test checks, for descriptions on both sides of the 8 KiB
framed limit, that the name with places equals a streaming reference with the
places as one more length-framed part, and differs from the name without them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Jineggegg on GitHub · 2026-12-01 09:33 UTC · original

Merged current main (e1251c31) into this branch; GitHub showed it as conflicting. The conflicts were in pipeline::library::name() and pipeline/host.rs:

  • name(): main now appends the static samplers' places (PLACES) to the hash. They are appended after both the framed path (small descriptions) and the streaming path, through the same hasher, so names with and without places are unchanged from main.
  • host.rs: main's primed_places and root-signature cache are kept; code_bytes is dropped (no callers left). Where main links the mesh and pixel stages, the name borrows the linked DXIL, which is what code_bytes(&ms) hashed before, so mesh pipeline names are unchanged too.

Added library_names_keep_the_static_sampler_places_on_both_paths: for descriptions on both sides of the 8 KiB framed limit, a name with places equals a streaming reference with the places as one more length-framed part, and differs from the name without them.

Checked on Windows (Rust 1.98.1, RTX 5090), on this branch's tree (the GPU tests ran on a rebased copy with the identical tree): both CI Clippy configurations add no diagnostic to main's (main does not pass -D warnings right now: 4 warnings without --all-features, 5 with). cargo test --workspace --locked: 2521 passed, 6 failed, 96 ignored (main: 2520 passed, 5 failed, 96 ignored). The failures main has itself (list::thin::tests::bindings_record_no_work, shader_cache::tests::every_switch_of_the_translator_is_in_the_key, modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it, emit::bitcode::opt::tests::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity, policy::tests::repository_passes_policy), and host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue. That one is intermittent on main too: running the victory-gpu lib tests of main, this branch and two other branches in turn in one GPU window, it failed in 4 of 22 runs on main and 3 of 22 on this branch. The test counts reuses of the process-wide UAV buffer pool, which other tests running at the same time also use. This change does not touch that path. So no new failure.

AI assistance: the merge, the new test and this comment were prepared with an AI coding assistant (Claude Code) and checked as described above.

🤖 Generated with Claude Code

**@⁠Jineggegg** on GitHub · 2026-12-01 09:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1202#issuecomment-7306877151) Merged current `main` (e1251c31) into this branch; GitHub showed it as conflicting. The conflicts were in `pipeline::library::name()` and `pipeline/host.rs`: - `name()`: main now appends the static samplers' places (`PLACES`) to the hash. They are appended after both the framed path (small descriptions) and the streaming path, through the same hasher, so names with and without places are unchanged from main. - `host.rs`: main's `primed_places` and root-signature cache are kept; `code_bytes` is dropped (no callers left). Where main links the mesh and pixel stages, the name borrows the linked DXIL, which is what `code_bytes(&ms)` hashed before, so mesh pipeline names are unchanged too. Added `library_names_keep_the_static_sampler_places_on_both_paths`: for descriptions on both sides of the 8 KiB framed limit, a name with places equals a streaming reference with the places as one more length-framed part, and differs from the name without them. Checked on Windows (Rust 1.98.1, RTX 5090), on this branch's tree (the GPU tests ran on a rebased copy with the identical tree): both CI Clippy configurations add no diagnostic to main's (main does not pass `-D warnings` right now: 4 warnings without `--all-features`, 5 with). `cargo test --workspace --locked`: 2521 passed, 6 failed, 96 ignored (`main`: 2520 passed, 5 failed, 96 ignored). The failures `main` has itself (`list::thin::tests::bindings_record_no_work`, `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`, `modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it`, `emit::bitcode::opt::tests::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity`, `policy::tests::repository_passes_policy`), and `host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue`. That one is intermittent on `main` too: running the `victory-gpu` lib tests of `main`, this branch and two other branches in turn in one GPU window, it failed in 4 of 22 runs on `main` and 3 of 22 on this branch. The test counts reuses of the process-wide UAV buffer pool, which other tests running at the same time also use. This change does not touch that path. So no new failure. AI assistance: the merge, the new test and this comment were prepared with an AI coding assistant (Claude Code) and checked as described above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
main was rewritten after this branch was made: e1251c31 and the 13 commits
before it are no longer on main, so GitHub showed the branch as conflicting
(in host/menu.rs and modules/xmem.rs, which this branch does not change).
This merge takes main as it is now and keeps only this branch's change,
which applies to it without conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline/host.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/1202/head:github-bot/gh-1202'
git switch 'github-bot/gh-1202'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1202'
git switch 'github-bot/gh-1202'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1202'
git switch 'github-bot/gh-1202'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1202'
git switch 'main'
git merge --squash 'github-bot/gh-1202'
git switch 'main'
git merge --ff-only 'github-bot/gh-1202'
git switch 'main'
git merge 'github-bot/gh-1202'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1202
No description provided.