GPU: reuse retired upload buffers for oversized submissions #1390

Closed
github-bot wants to merge 1 commit from github-bot/gh-1390 into main AGit
Owner

@⁠AkshatPal2007 on GitHub · 2026-11-28 18:43 UTC · original
AkshatPal2007:codex/segmented-upload-readback → main · +251 −29 · 2 files · 1 commits · closed without merging

Addresses #1383. The segmented staging patch and the original gameplay measurements come from @⁠NotADonky43. This PR adapts the posted patch and adds the requested byte-exact GPU readback, failure recovery coverage, and a reproducible device-local memory measurement.

Uploads now request their exact size when rounding up would exceed the pool retention limit. With VICTORY_STAGE_SEGMENTS=1, oversized submissions reuse retired buffers for complete destination groups and allocate only the remainder. All source buffers stay alive until the submission retires. Segmented reuse is opt-in pending longer gameplay testing.

Device-local memory measurement

RTX 4070 Laptop GPU, Windows, VICTORY_SEND_BAR=1. Each run started with 26 MiB and 38 MiB retired buffers and requested the same four destination groups totaling 105 MiB. DXGI local usage was sampled before creating the retired buffers and again with the submission buffers alive.

Measurement Single buffer Segmented
New upload allocation 105 MiB 41 MiB
Increase in process-local VRAM, first pair 169 MiB 105 MiB
Increase in process-local VRAM, reverse-order pair 169 MiB 105 MiB

The default upload path uses host memory. The table specifically measures device-local upload heaps. Gameplay FPS and long-session behavior remain unmeasured here.

Verification

Four destinations received distinct bulk copies and scatter writes. The readback checked every byte, including untouched sentinel regions, as the scatter source switched between retired blocks and the new remainder. Tests also cover rollback after a failed allocation and size rounding at the retention limit. All four focused checks passed. The default host-memory path passed its three applicable checks separately.

To reproduce on a GPU supporting device-local upload heaps, run in PowerShell:

$env:VICTORY_SEND_BAR = '1'
cargo test --locked -p victory-gpu --lib host::send::tests -- --include-ignored --test-threads=1 --nocapture

Strict Clippy reports a pre-existing manual_is_multiple_of lint in shadow.rs at line 1708 on the base revision.

**@⁠AkshatPal2007** on GitHub · 2026-11-28 18:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1390) `AkshatPal2007:codex/segmented-upload-readback` → `main` · +251 −29 · 2 files · 1 commits · closed without merging Addresses #1383. The segmented staging patch and the original gameplay measurements come from @⁠NotADonky43. This PR adapts the [posted patch](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/1383) and adds the requested byte-exact GPU readback, failure recovery coverage, and a reproducible device-local memory measurement. Uploads now request their exact size when rounding up would exceed the pool retention limit. With `VICTORY_STAGE_SEGMENTS=1`, oversized submissions reuse retired buffers for complete destination groups and allocate only the remainder. All source buffers stay alive until the submission retires. Segmented reuse is opt-in pending longer gameplay testing. ### Device-local memory measurement RTX 4070 Laptop GPU, Windows, `VICTORY_SEND_BAR=1`. Each run started with 26 MiB and 38 MiB retired buffers and requested the same four destination groups totaling 105 MiB. DXGI local usage was sampled before creating the retired buffers and again with the submission buffers alive. | Measurement | Single buffer | Segmented | | --- | ---: | ---: | | New upload allocation | 105 MiB | 41 MiB | | Increase in process-local VRAM, first pair | 169 MiB | 105 MiB | | Increase in process-local VRAM, reverse-order pair | 169 MiB | 105 MiB | The default upload path uses host memory. The table specifically measures device-local upload heaps. Gameplay FPS and long-session behavior remain unmeasured here. ### Verification Four destinations received distinct bulk copies and scatter writes. The readback checked every byte, including untouched sentinel regions, as the scatter source switched between retired blocks and the new remainder. Tests also cover rollback after a failed allocation and size rounding at the retention limit. All four focused checks passed. The default host-memory path passed its three applicable checks separately. To reproduce on a GPU supporting device-local upload heaps, run in PowerShell: ```powershell $env:VICTORY_SEND_BAR = '1' cargo test --locked -p victory-gpu --lib host::send::tests -- --include-ignored --test-threads=1 --nocapture ``` Strict Clippy reports a pre-existing `manual_is_multiple_of` lint in `shadow.rs` at line 1708 on the base revision.
Adapt the segmented staging patch from issue #1383, keep the segmented path opt-in, and verify mixed bulk and scatter updates with D3D12 readback.

Co-authored-by: NotADonky43 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 18:45:36 +00:00
github-bot closed this pull request 2026-11-29 20:07:21 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1390
No description provided.