Repository navigation
GPU: the host says whether its GPU shares memory with the CPU - #2912
0xkn0wh3r3 wants to merge 2 commits into
Conversation
…ecks that title memory opens in place At host creation, `unified::detect` reads ARCHITECTURE1 (UMA, cache-coherent UMA), OPTIONS16 (GPU upload heaps) and the DXGI budgets. It also runs a self-test: a write-watched block, allocated as the title's pools are, is opened with OpenExistingHeapFromAddress1, and a copy queue copies its first half out and other bytes into its second half. The answer is what the GPU did: a layer can report the method and still not share the memory. The result goes on one log line and into the GPU failure text. Nothing changes behaviour on it yet; later placements (in place on unified hosts, video memory for hot buffers on discrete ones) can gate on it. `uma_bench` (ignored) probes every adapter and WARP: what opening title memory implies (protect, unmap and decommit fail with error 87 while a heap lives; a read-only page fails the open; write watch sees CPU writes, not the GPU's). It times GPU access per placement and pattern, and GPU copies between video memory and the rest.
kotekompotek
left a comment
There was a problem hiding this comment.
Scoped review: detection reports what the GPU did (self_test opens title memory as a heap and checks both-direction visibility) rather than trusting reported feature bits — exactly right for translation layers that claim UMA without external-memory-host. Behaviour-neutral (logged once at creation + crash text), and the captured implications (no protect/unmap while the heap lives, write-watch can't see GPU writes, ~0.2-0.75 ms/MiB open cost) are the constraints any future in-place design has to respect. The uma_bench patterns are synthetic shaders, no game data. LGTM.
fuzeofficlal
left a comment
There was a problem hiding this comment.
Verified head cdc50faf cleanly merged onto origin/main (63bcca43) on Windows 11 x64 across three adapters (discrete NVIDIA GeForce RTX 5090, integrated AMD Radeon RDNA2 iGPU, and D3D12 WARP) with VICTORY_D3D12_DEBUG=1.
Triple-Adapter uma_probe Results (--ignored --nocapture, zero debug-layer errors)
- NVIDIA GeForce RTX 5090:
its own, the CPU maps part of it (Resizable BAR); title memory opens in place; budgets 31419 MiB local, 45969 MiB non-local (asked and tested in 29.48 ms) - AMD Radeon(TM) Graphics (iGPU):
unified with the CPU's, cache-coherent false; title memory opens in place; budgets 47991 MiB local, 0 MiB non-local (asked and tested in 5.24 ms) - Microsoft Basic Render Driver (WARP):
unified with the CPU's, cache-coherent true; title memory opens in place; budgets 45969 MiB local, 0 MiB non-local (asked and tested in 1.91 ms)
Code & Lifetime Review
D3D12_FEATURE_ARCHITECTURE1(UMA/CacheCoherentUMA),D3D12_FEATURE_D3D12_OPTIONS16(GPUUploadHeapSupported), and theOpenExistingHeapFromAddress1bidirectional visibility self-test are logging/diagnostic-only and preserve all existing paths.- Resource lifetime order in
self_testdropsopenedandheapbeforeBlock::dropfrees theMEM_WRITE_WATCHallocation.
Local Verification (--features diagnostics, VICTORY_D3D12_DEBUG=1)
- RTX 5090 & WARP:
unified::tests+host::tests+shadow::tests+draw::tests(skipping pre-existing 1M descriptor cap baseline on RTX 5090) 48/48 passed on both adapters. cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics) &cargo xtask policy(193 files ok): clean.
Looks clean and ready to merge.
|
Automated triage for the maintainers. Verdict: merge candidate. Thanks, this is what the last review asked for. At Two small nits:
CI: passing ( Generated by Claude Code |
… the benchmark go Triage: detection ran a self-test (a heap opened over a write-watched block, copies on a queue of its own: 3-20 ms) at every host creation, only to log its answer. What stays here, for the log line and the GPU failure text: - ARCHITECTURE1 (UMA, cache-coherent UMA); - OPTIONS16 (GPU upload heaps); - the DXGI budgets. That is about 0.3 ms on an RTX 5070 Ti. The self-test moves to the change that acts on it (Marvisak#2945). The ignored benchmark (uma_bench.rs) leaves the repository; its results are in the PRs.
…t decides the default Marvisak#2912's triage moved the self-test here, to the change that acts on it. crate::unified::self_test is unchanged: a write-watched block opened with OpenExistingHeapFromAddress1, a copy queue's round trip, both directions checked. It no longer runs at host creation. VICTORY_IN_PLACE unset asks it the first time, and only where the host reports unified memory. A failure keeps the copies and is logged with its reason. Discrete hosts never run it.
|
Thanks. Addressed in cdf12e9:
Tests: on the 5070 Ti, only the two heap-cap failures that also happen on |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):
cargo test -p victory-gpu --lib unified::tests: 2 passed, 0 failed (warp_is_unifiedandthe_host_device_is_describedon RTX 5090 + WARP).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
|
Replaced by #3102, which combines this with the rest of the host-memory placement work in one PR, with measurements on a discrete and an integrated GPU. Closing here. |
Problem
The console's GPU reads title memory where it is. VIctory keeps host copies of title memory in system memory and refreshes them at every submission (
shadow,watch). Nothing on main asks what the host's memory is like:The open placement PRs decide without this:
GPUUploadHeapSupportedalone, so a unified host would still copy.What this adds (no behaviour change)
crate::unified::detect, at host creation:D3D12_FEATURE_DATA_ARCHITECTURE1:UMA,CacheCoherentUMA;D3D12_OPTIONS16.GPUUploadHeapSupported;That costs about 0.3 ms on an RTX 5070 Ti. The result goes on one log line (
host GPU memory: ...) and into the GPU failure text. It is kept on the host (Host::memory) for the placements to gate on.Changed after triage:
Measurements (synthetic; benchmark no longer in the tree)
Detection:
its own, the CPU maps part of it (Resizable BAR); budgets 15227 MiB local, 47508 MiB non-local.unified with the CPU's, cache-coherent false.unified with the CPU's, cache-coherent true.The AMD APU reports
CacheCoherentUMA = false, yet write-back memory was coherent both ways there. So a mode should key onUMA.GPU access, 256 MiB buffers, GB/s (GPU timestamps):
The benchmark's source, as it was, is at cdc50faf: uma_bench.rs.
Tests
unified::tests::warp_is_unified.unified::tests::the_host_device_is_described.cargo test -p victory-gpu --release --lib: two failures,descriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views. They fail the same way on clean main on this machine.Related