fix(victory-gpu): scope table caches to their heap and binding group #288
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!288
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-288"
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?
@mauroalvare on GitHub · 2026-11-26 01:16 UTC · original
mauroalvare:fix/victory-ready-tables-cache→main· +50 −7 · 1 files · 3 commits · openVice-Tay
Vice-Tay keeps readiness on each table snapshot. Include the host heap ID in the snapshot key and give each compiled binding group a stable identity so a reused plan address cannot inherit a different group's readiness.
Two focused tests cover matching table addresses and contents across different heaps and the identities assigned to successive binding groups.
Earlier Neptune description
Summary
Fixes two descriptor-table caching bugs in
third_party/victory/crates/victory-gpu/src/draw.rs(State::tables) that are active under the default Neptune settings (VICTORY_READY_TABLES=1,VICTORY_TABLES_BY_CONTENT=1):ready_tablesignores which table entries and access kinds a draw actually uses.ready_tableswas keyed only on(table_or_0, n, descriptor_content_hash). When one pipeline (or oneRootIndexedViewroot-constant value) populatesready_tablesfor a table of lengthnwhile accessing only a subset of its slots, a subsequent draw in the same command list using the same table contents with a different pipeline or root-constant index hitsready_tablesand skipsreadable()for every newly accessed entry:RENDER_TARGET(or another write state) is never transitioned toSHADER_RESOURCE(D3D12state violation / stale sampling).shadow.refresh(), so the GPU reads stale/zero bytes.shadow.gpu_writes(), so GPU writes are silently lost instead of copied back to title memory (and UAV textures are never transitioned toUNORDERED_ACCESS).fresh_tables(andseen_tables) omit the bound view heap from their key.Unlike
root_srv_slotsandroot_uav_slots,fresh_tablesdid not include the bound descriptor heap pointer in its key. Switching view heaps (SetDescriptorHeaps) within a command list and binding a table with matching(n, content_hash)returned dynamic slot offsets allocated in the previous heap while the new heap's corresponding slots remained unpopulated/null.What changed
heap_id = std::ptr::from_ref(heap) as usizeinfresh_tables,seen_tables, andready_tableskeys.ready_tableson(table_key, usage_hash), whereusage_hashhashes the non-CBV(table_offset_dwords, kind)entries fromusedand the deduplicatedselectedindices fromRootIndexedViewthat this draw passes toreadable(). Repeated draws with the same heap, table contents, and accessed entries keep hittingready_tableswithout regression.draw::testscovering texture state transition, UAV write-back,RootIndexedViewbuffer refresh, cross-heap table isolation, andready_tablescache reuse.Reproduction and test results
Base commit:
c4c93bdc413191a9dc909998d2d53080a3f0c880(LooperSalty/AnyXboxX:main).Hardware: Windows x64, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver
32.0.16.2140), Rust1.98.1.All tests are 100% synthetic (no game files). Note: Windows Graphics Tools (
d3d12SDKLayers.dll) is not installed on this machine, soVICTORY_D3D12_DEBUG=1runs withoutID3D12InfoQueuevalidation; all assertions verify real GPU readbacks andHostListresource-state tracking on both RTX 5070 Ti and WARP.Before fix (base
c4c93bdc+ the 5 tests, RTX 5070 Ti)Result: 1 passed; 4 failed:
fresh_tables_do_not_collide_across_descriptor_heaps: GPU read0instead of0xCAFE_BABE(unpopulated slot in second heap).ready_tables_refreshes_buffer_when_root_indexed_selection_changes: GPU read0instead of0xDEAD_BEEF(shadow.refresh()skipped).ready_tables_tracks_uav_writes_for_newly_used_slot: title memory remained0instead of0x4477_6611(shadow.gpu_writes()skipped).ready_tables_transitions_texture_newly_read_from_cached_table:tex_astayed in0x4(RENDER_TARGET) instead of0xc0(SHADER_RESOURCE).ready_tables_reuses_entry_when_heap_and_usage_match: passed.After fix
cargo test --locked -p victory-gpu draw::tests -- --test-threads=1VICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --features diagnostics draw::tests -- --test-threads=1diagnostics)VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --features diagnostics draw::tests -- --test-threads=1diagnostics)cargo test --locked -p victory-loader --test load_probehle-probe)cargo xtask policy(inthird_party/victory)cargo clippy --locked -p victory-gpu --testsdraw.rsNote: running the full
cargo test --locked -p victory-gpu -- --test-threads=1suite passed 188/191 non-ignored tests (including all 5 newdraw::tests); 3 pre-existing unrelated tests failed (descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others).AI assistance
Developed and verified with AI assistance (Antigravity / Gemini 4 Neon). All code, synthetic tests, and local GPU/WARP runs were inspected and verified on this machine.
Rebase verification
Rebased on
c41c224and kept the indirect routing tests from main. All five descriptor-cache regressions passed.cargo test --locked --offline -j 5 -p victory-gpu -- --test-threads=1reported 257 passed, 3 failed, and 4 ignored. Running the same suite on the base reported 252 passed, 3 failed, and 4 ignored. Both runs failed the same assertions inspans_say_the_next_start_and_the_lowest_level_viewed(expectedSome(1), gotNone),warp_card_fetch_copies_flagged_pieces_to_their_slots, andwarp_card_patch_writes_the_masked_bytes_and_no_others.All five descriptor-cache tests also passed with the PR merged into
8e32daalocally, including the off-thread texture preparation from #395.@LooperSalty on GitHub · 2026-11-26 14:01 UTC · original
This PR now conflicts with main in
third_party/victory/crates/victory-gpu/src/draw.rs. Please rebase on main, re-check the change against the current code there, runcargo testfor the crate and force-push your branch.🤖 Generated with Claude Code
5a28a7516ato822b369236@mauroalvare on GitHub · 2026-11-26 18:25 UTC · original
I rebased and pushed the descriptor-cache fix, keeping the indirect-routing tests from main. All five cache regressions also passed with the branch merged locally into
8e32daa, including #395's off-thread texture preparation.The full local
victory-gpurun reported 257 passed and three failures. Those same three failures reproduced on the base: one descriptor-span test and two WARP indirect-copy tests.The latest CI run passed.
822b369236tob806f3ebbffix(victory-gpu): key fresh_tables by view heap and ready_tables by accessed entriesto fix(victory-gpu): scope table caches to their heap and binding groupb806f3ebbftocd720c92b6View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.