perf: reduce native CPU and memory overhead #4082
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!4082
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4082"
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?
@igorevv on GitHub · 2026-11-30 15:42 UTC · original
igorevv:perf/native-optimizations→main· +130 −82 · 6 files · 1 commits · closed without mergingperf: reduce native CPU and memory overhead
Summary
This PR implements six native optimizations across texture queues, shared-zero buffers, held submissions, pipeline naming, pooled allocation, and XMA decoding.
Changes are intended to reduce recording/submission CPU work, allocator pressure, startup overhead, and retained VRAM without changing rendered output.
Changes
1. Enable due-frame indexing by default
VICTORY_DUE_INDEXnow defaults to enabled, withVICTORY_DUE_INDEX=0preserving the previous flat-scan behavior.The indexed collector was kept at parity with the flat queue:
FLAG_SOONis set through the storage-independent update path;The streamed-out regression test now runs against both flat and indexed queues.
2. Retire outgrown shared-zero buffers
Outgrown shared-zero buffers are passed to
retire_resourceinstead of being retained permanently.Both shared-zero copy paths also call
list.keep(&buffer), ensuring recorded but not-yet-submitted lists retain their source resource. This prevents use-after-free when a larger shared buffer replaces an older one.Once the shared buffer reaches 256 MiB, the obsolete 4+8+16+32+64+128 MiB buffers no longer remain permanently owned: 252 MiB of historical allocations become eligible for retirement after their users finish.
3. Remove quadratic held-queue draining
QueueLine.commandsnow usesVecDeque<Held>andpop_front()instead ofVec<Held>andremove(0).Submission, wait, signal, retirement, and test ordering are unchanged. Draining no longer shifts every remaining entry for each released command.
4. Borrow DXIL for pipeline-library names
pipeline::host::code_bytesnow returns&[u8]rather thanVec<u8>.This removes one allocation and a complete DXIL memcpy per shader stage when computing pipeline-library names. Hash inputs and resulting names remain byte-identical.
5. Remove temporary vectors and sorting from pool placement
Added a read-only
Ranges::fitscheck using the same arithmetic asRanges::take.Pool placement now selects the fitting block in one scan:
takeis called only for the selected block. Temporary index vectors andO(blocks log blocks)sorting are no longer needed for each allocation.6. Reuse XMA decode scratch
Each
Voicenow owns a reusable PCM scratch vector. Decode clears and reuses its capacity instead of allocating a new vector for every frame.At 48 kHz with 512-sample frames, this targets approximately 93.75 allocation/free pairs per second per active voice. Only 1–2 KiB of scratch is retained per active voice, and decoded PCM behavior is unchanged.
Changed files
crates/victory-gpu/src/descriptor/host.rscrates/victory-gpu/src/pipeline/host.rscrates/victory-gpu/src/pool.rscrates/victory-gpu/src/queue.rscrates/victory-gpu/src/texture.rscrates/victory-hle/src/modules/audio.rsValidation
Targeted tests passed:
Additional checks:
git diff --check: passed;cargo xtask policy --staged: passed for all six files.The complete 982-test GPU run aborts with exit code 3 in device-dependent tests in this environment. Targeted tests covering the modified areas passed. No game run or real-GPU performance comparison was performed, so FPS and memory improvements still need before/after measurement on a real title workload.
Suggested runtime measurements
VICTORY_DUE_INDEX=0against the new default usingVICTORY_AB.@shurhundo on GitHub · 2026-11-30 15:58 UTC · original
nit:
queue.rs,a_line_in_hand_outlives_its_queue_and_is_retired: the assertion went from checking the whole deque is exactly oneHeld::Run(matches!(&lock(&worker.commands)[..], [Held::Run(..)])) to only checking the front element (matches!(lock(&worker.commands).front(), Some(Held::Run(..)))). Harmless today, since nothing else pushes tocommandsin this test, but it no longer catches a future regression that leaves a second entry behind. SinceHeldhas noPartialEq, anassert_eq!(lock(&worker.commands).len(), 1)next to the existing check would restore that without needing one.github-bot referenced this pull request2026-12-01 04:30:16 +00:00
@trustno1-coder on GitHub · 2026-12-01 18:46 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed