perf(victory-gpu): virtualize card staging mirror and release texture CPU staging post-upload #392
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!392
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-392"
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?
@Androtim on GitHub · 2026-12-03 13:07 UTC · original
Androtim:perf/ram-staging-commit-reduction→main· +1628 −334 · 9 files · 4 commits · merged 2026-12-03 15:15 UTCRefs: #276
Summary
Reduces host RAM and Windows virtual commit footprint on 16 GB–32 GB systems without relaxing GPU fence lifetime or readback correctness:
Lazy / virtualized
Card::stagingCPU mirror (shadow.rs,host/send.rs,host.rs,host/upcheck.rs):send::own()(VICTORY_SEND_OWN != 0) and withoutVICTORY_UPCOPY_CHECK=1, replaces eager permanentID3D12Resourceupload mirrors (host.shared_buffer_staging) on card-resident buffers (lookup,by_address,by_address_in,loose) withCardCpu::Virtual(CardMirror): an anonymousVirtualAlloc(MEM_RESERVE)reservation committed lazily in 64 KiB (PAGE) chunks only when written/copied.MEM_RESERVEonly), reading as zero incopy_out/sync_range_to/card_helduntil first touched, and allocate a D3D12 staging fallback resource lazily (CardMirror::ensure_staging) only when anown.is_none()copy or diagnostic fallback actually requires one (VICTORY_CARD_LAZY_STAGING=0restores eager allocation).send::takepass_asidetrigger until non-zero word transfers are observed (total_words > 0) so pureCopyBufferRegionsends do not unnecessarily force eagerID3D12Resourcecard staging allocation.Fence-safe post-upload release of texture
CpuStagingandpool::STAGINGblock sizing (texture.rs,texture/ahead.rs,pool.rs,host.rs,host/prelude.rs,texture_detile_tests.rs):OnceLock<CpuStaging>intexture::Stagingwith releasableMutex<Option<Arc<CpuStaging>>>, reference-countedUploadGuard, andpending_uploads: AtomicU32tracked acrossHostList::hold(prelude_uploads,claim_hoisted, directupload_from) and copy-queuetexture::ahead::Jobs.Staging::cpu(returningStagingPieceback topool::STAGINGor freeing dedicated upload buffers and updatingSTAGEDaccurately inCpuStaging::drop) immediately when the final in-flight GPU fence retires (HostList::reset()/ post-SetEventOnCompletioninahead::finish) wheneveruploaded && !dirty, while lazily re-acquiring and refreshingCpuStagingif title memory changes later.CpuStagingallocation for linearmovie_planestaging entries.pool::STAGINGblock size (16 MiBon<= 18 GiB,32 MiBon<= 32 GiB,64 MiBabove) and idle spare retention viaSTAGING_SPARES(separate from VRAMTEXTURESspares), packing allocations withfullest: true.Verification
cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib -- --test-threads=1: 844 passed, 0 failed, 39 ignored (matching CI serial execution; includes new tests inshadow::card_staging_tests,pool::tests, andtexture_detile_tests).cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-gpu --all-targets -- -D warnings: passed with zero warnings.cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-gpu --all-targets --all-features -- -D warnings: passed with zero warnings.cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings: passed with zero warnings.30e6c6de51tobd171f1679github-bot referenced this pull request2026-12-03 13:38:25 +00:00
@Androtim on GitHub · 2026-12-03 13:33 UTC · original
Triage (
bd171f16, CIcheckPASS):#40Rank 1 & Rank 2 memory work (+1,025/-286across 9 files: virtualizedCard::stagingmirror undersend::own()+ post-uploadCpuStagingrelease).#282) + Gate 3 plain--releaseA/B (FPS,private_commit_mb,working_set_mb,0crashes/DRED) +--features diagnosticsvisual PNG check.