GPU: reuse retired staging buffers for oversized uploads #1391
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!1391
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1391"
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?
@NotADonky43 on GitHub · 2026-11-28 18:44 UTC · original
NotADonky43:perf/segmented-upload-staging→main· +174 −21 · 3 files · 4 commits · openSupersedes #1383. Oversized uploads currently require one contiguous buffer, even when retired upload buffers are available. Right-size allocations larger than the retention budget. With
VICTORY_STAGE_SEGMENTS=1, keep each destination's bulk copies and scatter pairs together, reuse fenced spare blocks first, and allocate only the remainder. All source blocks remain owned until the original submission retires.On an RTX 5070 Ti, the instrumented same-executable opening A/B reused 264 MiB twice. Repeat live staging capacity at fill: 1.54 GB single-buffer vs 1.32 GB segmented, despite staging more bytes. This is upload memory at one point, not whole-process savings or a sustained FPS claim. Both sides used identical precompiled shader and pipeline seeds. Visual comparison: no observed rendering difference and less perceived hitching.
The source-only extraction builds in release and passes the included offset regression. Mixed bulk/scatter byte-exact readback passed in an isolated RTX 5070 Ti test with D3D12 diagnostics: 4 independent destinations per run, both empty pool and retired + fresh blocks, including unchanged sentinel bytes. The native 513 MiB retention/reuse test also passed. Longer-session validation remains outstanding; segmentation is opt-in. No game data or caches included.
@ANDREANIADS on GitHub · 2026-11-28 18:49 UTC · original
CPU-only byte check at
b1f44ad: I exercisedtakeandOwn::recordwith a CPU stand-in for the command list. Three 128-byte destinations used distinct source patterns, each with both a bulk copy and a scatter update. With a 64-byte test retention limit and one retired 64-byte block, destination ranges[1,4), [16,20)/[3,52), [64,72)/[8,16), [25,30)produced block IDs1 → 0 → 1and three scatter source bindings. The single-buffer control used0 → 0 → 0and one binding. All 384 destination bytes matched the independently expected bytes in each run, including untouched bytes initialized to0xcd. This covers switching back to a previously used block. D3D12 execution, barriers, fence lifetime and GPU readback remain untested here.@Lancito01 on GitHub · 2026-11-28 19:44 UTC · original
Data point, RTX 3080 10 GB / 32 GB RAM, Series S mode, main
9ce3cf9e+ #938 face fix, prison prologue scenes (~4.1k draws/frame):VICTORY_STAGE_SEGMENTS=1: median 64.7 ms/frame (60-77), peak working set 18.1 GBNo regressions or visual issues seen in ~10 min, but also no measurable RAM or frame-time change on this setup; the staging buffer doesn't seem to be where memory goes here. One run each, so treat as a rough sample.
AI-assisted (Claude).
@NotADonky43 on GitHub · 2026-11-28 22:59 UTC · original
Integration note for NVIDIA main
d4b5d517: insend::takeretain bothtotal_pair_words += words as u64andblock: 0; inOwn::recordrebind the source SRV on block change and retain main’sshadow.buffer_gpu()destination. Keep both thepack_copy_taskstest and the PR’s native tests. Inupload_test_target, cacheunsafe { buffer.GetGPUVirtualAddress() }inShadow::newinstead of passing zero: the stock fixture otherwise binds a null root UAV on the new code. This is a test fixture change, not a game fault. Combined on RTX 5070 Ti with the copy-queue sizing and pressure-drain changes: mixed bulk/scatter byte-exact GPU test passed with debug layer and GBV; the 513 MiB retention/reuse test passed. No new FPS claim. I have the conflict resolution locally; the fork branch push was rejected because syncing main also imports workflow files outside the account token’s scope. No CI/workflow edits requested.@pickles976 on GitHub · 2026-11-29 08:06 UTC · original · edited 2026-11-29 11:05 UTC
Verified the segmented submission-upload mechanism in a disclosed adaptation onto our older synchronous send path (local commit6463c32537872478d2c4bbd651236383f05b2f5a overfb92449bd3), not an exact-head/full-PR certification. Physical RTX4060 Laptop8GiB, Wine11/NVIDIA590.48.1, stock assertion-enabled app-local vkd3d2576c0b4adfae4a; loader paths/hashes verified, vendor0x10de/softwareflags0 required, raw-access chains disabled.
Fresh17.91s intended-tree build; three focused checks pass3/3,0ignored,1.01s. The actual GPU fixture runs two legs with STAGE_SEGMENTS=1/SEND_SPARE_MB=1: empty pool gives one exact allocation; a retired512KiB block then gives mixed source sequence[1,0,1,0]. Every CPU source is mutated after packing and before recording. All5242880 destination bytes match original bulk/scatter snapshots or untouched sentinels. The retired block identity is reused, no upload returns to the spare pool before explicit retirement after native completion, and idle capacity stays<=1MiB. Two pure rebasing/rounding checks pass too. Native buffer fixture stays below8MiB; peakGPU361MiB/minavailableRAM11781MiB.
This does not exercise forced allocation failure, an artificially pending queue, original title shaders, or establish a frame-time/telemetry fix. Complete destination groups and the fresh remainder can still be large; with no retired blocks the full request remains necessary. Our prior loading run stalled a native telemetry query while a379362704-byte upload allocation was outstanding, with submit-thread allocation/I/O waits sampled; correlation, not proven driver-lock causality. Changed title observations are recorded below. External2s telemetry/9GiB+512MiB scope/6000MiB GPU/2048MiB availableRAM/10GiB disk guards remain unchanged.
Evidence: verify-nvidia-segmented-upload-build-fixed-20261129T080229Z/ and verify-nvidia-segmented-upload-stock-20261129T080247Z/. Adaptation retains the original CardPlan completion point and has no copy-queue port.
Guarded title follow-through, 29 Nov
Same committed adaptation6463c325, fresh86s release SHA2564e5ca0dc4a7ff6565b71650a401f5137df9141b7f57cc621e15808bac7650bbd. Four streaming workers,512ahead buffers,128MiB completed-send cap, private CPU mirrors,80% texture line,64MiB separate small/ordinary texture pools, scoped file-backed XMem with native imports disabled. Existing fork rendering defaults/omitted programs retained; no added shader skips.
Run081925 reached actual rendered cutscenes (characters/city at180s, car interior240s), not demonstrated controllable gameplay. A543939088-byte send used50331648 retired bytes and493607440 fresh bytes; the fresh native allocation returned in747.9309ms. The cold164168032-byte one-group send still required one full fresh block (31.1504ms). Thus reuse really executes, but the remainder is not a small-allocation cap and this is not a matched performance comparison.
The unchanged6000MiB global-GPU guard stopped at276.08s/6061MiB, exit137. RAM minimum3184.8MiB, scope peak9GiB/max1155/oom0, disk minimum12.206GiB. All274 native guard queries completed (max582.65ms); independent observer max244.51ms. No kernel entries or observed title exception. The supervisor now uses a pre-launch journal cursor;256 kernel queries completed, max0.863s, with its original3s deadline. The preceding080855 observation stopped on that journal monitor deadline, not a GPU query failure; it is not counted as a full run.
Performance remains far below target:69 disjoint late host-present-attempt windows/302 intervals,298over50ms,250over100ms, max3200.8ms. These are not scanout or global percentile/FPS measurements. Final pool census28×64MiB blocks,1463MiB held,322MiB free,6MiB resting,0empty; other GPU owners remain. No sustained safety, frame-time gain or15-minute gameplay claim. All stopped backing files were removed only after exact inode/scope/no-holder checks.
Evidence: nvidia-fork-trial-20261129T081925Z/{verified-summary,late-present-attempts,vram-admission-evidence,backing-cleanup}.json. Captures remain local/unpublished. The next action is offscreen small-card address-arena/shared-memory coherence verification, not a higher guard or an eight-worker run.
Later hardware safety hold: a subsequent changed registered-copy-budget experiment hit an Intel i915/Xwayland GPU hang/reset. All GPU/title work is parked; no attribution to segmented uploads or that quota is established. Details: #1226 . Earlier offscreen and scoped observations above remain their exact, limited results.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.