Use pageable process memory for CPU-only GPU buffer mirrors #1823
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!1823
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1823"
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?
@ihyajb on GitHub · 2026-11-29 00:28 UTC · original
ihyajb:perf/pageable-card-mirrors→main· +213 −66 · 4 files · 3 commits · merged 2026-11-29 08:16 UTCFixes #1815
What it changes
VICTORY_CARD_CPU_HEAP=1gives the CPU mirror of a two-sided buffer ordinary pageable Windows memory. The GPU reads the submission’s immutable upload. Single-sided buffers,VICTORY_SEND_OWN=0, and the GPU upload checker retain their shared D3D12 resources. The switch defaults off. If the packed upload cannot be allocated, the fallback snapshots each affected shadow’s dirty ranges and retains those uploads through GPU retirement.The original design is crossducking’s RAZDA4A-XEN 76b58130, carried by vix0e0e in VIctory-LITE e66dcc25 and adapted by advantyx in VIctyx 7f5497c8. This port adds the fallback and a byte-exact GPU readback regression test.
How it was tested
RTX 5070 12 GB, Windows 11, driver 621.40. The isolated test uses only the GPU library and synthetic data. It allocates eight persistent 32 MiB CPU mirrors, writes every byte, verifies a sentinel in each, and samples the process's DXGI nonlocal usage before allocation and while the mirrors are live. It checks the private-byte accounting again after release. Each measurement runs in a fresh process.
VICTORY_CARD_CPU_HEAPBoth orders (off/on, on/off) gave identical byte counts. With the switch on, Windows accounts for the mirror as ordinary process memory. The table measures DXGI accounting only.
Gameplay context. In the earlier paired comparison on upstream
d4b5d517, both arms used the same 512 MiB upload segmentation. On Series S, 720p scene, DLSS Quality to 1080p, 2× DLSS FG and RT off, DXGI nonlocal usage at the engine's 240-FG-present checkpoint measured 6,540 MiB before and 4,572 MiB after. The two-minute settled samples averaged 26.52 and 27.04 base FPS at 4,172 and 4,131 draws/frame respectively. The evidence supports a shared-memory reduction; FPS remains inconclusive. The separate gameplay A/B on this exact branch stopped during the control run and produced no valid pair.Reproduce the standalone measurement in PowerShell:
cargo test --locked -p victory-gpupassed (551 passed, 44 ignored). The suite includes a GPU readback of two partial dirty ranges with sentinel bytes between them and a CPU source changed before submission. The ignored DXGI measurement above was explicitly run four times.victory-shader/src/emit/lower.rs(unusedcolour, manual checked division). The workspace test run reached the repository policy test, which rejects that same existing file at 667,523 bytes against a 655,360-byte limit.Checked for overlap
shadow.rs,host.rs,host/send.rs,host/upcheck.rs), and checked the triage map in #1138. #1383, #1390 and #1391 concern oversized per-submission upload allocations. This PR changes who owns the persistent CPU-side copy.@eleboucher on GitHub · 2026-11-29 01:41 UTC · original
On a 16 GB PC this PR fixes the shared-memory crash we get with the RT structure builder on.
Setup. RTX 4070 Ti SUPER 16 GB, Ryzen 7 9800X3D, 16 GB RAM, Windows 11 build 26300. Native 1440p,
VICTORY_BVH_BUILDER=1 VICTORY_ACTIVATE_RAYS=1, diagnostics build. Base is mainf9dfb76f+ #1640 + #1700 (builder on 32 lanes), which merges clean with this PR and #477. Windows' shared-memory cap here is 7224 MB.Without it. Each run of this base died at 2-10 min. Shared GPU memory reached 6.5-7.4 GB of 7224, then either a command list close failed with 0x8007000E or the device was removed. Settings tried without this PR, all with the builder on:
VICTORY_WINDOWS_BAR_MB=4608/6144, with and withoutTEXTURE_ROOM_PERCENT: died at 2-3 min.WINDOW_KB=1024 WINDOW_TAILS=1 RT_FAULT_MB=384: died at 3 min.With
VICTORY_CARD_CPU_HEAP=1. The log showsCPU mirrors in pageable process memory private_mib=3483-3726. Shared memory stayed at 3.5-3.8 GB, and every leg was alive at 420 s:WINDOW_GROW=1RT_FAULT_MB=384Commit. It stays at 32-34 GB (it includes the card's 14 GB) with 0.3-0.5 GB of RAM free. The mirrors still use RAM, but Windows can now trim them instead of failing at the shared cap.
Suggestion. Consider turning this on by default on
< 24 GiBhosts, as #1640 does for its caches. A 10-minute pair with captures is queued; I'll add the result.@eleboucher on GitHub · 2026-11-29 02:12 UTC · original
The 10-minute pair finished, with captures: same base,
VICTORY_CARD_CPU_HEAP=1 VICTORY_WINDOW_GROW=1, RT structure builder on.@upipibi on GitHub · 2026-11-29 02:37 UTC · original
Test report for #1823 (head
6b85f68d), merged--no-ffonto main0338ec6c. Synthetic tests only: no title run, nogame files.
Setup: RTX 3070 8 GB, driver 616.56, Windows 11 (10.0.26100), rustc 1.98.1. WARP runs use
VICTORY_D3D12_WARP=1with--features diagnostics. Every run logged the GPU and driver fromnvidia-smibeforeit started. A temporary print (not committed) showed the host device on "NVIDIA GeForce RTX 3070" for the hardware
runs and on "Microsoft Basic Render Driver" for the WARP runs.
host::upcheck::tests::private_upload_fallback_snapshots_only_dirty_bytes: 3/3 pass on hardware, 3/3 on WARP.It reaches the device: it records the fallback's copies into a host list, runs it to the fence, and reads the
destination back.
Negative control: in
snapshot_private_ranges, the dirty bytes are not copied into the fallback upload. The testfails on hardware and on WARP at
upcheck.rs:690:[204, 204, 0, 0, 0, 204, 204, 204, 204, 0, 0, 0, 0, 204, 204, 204];[204, 204, 2, 3, 4, 204, 204, 204, 204, 9, 10, 11, 12, 204, 204, 204].So the test catches a fallback that does not send the CPU's bytes. It also shows that only the two dirty ranges are
written.
shadow::land_tests::measure_cpu_mirror_nonlocal_usage(--ignored, one fresh process per setting, in thePR's order 0, 1, 1, 0, hardware only):
VICTORY_CARD_CPU_HEAPBoth runs of each setting gave the same bytes. The increase with the switch off and the zero increase with it on
match the PR's table on the RTX 5070 exactly. Only the starting point differs, by 0.19 MiB.
cargo test -p victory-gpu --lib --locked0338ec6c--features diagnosticsThe extra passed test is the upcheck test; the extra ignored one is the measurement. The suites ran with my
temporary probe as one more ignored test; it is subtracted here.
Not tested: the effect in a title.
Tested with the help of Claude Code (Claude Opus 5.5).
@pickles976 on GitHub · 2026-11-29 03:30 UTC · original
Linux/Wine follow-through on the RTX 4060 Laptop 8 GiB / 16 GiB host: I backported the private-mirror mechanism from
6b85f68d5cc6e014fd5bc878397ae355fdb3017bonto our older rendered Wine-support stack, rather than replacing its renderer with current main. Exact local implementation: 057bdd79, based on Wine PR #1226 plus a separate completed-send-pool cap. This is not an exact-head #1823 test.Three isolated checks pass on physical NVIDIA hardware, Wine 11 / Linux 6.17 / NVIDIA 590.48.1 / stock assertion-enabled vkd3d-proton
2576c0b4adfae4a:A guarded title observation at 2026-11-29 02:47:08 UTC reached an actual captured cutscene with characters, geometry and colour. The capture remains local. Logical private mirrors reached about 1004 MiB; this is not residency. All 320 independent persistent-NVML memory queries completed, with max native query time 451 ms, and the original nvidia-smi safety guard remained active. The run stopped on global GPU use 6005 MiB at317.53 s, not a telemetry timeout or title crash. Kernel interval had no entries; no cgroup OOM. Minimum available RAM3737.7 MiB, scope peak9216 MiB with452 cap events. Earlier configurations did encounter telemetry deadlines; different input/cache/progress conditions prohibit claiming this patch alone fixed them.
Performance is still poor: eight high-draw host reports had median2.25 FPS/460.1 ms per frame, with253 ms preparing and164.35 ms copying/refreshing101.15 MB. These are overlapping host counters, not GPU timestamps or a matched A/B. Scene-aligned I/O-full pressure remained roughly18–19%; controllable gameplay, native30 FPS and long-run stability are unverified.
Useful implementation detail: this older fork already used CPU WRITE_BACK for shared buffers, so I am not attributing a CPU cache-mode speedup to VirtualAlloc. The current benefit under investigation is ownership/pageability and reduced driver-managed host memory, not disappearance of the mirror bytes. Our next controlled setting is the existing80% texture-admission line, with unchanged resolution, rendering exclusions, native-import prohibition and all safety limits.
@ArturoWolff on GitHub · 2026-11-29 06:55 UTC · original · edited 2026-11-29 07:14 UTC
Independent Linux/Proton validation of the exact #1823 diff (
6b85f68d5cc6e014fd5bc878397ae355fdb3017b) applied to568c5e5d2b19f97a9e5562c0e6923581eb6fa360. All four receiving files were byte-identical to the PR base, so the diff applied unchanged. Credits to the authors and original implementation lineage documented in the PR.RTX 4060 desktop 8 GB, 16 GB system RAM, NVIDIA 620.73.04, GE-Proton11-14 / vkd3d-proton 3.2.0 (
cae8353ed7959c4+), locked MSVC release test build. Separate fresh prefixes and processes, physical NVIDIA adapter enumerated,VICTORY_SEND_OWN=1 VICTORY_UPCOPY_CHECK=0; no title data mounted.VICTORY_CARD_CPU_HEAPshadow::land_tests::measure_cpu_mirror_nonlocal_usage: both explicit ignored invocations passed, including retained sentinels and release accounting (1.11 / 1.09 s).host::upcheck::tests::private_upload_fallback_snapshots_only_dirty_bytesalso returned one passed test in 0.87 s with D3D12 backend initialization logged; the existing test has an early return if host creation fails, so I do not claim a separately instrumented no-skip witness. All three Windows child exits and outer exits were 0, no guard stop or kernel fault.This independently supports the DXGI nonlocal accounting effect under our Proton backend. It does not mean 288 MiB of physical host RAM disappears, and does not by itself establish physical memory savings in a title. Our recent ordinary game runs have severe host pressure, including a separately confirmed kernel OOM (#628), so the next title comparison needs adequate initial headroom and matched settings/cache conditions.
Subsequent title startup comparison (same candidate executable, fresh prefixes and external caches, same retained game-generated profile, requested RT/effects unchanged):
VICTORY_CARD_CPU_HEAPmemory.peakThe enabled arm logged 174 MiB of private mirrors; the disabled arm did not. Both scopes retired, no floor stop or confirmed kernel OOM/Xid in either interval. The control's observer failed and the run ended earlier, so this is not a valid matched pair for peak memory or FPS. Both runs still failed to reach visible gameplay. Our synthetic DXGI accounting observation stands; this title startup evidence does not establish a real host-RAM reduction, a ray-tracing correctness improvement, or a startup fix. I am retaining the diagnostic result rather than promoting the candidate on the basis of the synthetic test.
AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
@NotADonky43 on GitHub · 2026-11-29 10:10 UTC · original
Follow-up to the pageable mirror: for private 64 MiB RT arenas only, avoid allocating the second full mirror rather than changing its memory class. Opt in with VICTORY_RT_SPARSE_STAGE=1. Keep one CPU reference, store 4 KiB pending edits, compare final values at publication, and use existing immutable uploads/fallback. Explicit resends remain full. The directory, title-owned windows, and upcheck are unchanged.
Two candidate openings on the cumulative port omitted 832 and 1,088 MiB of persistent staging capacity; pending payload peaks were 107.5 and 109.8 MiB. These are allocator payloads, not net system savings. Overall private peaks and shared peaks varied in opposite directions across the two pairs. Original shaders, warmed pipelines, 4 GiB BAR, RTX 5070 Ti. No FPS or image parity claim. The focused native readback test on current main plus this patch passed with both SEND_OWN=1 and 0, covering adjacent GPU data, reversion, resends and later CPU preparation.
Source-only patch against
829188e9; our fork push based on this main was blocked by workflow scope.Patch with native regression (git apply)