GPU memory: separate system RAM from VRAM, and use the title's own backing where it can be opened #916
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!916
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-916"
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?
@CwWwWwW on GitHub · 2026-11-28 09:02 UTC · original
CwWwWwW:feat/gpu-memory-separation→main· +3551 −242 · 11 files · 16 commits · closed without mergingWhat this is
This PR carries the whole GPU-memory project on top of
63b902f: 16 commits, 11 files,+3551/-242. Its first revision was the system-RAM/VRAM separation audit and the accounting
fixes. This revision continues it with the copy-bridge project - the part that finds which of
the layer's host copies exist only because the host cannot see the title's memory, and removes them
where the GPU can be given the title's own bytes instead.
One branch, one PR. No default changes anywhere: every direct-access path is opt-in and off by
default, and with the switches unset the product path is exactly the base behaviour.
memory-domain model, the placement ledger, the verified accounting fixes, the window/texture
budget audit, and the verification record (
docs/memory-separation.md,docs/memory-separation-window-budget.md).(
docs/copy-bridges.md), the backing/admission invariants that make a direct placementdecidable on the same evidence as the fallback it replaces, the page-pool direct-access
prototype, the migration of the copies the policy refuses, the coherence/lifetime wiring, and
the removal plus the record of what remains.
How to proceed after this PR
This section is for reviewers and whoever picks the work up next. The PR is deliberately the
foundation, not the end state.
1. Merging this PR
This is safe to merge as-is:
behaviour changes with them off (the base behaviour is unchanged);
D3D12 infrastructure) are untouched - the audit records each one and why it stays;
Two inherited CI conditions are not caused by this branch and should not block the merge: the
repository's clippy gate is already red at
63b902ffor pre-existing lints, and the WARP testsuite has one baseline failure (
depth_bounds_pipeline_loads_and_filters_draws). The build checkand all tests this branch adds pass; exact runs are in "Validation" below. Fixing the baseline
lints is a mechanical follow-up outside this change.
Concretely, the current head's CI run (46145621108) fails in its Clippy step on exactly two lints,
both of which fail identically on a clean
63b902ftree with the same command:victory-shader/src/emit/mod.rs:2768(let_and_return) andvictory-gpu/src/shadow.rs:1861(manual_is_multiple_of, the base'sshadow.rs:1708moved bythis diff). Because the Clippy step fails first, the diagnostics build and Tests steps are
skipped, as in the first revision. Neither lint is added by this change.
2. Next: validate on the target NVIDIA hardware
Everything below needs a person with the target GPU, driver and game build. Run it after this PR
is merged (the switches exist on the base path, so validation can also be done on this branch).
Record the exact GPU, driver, game build/save, switch values and logs; open one follow-up PR with
the record in
docs/copy-bridges.md§17 and one per resulting code change.VICTORY_MEMORY_REPORT=1and no direct switches.Keep the placement ledger and the created-resource setup as the reference.
VICTORY_INPLACE_PROBE=1(level 2 also opens one part for amoment). The census reports which title memory is private/committed, one contiguous section
run, or scattered/holed, and which part of it can be opened as a host heap. This number decides
how much of the removable mirror class will actually go away.
VICTORY_INPLACE_VIEW=2 VICTORY_MEMORY_REPORT=1(page poolwindows, title buffers and view-byte copies), and separately
VICTORY_INPLACE=3(privatememory). Check: visuals, save/load, no crash or device removal; the ledger shows direct-backed
bytes per class and the refusal reasons that remain.
placed shader writes are visible to a CPU reader only after the wait, and that CPU writes before
a dispatch are visible to the GPU. The declaration path is unit-tested; the ordering under a
live relay needs the run.
Direct access is not automatically faster than a copy into local VRAM; only measurement decides
whether a default is worth it.
removal/TDR, and confirm the fallback path takes over and no title-visible call fails in a way
the code does not record.
If any step shows a defect, the answer is to keep the switches off and report it - not to lower
the evidence bar.
3. Decision gates after validation
VICTORY_INPLACE_VIEWper class (one class at a time, each its own commit/PR)4. Then remove code (the remaining deletion tasks, in order)
port.rs). No hardwareneeded; pure refactor with the existing WARP tests. Removes the last duplicate mapping-lifetime
code; documented as a follow-up, not a copy bridge.
(
VICTORY_CARD_ALL,VICTORY_WINDOWS_OWN,VICTORY_SEND_BAR,VICTORY_WINDOWS_BAR_MB,VICTORY_WC_BAR). Delete only after the hardware A/B shows the fallback substitution is equalor better wherever the memory is openable; today they are the A/B apparatus.
VICTORY_INPLACE_VIEWafter §2/§3. Once a class is on bydefault, its mirror branch is provably unreachable and can be deleted with the release note.
several runs/heaps; only then can the scattered-memory mirror class go.
subset first). Only that subset's mirror and staging are deleted.
memory-class downgrade; only a measured PCIe-vs-VRAM study could justify it, and this project
does not.
Do not delete a bridge because its source and destination hold similar bytes; every removal above
has a stated replacement, a test, and a fallback. The current required/unresolved list, with the
reasons, is
docs/copy-bridges.md§10 and §16.2.The change in detail
The audit: which copies are avoidable, and which are not
docs/copy-bridges.mdinventories every copy and intermediate allocation with its source,destination, callers, why it exists, whether the title's backing is openable, and what a removal
must preserve. The classification:
(switch-controlled shortcuts) and the second system-memory sides. Kept as switches until §4.2.
view-byte copies (the largest class by bytes), plus the layout-compatible texture subset and the
target/depth class after separate evidence.
layout/format/depth reasons, and the D3D12 infrastructure. None is touched.
pinning, multi-run composition, a device-local by-address arena, WDDM residency and PCIe cost.
What the copy-bridge project changes
Direct access instead of a copy, only for the copies the policy already refuses a VRAM side.
inplace::place_fallbackis asked by the buffer, window and view-byte copy paths exactly wherethe device-local admission has already refused the copy (a carded copy is never replaced by a
memory-class downgrade). It opens the title's own memory as a host heap:
OpenExistingHeapFromAddress1on that view, a cross-adapter UAV buffer placed over it - at anyaddress, not just the old sub-4-GiB port range. One view and one heap are shared per section
run, not per copy.
A placed copy has no staging buffer, no mirror, no card side, no hash twin, no send/fetch state,
no refresh, no snapshot and no copy-back: the GPU reads and writes the title's pages.
Switches (all off by default)
VICTORY_INPLACE_VIEWVICTORY_INPLACEVICTORY_INPLACE_MBVICTORY_INPLACE_PROBEEvery refusal (not openable, scattered, holes, cap, host refused, no
ID3D12Device13) is countedwith its reason in the placement ledger and falls back to exactly the old copy path.
Coherence and lifetime
HostList::defer_gpu_writepath, so the late waits and settles order a CPU reader behind the flight that may write them.
VirtualProtect(intercepted unconditionally) andXMemFreeDefault's rawVirtualFreelet placed copies go before the kernel call.view and closes its handle (WARP test). Scattered or uncommitted ranges are refused, never
guessed.
ID3D12Device13is probed once per process; without it every placement is refused asHostUnavailableand copies are made as before.Validation
Local, Windows, Rust 1.98.1 x86_64-pc-windows-gnu (2026-11-28):
cargo check --workspace --all-targets --lockedcargo check --workspace --all-targets --all-features --lockedcargo clippy -p victory-gpu -p victory-hle --all-targets --locked -- -D warningsclippy::manual_is_multiple_ofinshadow.rs(same at base)cargo testlocallydlltool; no MSVC in this VM)GitHub Actions
windows-latest(WARP), on temporaryci/**workflow branches of the fork (theworkflow file is the only extra file; nothing is pushed to this repository):
63b902f(run 46122898345)d04af6e)The one failure is the same at baseline and here:
pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws- WARP does not implementdepth bounds. All 18 tests added by this project pass; the run's overall conclusion is "failure"
only because of that inherited baseline test. The three commits after the tested source tip
(
966569d,d55612c,4fb7197) change documentation and comments only.What is not claimed
WARP and
GetHeapPropertiesprove the creation heap class the API reports, not physicalresidency. Not established here: opened-heap acceptance and pinning on the target driver, physical
residency and WDDM paging, coherency of GPU access to title system memory under the real relay,
PCIe cost against the copies replaced, the openable share of the real title memory, and
device-removal/TDR behaviour. Section 2 above is the run that establishes them.
Commits
8dae978audit and ownership rules (docs)48b9888separation implementation, accounting fixes, tests60e8281separation verification and window-budget audit (docs)a7f0bcccopy-bridge audit and plan (docs)a2539dfbacking/admission invariants, exact placed-copy invalidation, ledgerda24c3fpage-pool direct-access prototype7791fa5migration of the refused copies (buffers, windows, view bytes)65930a4placed-write declarations and lifecycle hooks72ae9a9shared page-pool regions and the record of remaining copies (docs)6ec7534,f3ee38f,f108638,d04af6etest fixes found by CI966569dfinal verification record (docs)d55612crestore the phase records the copy-bridge document lost (docs)4fb7197in-place notes no longer claim a removed flight gate (comments)The document lost the tail of the Phase 3 record (13.2-13.4) when the Phase 4 record was written over it, then lost the Phase 4 record to Phase 5's, the Phase 5 record to Phase 6's, and the Phase 6 record to the verification section: every phase edit after section 13.1 started at the same line ("memory, at any address. It is behind its own switch, off by default.") and replaced everything to the end of the file. This restores the Phase 3 tail and the Phase 4, 5 and 6 records from the commits that wrote them (da24c3f/7791fa5,65930a4,72ae9a9), reconciled with the final code: the flight gate and shadow::flights_air no longer exist, NoDirect::InFlight was removed with them, the fallback-policy test lost its gate cases and is no longer named for them, and the source tip the CI run tested is now recorded next to the results. The document runs 12-17 without a gap, so section 17's reference to 16.3 resolves, and its closing sentence points at the hardware list in sections 11 and 16.3. docs/copy-bridges.md only.@trustno1-coder on GitHub · 2026-11-28 19:28 UTC · original
Thanks for this. I'm closing it without merging: at about 3,500 lines it conflicts with the current main in 12 places across host.rs, shadow.rs, residency.rs and resource.rs, the core of the memory code, and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main, ideally split into smaller steps, and open a new pull request.
Pull request closed