GPU: refresh table CBVs on fresh_tables cache hits #2850
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2850
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2850"
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?
@fuzeofficlal on GitHub · 2026-11-25 22:17 UTC · original
fuzeofficlal:fix/gpu-fresh-table-cbv-refresh→main· +88 −1 · 1 files · 1 commits · openProblem
In
State::tables(crates/victory-gpu/src/draw.rs:1299), when a descriptor table spills past the host descriptor heap cap (index >= host.count(), e.g., on NVIDIA/WARP clamping a 1.5M view heap to 934,464) and hits the per-listself.fresh_tablescache, the refresh loop skips constant buffers:Because table CBVs are mirrored as shadow-backed raw SRVs (
descriptor/host.rs) and rely onreadable(list, u, &view, true)(just asState::table_entryand fresh-table creation already do unconditionally), skippingResourceType::Cbvon afresh_tableshit leaves the host shadow buffer out of date in two cases within a command list:fresh_tables, a copy updates the CBV backing memory (clearingdeferred.refreshed), and Draw 2 hitsfresh_tables—skippingreadableleaves stale pre-copy data in the shadow buffer.Thas a CBV at slot 0 and an SRV at slot 1. Draw A uses only slot 1 (n = 2, hashing slots0..2into the cache key without callingreadableon slot 0). Draw B uses both slot 0 and slot 1, hits the same(table, hash)entry infresh_tables, skipsResourceType::Cbv, and never refreshes slot 0's shadow buffer (reading zeros).Fix
Call
readable(list, u, &view, true)for allentrieson afresh_tablescache hit (for u in entries). Unchanged ranges remain O(1) deduplicated bydeferred.refreshed.Verification
draw::tests::fresh_table_cache_hit_refreshes_cbv_after_copy_and_partial_first_usecovering both cases (fails onf3578e3before the 1-line fix:0x1111_1111vs0x2222_2222after copy,0vs0x3333_3333after partial first use).cargo test --locked -p victory-gpu --lib draw::tests -- --test-threads=1): 21/21 passed, no debug-layer errors.VICTORY_D3D12_WARP=1, default &--features diagnostics): 21/21 passed.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default &--features diagnostics): 0 warnings.cargo xtask policy: 190 files ok.@Machad3x on GitHub · 2026-11-25 23:18 UTC · original
Hardware result at head
6ae15a75, cherry-picked onto a fork stack, RTX 3080 Ti: the library tests pass with its new test; one 7-minute run in play without device removal, window scene median 675 ms a frame (688 in an earlier run without it, one run each).Ran with AI assistance (Claude Code).
@futurepro62 on GitHub · 2026-11-26 00:00 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
6ae15a7(on its basef3578e3).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 864 passed, 0 failed, 10 ignored.fresh_table_cache_hit_refreshes_cbv_after_copy_and_partial_first_use.--skipleaves out tests that fail on main842b0cbon this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Marvisak on GitHub · 2026-11-26 03:21 UTC · original
Automated triage for the maintainers.
This is a one-line fix in
State::tables(crates/victory-gpu/src/draw.rs). On afresh_tablescache hit,mainrefreshes only non-CBV entries. When the table is made, the same function callsreadablefor every used entry, CBVs included, andreadablealready handlesView::Constantby refreshing its shadow range. Skipping CBVs on a hit therefore leaves a constant buffer stale after a copy in the same list, or never refreshed when an earlier draw used fewer slots of the same table. The PR drops the filter, anddeferred.refreshedstill avoids repeated refreshes. The new test covers both cases.Others' runs on an RTX 5070 Ti, an RTX 5090 and WARP pass. I found no other open PR doing the same.
Verdict: merge candidate (a recommendation to look, not an approval). CI: passing.
Generated by Claude Code
View 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.