GPU: back indirect arguments in VRAM, use RwLock for SHADER_HEAPS, and batch copy_back_marks #3320
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!3320
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3320"
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?
@danielibabet on GitHub · 2026-11-26 17:42 UTC · original
danielibabet:pr/perf-copyback-heaps-indirect→main· +99 −32 · 4 files · 1 commits · openSummary
Three independent CPU/GPU contention and barrier fixes on top of
main:indirect.rs,host.rs)Host::uav_buffer(D3D12_HEAP_TYPE_DEFAULT,ALLOW_UNORDERED_ACCESS,COMMON) and backHostList::argumentsin VRAM instead ofL0system memory (shared_buffer), avoiding PCIe round-trips for bothclampUAV stores andExecuteIndirectreads.uav_barrier()(pResource = None) right before transitioningoutfromUNORDERED_ACCESStoINDIRECT_ARGUMENTinindirect::bound(the resource transition already synchronizesout, and the nextboundcall issues the pre-dispatchuav_barrier()forbudget).indirect::tests::clampedandargument_buffers_move_from_their_current_statesto read backoutviareadback.SHADER_HEAPSmutex contention during descriptor mirroring (descriptor.rs)SHADER_HEAPSfromMutextoRwLock:mirror(title threads),sync_heaps(submission thread), and all read-only queries take.read(), whileDropandcreatetake.write(), sosync_heapsno longer stalls title threads writing descriptors (MirrorWaitUs).Tracked::takenincopy_back_marks(shadow.rs)pooled(PAGE)scratch buffer across all marked pages incopy_back_marksinstead of heap-allocating and zeroingvec![0u8; n]per 64 KiB page.t.taken(&list)once perShadowinstead of callingVirtualProtect/ taking theGUARDSlock page by page.Verification
cargo test -p victory-gpu --locked -- --test-threads=1 --skip dynamic_slots_are_held_until_released --skip lists_share_a_table_and_copies_keep_their_views:229 passed; 0 failed; 1 ignored; 2 filtered outcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: 0 warningscargo run -p xtask --locked -- policy:asset policy: 191 files ok@Dukestar69 on GitHub · 2026-11-26 17:48 UTC · original · approved these changes
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):
CopyBufferRegionreadback in tests), switchingSHADER_HEAPStoRwLock, and reusingtitle_buf+ batchingt.taken(&synced)incopy_back_marksare clean and sound.cargo test -p victory-gpu --lib indirect:: -- --test-threads=1(RTX 5090): 6 passed, 0 failed.cargo test -p victory-gpu --lib descriptor:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released(RTX 5090): 21 passed, 0 failed.cargo test -p victory-gpu --lib shadow:: -- --test-threads=1(RTX 5090): 10 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:54 UTC · original
I checked the DEFAULT-heap argument buffers with the #3307 + #3197 + #2996 composition. They conflict in allocation and in tests that directly mapped the argument buffer. Exact integration
6be1c86keeps the DEFAULT heap, cached width and shared argument state, and uses a real readback copy for those tests.Verified app-local Agility 1.620.2/WARP 1.0.22 passed all 15 indirect tests. The mixed test alternates window and single clamps in one list, grows the buffer with 6,000 records, checks the output, and replays transitions back to COMMON. The translated 24-group mesh test and full GPU diagnostics (259 passed, 0 failed, 1 ignored) passed with
VICTORY_CLAMP_WINDOW=0and1. Strict GPU Clippy passed with default and all features. Asset policy passed. This verifies DEFAULT-heap behavior on WARP. Discrete-GPU placement and PCIe timing still need a hardware run.@danielibabet the integration is available if #3307 lands first. Please retain its Git author if using the resolution, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit. AI-assisted with Codex.@danielibabet on GitHub · 2026-11-26 18:20 UTC · original
Thanks @andrewpozdnakov7-jpg for verifying against #3307 + #3197 + #2996 and preparing the integration (\6be1c86)! If #3307 lands before #3320, we'll rebase #3320 onto it and make sure to preserve your Git authorship / \Co-authored-by.
@borosf on GitHub · 2026-11-26 19:03 UTC · original
Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head
332461e:Result: victory-gpu lib: 2 known baseline failures; the waits_end_on_ticks timing test is flaky under load (this PR does not touch frame.rs).
Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions.
Synthetic tests only; no game data used. Full log kept locally. — borosf
@Machad3x on GitHub · 2026-11-26 20:44 UTC · original
A data point on the
SHADER_HEAPSRwLockchange, measured on one Windows machine (RTX 3080 Ti, Ryzen 7 5700X) running a commercial title:We tried the same idea on our branch:
SHADER_HEAPSas anRwLock, with readers taking a shared lock.So we dropped it. Our reading: the contention moved into the per-heap sync instead of disappearing, and frame time got worse overall.
We are now testing per-slot locks (64 striped locks, atomic "made" keys with a busy sentinel) together with the
RwLock, and will report numbers.This work was done with AI assistance (Claude).
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.