perf(gpu): avoid temporary allocations in single-range descriptor copies #1616
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1616
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1616"
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?
@Damokles2 on GitHub · 2026-11-28 22:24 UTC · original
Damokles2:perf-descriptor-copy-single-range→main· +97 −14 · 1 files · 1 commits · merged 2026-11-29 08:16 UTCCloses #1572.
What it changes
CopyDescriptorsbuilds two temporary range vectors even when both sides have exactly one range. The source-first fast path keeps the existing kind and null-start checks, snapshots source metadata before destination metadata, and calls the unchangedcopy_simplewith the smaller count when it is nonzero. Null optional size arrays still mean one descriptor per range. The general multi-range loop, overlap-aware copying, and write-before-mirror ordering are preserved.How it was tested
Hosted Windows with Rust 1.98.1 on the MSVC target. The D3D12 smoke used the WARP software adapter and synthetic sampler descriptors. The test suite used no game assets.
single_range_dispatch_preserves_complete_descriptor_bytesandgeneral_path_snapshots_metadata_before_overwriting_it. They cover all four heap kinds, overlapping buffers, null optional sizes, unequal and zero counts, and metadata snapshot ordering.Synthetic performance and trade-off
Representative hosted production medians from the candidate runner:
The latest hosted production comparison also measured these general-path slowdowns. The values are paired median deltas across two passes of 41 alternating pairs.
These costs exceeded the same-runner original-versus-original noise for the corresponding controls. The earlier hosted refinement and local production measurements showed smaller overhead. The magnitude varies across builds and environments, and these measurements leave its cause unisolated. The real workload distribution and complete live heap and mirroring latency remain unknown. The evidence supports a synthetic single-range benefit and a measured general-path cost for review.
Hosted validation
d4b5d51702db615bd0aec74a35b042f60ba4cf62. Baseline workflow59dd62e7d7507457a5c0e6c89b1c2acfcc3420c6. Candidate workflowBoth workflows finished red on identical pre-existing failures in strict affected-crate and workspace Clippy, workspace formatting (4,338 hunks), and the asset-policy size limit for the unchanged
crates/victory-shader/src/emit/lower.rs. Compilation, CPU tests, focused Windows tests, WARP, differential checks, and benchmark steps succeeded individually.Checked for overlap
copy_simple. The range collection change here is independent.AI-assisted with OpenAI Codex.
@upipibi on GitHub · 2026-11-29 03:18 UTC · original
Test report for #1616 (head
59dd62e7), merged--no-ffonto main568c5e5d. This PR is based on an older main;the merge was clean. Synthetic tests only: no title run, no game files.
Setup: RTX 3070, driver 616.56, Windows 11 (10.0.26100), rustc 1.98.1. Every run logged the GPU and driver from
nvidia-smibefore it started.Both new tests pass, 3/3 runs:
descriptor::tests::single_range_dispatch_preserves_complete_descriptor_bytes;descriptor::tests::general_path_snapshots_metadata_before_overwriting_it.Both are CPU-only. They call
copyon plain arrays with a null device, so no D3D12 device is used. I also ran themthree times with
VICTORY_D3D12_WARP=1 --features diagnostics; they pass the same. The WARP sampler-heap test thedescription mentions is not in the diff, so it is not covered here.
Negative controls
copywith only the two tests added: both pass. That fits a speed-up that keeps the behaviour thesame: the tests guard what main already does.
(
leftinstead ofleft.min(room)):single_range_dispatch_preserves_complete_descriptor_bytesfails, atthe case
kind 0, source size 3, destination size null (one descriptor), destination 1. Two descriptors past thedestination's one are overwritten.
general_path_snapshots_metadata_before_overwriting_itstill passes; it usestwo ranges, so it never reaches the fast path. So the single-range test does catch a fast path that ignores the
destination's size.
cargo test -p victory-gpu --lib --locked568c5e5d--features diagnosticsThe two extra tests are the PR's own. I did not measure the timings in the description.
Not tested: the effect in a title.
Tested with the help of Claude Code (Claude Opus 5.5).