GPU: reduce snapshot pool lock contention #58
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!58
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/58/head"
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?
@efsebayern on GitHub · 2026-11-26 19:58 UTC · original
efsebayern:perf-snapshot-pool→main· +170 −59 · 1 files · 1 commits · merged 2026-11-26 20:09 UTCFollow-up to #41. The snapshot pool is shared by submission and worker threads. A checkout scanned the pool for a best fit, every return sorted the pool again, and a miss allocated a fresh buffer while holding the mutex.
Changes
Synthetic benchmark
Both Windows release builds contained the #41 locking fix. The baseline was
4ff4ea1with only the benchmark test added. Independent build directories were used. On an i7-13700K, eight threads performed 80,000 checkout/return pairs per run against a pool prefilled with 384 buffers.VICTORY_SNAPSHOT_POOL=1024, one warm-up per build, then six timed runs per build in alternating order.4ff4ea1That is about 88% less time for this workload. The benchmark measures the snapshot pool. Gameplay FPS and representative in-game contention are unmeasured.
To reproduce the baseline, add only the ignored
pool_contention_loadtest to4ff4ea1. The existingpool_memory_loadpassed on both builds. The optimized process had 25,668 KiB of additional private memory after pressure trimming and 0 KiB after the idle trim.Verification
PR head
44b3757, based on0b5b906. Windows 11 Pro build 26200, i7-13700K, RTX 4080 SUPER, pinned Rust 1.98.1 MSVC.cargo clippy --workspace --all-targets --locked -- -D warningsand the same command with--all-featuresboth passed.cargo test --locked -p victory-gpu --lib -- --test-threads=1passed with 404 passed, 0 failed, and 40 ignored.--all-featurespassed with 458 passed, 0 failed, and 40 ignored.cargo xtask policyand the staged asset check passed.Added focused coverage for best-fit reuse, capacity accounting, size and count limits, and retention of one oversized buffer. The pressure and idle tests also verify the cached capacity after a trim.
Earlier workspace runs on
a857333with the same pool patch passed both configurations withvictory-shaderexcluded andVICTORY_WARP=1. With the shader package included, WARP reported the same six shader failures on the patched and cleana857333trees. Native full-workspace runs were stopped after shader tests stalled.Six shader failures reproduced on clean main with WARP
ds_min_max_f32_order_floats_and_return_the_old_valuelegacy_multiply_adds_fuse_their_product_and_flush_their_sourcesv_permlane16_and_x16_read_the_lanes_their_selectors_pickwhole_wave_f64_sum_and_cvt_f32_f64a_lane_mask_joined_with_a_number_is_read_as_the_number_it_ispartial_dispatch_with_a_cross_half_wave_op_runs_in_32_lane_wavesAI-assisted with Codex.
@TaynanGT on GitHub · 2026-11-26 20:04 UTC · original
Thanks for splitting the contention changes out of #41, @efsebayern. On Windows at
44b3757, all six snapshot-pool unit tests passed. I also ranpool_memory_loadseparately on the 9950X3D. Private memory above baseline fell from 521,332 KiB with the full pool to 25,672 KiB after the pressure sweep and 4 KiB after idle. That independently checks the trim behavior with the cached capacity total. Your contention benchmark measures the pool itself. A gameplay run is still needed to put a number on any frame-time change.@TaynanGT on GitHub · 2026-11-26 20:10 UTC · original
Merged in
028b4b2after Windows CI passed. The review confirmed best-fit reuse, cached capacity, and the existing pressure and idle retention rules. The alternating runs give us a clear comparison for the pool workload. A matching Series S route will show how much of that change reaches frame time.