gpu: offload 1Hz sweep drops and eliminate eviction lock stalls #4947
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4947"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by topangag on 2026-12-01T15:06:21Z.
What it changes
Substantially reduces CPU waiting and periodic frame-time stutters on the submitting thread during 1 Hz memory sweeps, background slot eviction, and asynchronous residency settles:
How it was tested
6318c011: targeted victory-gpu unit tests (32 passed, 0 failed) and both default and --all-features Clippy reported 0 warnings/errors in the 4 touched files.Checked for overlap
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Aniseto on 2026-12-01T15:16:02Z.
Ran the
host::/list::tests/pool::/resource::group selection at6318c011on an NVIDIA Blackwell desktop part with 16 GB of VRAM, with a control onmain5fabb46ein a separate target directory. No title was run.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches.The single failure is
host::packed_present_tests::packed_float_single_planes_are_presented, athost.rs:17756on the PR head andhost.rs:17713onmain: it fails on this host with and without the PR, so it is not introduced here. The PR head has one more passing test thanmainin this selection. The description's 32-test targeted run and its ~90% CPU-waiting reduction were not reproduced: no retail title was run.Not tested: the full workspace suite, a retail title, 1 Hz sweep CPU-wait measurements, Wine, AMD adapters, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out both commits in detached worktrees, built them, ran the tests, wrote this report; neither worktree was modified; no game data was used.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-12-01T15:21:45Z.
On
6318c011,trim_spare_chunks()can return a positive byte count while its chunks are still queued for destruction. The commit-pressure path uses that return value to decide whether to retry the allocation immediately, so the retry can run before the driver releases the buffers.e41f18ea keeps the direct trim synchronous and keeps the periodic sweep on the existing background queue. It uses the trim callback split from Colej1921’s #3951.
A focused Windows fixture ran the exact trim and its sweep call with synthetic chunks and a paused drop queue. The author head returned the byte count with 0 of 2 chunks released. With this change both chunks were released before the direct call returned. The periodic call still queued both for release, and both paths released outside the pool locks. The staged asset policy passed.
Please keep the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change in.AI-assisted with OpenAI Codex.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-12-01T15:24:09Z.
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree, per-worktree CARGO_TARGET_DIR.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b, head6318c01127ea9b70d3b34be1159522be5b8896c7.git diff --numstat→ host.rs 78/27, list.rs 5/2, pool.rs 22/7, resource.rs 185/50.One test is added and its name is new on the base —
git grep -F resident_settled_cover_coalesces_completed_enqueues_and_guards_device_removal 5fabb46e -- .returns no match:host::batch::resident_settled_cover_coalesces_completed_enqueues_and_guards_device_removal, at host.rs:20686.What it covers, in full: four literal calls to the free function
resident_settled_cover(settled, enqueued, completed)—(10,14,13) → 13coalescing a completed enqueue,(10,14,20) → 14clamping a completion past the enqueued mark,(10,10,10) → 10, and(10,14,u64::MAX) → 10for the wild-value guard. It is a pure-function test; it does not exercise the batch book or a device-removal path.git diff --check "5fabb46e..6318c011"→ no output, exit 0.Result:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out; finished in 0.00s.No device opened, GPU/driver N/A. No game data.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gut0to on 2026-12-01T15:30:36Z.
Review: COMMENTED
AI-assisted review: I checked the bounded eviction continuation and its existing tests. I used AI assistance and verified that the new queue-retry behavior has no focused regression test.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by gut0to on 2026-12-01T15:30:36Z.
Code review location:
crates/victory-gpu/src/resource.rs; line 4556Could the new time-sliced slot-eviction queue get a focused regression test? slot_evict_ready carries the remaining VecDeque into the next submission after either the time budget expires or TEXTURES/made is busy. A test that forces a budget stop and a Busy result, then drains the next slice, would verify those victims are retained exactly once while stale victims are still dropped; the added test covers resident_settled_cover only, so this continuation behavior has no direct regression coverage.
Pull request closed