Avoid temporary range allocations in single-range descriptor copies #1572
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Damokles2 on 2026-11-28T21:51:58Z.
The descriptor
copyimplementation currently constructs two temporary range vectors even when exactly one source range and one destination range are supplied.A narrow single-range fast path can snapshot the existing range metadata into local values and reuse
copy_simple, avoiding both temporary allocations while preserving the general multi-range path.An experimental implementation has been evaluated using synthetic CPU workloads, focused Windows descriptor-copy tests, and an asset-independent D3D12 WARP smoke test.
Results:
Representative synthetic full-copy timings:
A subsequent same-runner guard comparison did not reproduce the earlier 1×4 range slowdown. The largest source-first full-copy control slowdown was 0.702 ns. The both-zero-range control showed a repeatable 0.616 ns overhead.
The measurements concern synthetic CPU copies, not complete live heap and mirroring performance or gameplay FPS.
Hosted experimental validation:
I intend to prepare a narrow production implementation using the source-first guard, following the current contribution and claim procedure.
AI-assisted with OpenAI Codex.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-11-28T21:52:07Z.
Please attach both logs from the run that went wrong. Without them we can only guess. Paste
%LOCALAPPDATA%into the address bar of File Explorer to get there.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Damokles2 on 2026-11-28T21:54:45Z.
/claim
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kalberts0089-hash on 2026-11-29T08:00:52Z.
The two temporary
Vecs are still built on current main, including in the single-range case. On my machine #1616 saves about 44-54 ns per single-range call. On the multi-range path the change was within noise.Code at
e1f2eb6: therangesclosure atcrates/victory-gpu/src/descriptor.rs:2084-2096collects each side into aVec<(u64, u32)>. Lines 2100-2101 build both vectors on every call, including whensrc_ranges == dst_ranges == 1.Merge/tests: #1616 (head
59dd62e) merges cleanly--no-ffontoe1f2eb6.cargo test --locked -p victory-gpu --libgives 591 passed, 0 failed, 44 ignored, the same as the report on #1616. The only change on main since the568c5e5used there is a README edit.Local timing. Setup: i7-13700KF, Windows 11, rustc 1.98.1,
--release, default features (so the system allocator, not the diagnostics counting allocator). I wrote a throwaway#[ignore]test that puts main'scopy(copied verbatim) and the PR'scopyin the same binary. It does 21 alternating passes of 200k calls and reports the median ns per call. It is synthetic: no shader heaps are registered, somirror/mirror_rangefind nothing and return. Each cell shows three separate runs, kind 0 (32-byte descriptors).Allocating and freeing two one-element
Vec<(u64, u32)>alone measured 43.6 and 44.0 ns. That roughly matches the single-range saving.On the multi-range cases the PR was 3-5 ns slower in the second run, which is similar to the +2 to +4.5 ns in the PR's hosted numbers. In the other two runs it was 0.5-1.7 ns faster, except +0.6 ns on 1->4 in the third. Other builds were sharing the CPU, so I can't separate the overhead from noise here. I discarded one earlier run that was heavily contended (~1.1 us/call on both sides).
I haven't tested the effect in a title (no game files).