Repository navigation
GPU: back indirect arguments in VRAM, use RwLock for SHADER_HEAPS, and batch copy_back_marks - #3320
danielibabet wants to merge 2 commits into
Conversation
…d batch copy_back_marks
Dukestar69
left a comment
There was a problem hiding this comment.
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):
- Backing indirect argument buffers in VRAM (with
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).
|
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 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 @danielibabet the integration is available if #3307 lands first. Please retain its Git author if using the resolution, or add |
|
Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head 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 |
|
A data point on the We tried the same idea on our branch:
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 This work was done with AI assistance (Claude). |
|
Thanks for sharing those real-title numbers @Machad3x! Moving contention into per-heap sync and regressing frame time (309-321 ms -> 408-445 ms) is definitely not worth keeping. I've reverted the |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Clean, focused change now that the SHADER_HEAPS RwLock edit has been reverted in 3afe123b.
Checked both remaining parts:
- Backing
HostList::argumentswith aDEFAULT-heap UAV buffer (crates/victory-gpu/src/host.rs:2252, 2715) and dropping the redundant post-clampuav_barrier()before theUNORDERED_ACCESS -> INDIRECT_ARGUMENTtransition (crates/victory-gpu/src/indirect.rs:232-236):boundstill opens with[uav_barrier(), COMMON -> UNORDERED_ACCESS](ordering both earlier title UAV writes and previousbudgetwrites), the explicit transition synchronizesoutforExecuteIndirectandcapture::read_indirect, anddone()transitionsoutback toCOMMON. - Reusing a single
pooled(PAGE)scratch buffer and batchingt.taken(&list)perShadowincopy_back_marks(crates/victory-gpu/src/shadow.rs:491, 949-986) matchescopy_back_or_not's batching model and keepstitle_buf[..n]withinPAGE.
Verification on origin/main (63bcca43):
cargo xtask policy: ok (191 files ok)cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): cleancargo test --locked -p victory-gpu --features diagnostics -- indirect:: shadow:: capture:: --test-threads=1withVICTORY_D3D12_DEBUG=1: 27/27 passed on RTX 5090 and 27/27 passed on WARP- Additional live probe running two back-to-back
indirect::bound->capture::read_indirect->indirect::donecycles on the sameDEFAULT-heap arguments buffer underVICTORY_D3D12_DEBUG=1: zero debug layer errors on both RTX 5090 and WARP.
|
I retested the integration with your On app-local WARP, all 15 indirect tests and the 24-group mesh readback passed with @danielibabet, this updates the previous combined branch if #3307 lands first. Please keep the Git author or use |
|
Measured in game on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with its vkd3d-proton, GTA VI's opening prison yard, warm cache; base is Merged here as its current head
No gain here. Two test regressions on the GPU (vkd3d-proton, RTX 5090), both passing on the base: AI-assisted (Claude); measured on my machine, no game data shared. |
|
Thanks @neonbyte1. I checked the named tests against upstream Could you link the commit or branch that adds AI-assisted with Codex. |
|
One concern with the A title write can be lost between a page's copy-back and its batched
Scenario: P is copied back and left open. The loop goes on to P+1 … P+k of the same
Possible fixes, keeping most of the gain:
AI use: Claude Code (Claude Opus 5.5). |
Summary
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