Draw: VICTORY_ROOT_BIND_CACHE=1 leaves out root bindings a list already has #3068
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3068
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3068"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Adriwin06 on GitHub · 2026-11-29 19:52 UTC · original
Adriwin06:root-bind-cache→main· +251 −95 · 1 files · 2 commits · closed without mergingWhat it changes
Off by default. With VICTORY_ROOT_BIND_CACHE=1 a list remembers, per
graphics and compute root, the root constants and root resources
(tables, CBV/SRV/UAV addresses) it last set, and a SetRoot call that
would set the same value again is not recorded. The constants are
compared as a slice in a buffer reused in place, so the check allocates
nothing. What is remembered is cleared when the root signature changes,
when the tables are done, on reset and on replay.
Tests: draw::root_binding_tests.
Ported from stellarr-studio/kelvaroq patch 0031 (translated-root-state),
GPL-3.0-or-later.
How it was tested
cargo testpassed for the crates it touches:cargo test -p victory-gpu --lib -- draw::: 27 passedcargo clippy --workspace --all-targets --locked: no finding that main does not already have (main has 34 of its own, which is why the Clippy step of CI is red on main itself).cargo xtask policy: no new finding (main fails it on crates/victory-loader/src/heap_sites/frame_users.rs).cargo clippyalso with--all-featuresadds no finding, andcargo test --workspace --lockedfails only tests main also fails on this machine: the five shader tests that fail on main here too (WARP's SM 6.2 and the validator) (barycentric_tests::first_half_values_render_on_hardware_and_warp, hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity, intersect_tests::flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves, rect::tests::rectangles_are_drawn_whole, rect::tests::the_rectangle_stage_is_a_geometry_shader) and xtask's repository_passes_policy (frame_users.rs). 2208 passed, including five that fail on main (three BCPack oracle tests, the menu save race, the shader key test).Checked for overlap
None found for VICTORY_ROOT_BIND_CACHE or skipping repeated root bindings.
🤖 Generated with Claude Code
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-29 19:56 UTC · original · reviewed
🟡 Changes recommended
A critical cache invalidation bug can retain a prior thread limit and suppress lanes in subsequent group-counted dispatches, requiring a cache update or invalidation and a regression test.
1 open issue
What changed in this PR
Adds an opt-in cache to the GPU draw path that skips redundant host D3D12 root-binding calls. The optimization is disabled by default.
Changes:
crates/victory-gpu/src/draw.rsVICTORY_ROOT_BIND_CACHE, integrates cached setters, and adds focused tests.Review effort: Balanced
@ -2822,0 +2959,4 @@&mut self.root_bindings[usize::from(compute)].constants,param,values,root_bind_cache(),@Copilot on GitHub · 2026-11-29 19:56 UTC · original
With
VICTORY_ROOT_BIND_CACHE=1, this cache becomes stale after a thread-counted dispatch:dispatchdirectly overwritesUSER_DISPATCH_THREADS_XviaSetComputeRoot32BitConstant(line 4879), but the remembered slice still contains zero. A subsequent group-counted dispatch with otherwise identical arguments skips this full setter and retains the previous thread limit, suppressing lanes that should run. Update or invalidate the cached parameter after the partial write, and add a regression test for a thread-counted dispatch followed by a group-counted dispatch on the same root signature.@ -2822,0 +2990,4 @@&mut self.root_bindings[usize::from(compute)].constants,param,values,root_bind_cache(),@Adriwin06 on GitHub · 2026-11-29 20:01 UTC · original
Good catch, fixed in
58255583: the dispatch now forgets the cached constants for that parameter after its ownSetComputeRoot32BitConstant, so the next bind re-emits them (the word goes back to 0). Every other write of the list's root state outside the bind path already resetshost_roots, which clears the cache inchange_root. Regression test:draw::root_binding_tests::constants_written_behind_the_cache_are_bound_whole_again.@dyshay on GitHub · 2026-11-29 20:46 UTC · original
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.@tillo88 on GitHub · 2026-11-30 12:44 UTC · original
Measured with
VICTORY_ROOT_BIND_CACHE=1on top of v2026.11.29.05, 2 runs, against 18 runs of the release as it is.Mean +2.1% fps (30.03 vs 29.40), with the submitting thread about 0.6 ms shorter. That is at the edge of what this bench can resolve: single baseline runs range from 27.8 to 30.6 fps (sd 0.7), so read it as "no loss, maybe a small gain". No crash in the 2 measured runs (the warm-up run ended in the known #2237 crash at +2:17, which about one in three runs of the release also hit; see #2237).
Setup: Ryzen 7 9800X3D, RTX 5070 Ti 16 GB (driver 621.40), 32 GB RAM, Windows 11, release build, Series X 1440p, DLSS Quality, frame generation off, ray tracing off. Same save restored before each run (start of the game), prison cutscene, plane cutscene, first boat section, about 6 minutes; warm-up run not counted.
Measured unattended on a replay bench (same save, recorded controller input via VICTORY_INPUT_REPLAY); numbers and text prepared with Claude.
Pull request closed