No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
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
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
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/Marvisak--VIctory!2945
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2945"
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?
@0xkn0wh3r3 on GitHub · 2026-11-26 01:12 UTC · original
0xkn0wh3r3:gpu/in-place-on-unified→main· +2499 −18 · 11 files · 34 commits · closed without mergingStacked on #2112 (desplmfao), #2912 and #2921. New here:
7b6882b7,1c87ba06,1fc54410and3ed7d725; the rest is those three PRs merged. Draft until they land.Problem
On a host whose GPU shares memory with the CPU (an AMD or Intel APU, an integrated GPU, Apple silicon under a translation layer), host copies of title memory buy no GPU time. A synthetic benchmark on the Ryzen 7900X's integrated Radeon (the benchmark summarised in #2912) measured every placement within noise of every other: today's copies, title memory opened in place, upload heaps and "video memory".
The copies there only cost their refreshes and copy-backs, which are 45–76 ms per synthetic world frame on main. #2112 can read title memory in place, but it is opt-in on every host.
Also, while a heap is open over title memory, Windows refuses
VirtualProtect,UnmapViewOfFile2andVirtualFree(error 87), so the title cannot free or remap that memory. #2921 adds a registry for exactly this; #2112's heaps were not in it.What this changes
Self-test (moved here from #2912 on its triage):
crate::unified::self_test.OpenExistingHeapFromAddress1.It runs once, the first time the default is asked, and only where #2912's detection reports UMA. Discrete hosts never run it. It catches layers that have the method but don't share the memory (vkd3d-proton without
VK_EXT_external_memory_hostmakes new memory). It takes 3-20 ms.Default: with
VICTORY_IN_PLACEunset, in place is on where the host reports UMA and the self-test passes. The log says so once, or logs why the copies stay.=1keeps it on everywhere.Pins: every heap #2112 opens is registered with
crate::pinned:let_go_in_place(start, len);ID3D12Device13, released withlet_go_heap(id).The title's frees, protections and remaps (#2921's wrappers, xmem's unmapping) first stop handing out what is placed there; the change then succeeds once the heap goes. The registration is forgotten when the heap is destroyed (
ID3DDestructionNotifier), so pins don't pile up. Each placed buffer holds its heap through private data (SetPrivateDataInterface), so the heap, and its pin, last as long as the buffer on every backend. vkd3d-proton destroyed a sub-range heap as soon asin_place_bufferreturned, while the buffer still lived (reported by pickles976 on Wine/vkd3d-proton, NVIDIA; fixed in1fc54410). A buffer that cannot hold its heap is refused.README: the
VICTORY_IN_PLACEparagraph says when it is on by default.Limits
keep_in_place). If the title frees memory a not-yet-reset list still names, the free is still refused after #2921's 100 ms retry, as on #2112 today.Tests
shadow::tests::the_title_frees_memory_a_window_is_in_place_over:title_memory_changewith the title'sVirtualFreedrops the window and its heap first.shadow::tests::a_buffer_in_place_holds_its_heap_and_pin: on the sub-range and the whole-allocation path, with nothing but the returned buffer holding the heap, the pin stays while the buffer lives and goes with it. Passes on the RTX 5070 Ti; not yet rerun on vkd3d-proton. On CI's WARP the pages were let go a little after the buffer went, so the tests that free right after now retry for up to 1 s (3ed7d725), astitle_memory_changedoes for 100 ms.title_memory_is_in_place_by_default_on_a_unified_host: the default equals "UMA and self-test passed".unified::tests::the_answer_names_what_was_not_sharedandtitle_memory_opens_in_place_on_warp: the self-test.VICTORY_D3D12_WARP=1), in place came on by default, and 268 of 269 victory-gpu tests passed. The failure,frame::tests::waits_end_on_ticks_and_count_frames, is a timing test and passed three times alone.dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, fail the same way on clean main on this machine.Related
@fuzeofficlal on GitHub · 2026-11-26 01:35 UTC · original
Code review and triple-adapter (NVIDIA RTX 5090 discrete + AMD Radeon RDNA2 iGPU + WARP) verification at head
7b6882b773c0(stacked on#2112,#2912,#2921):CacheCoherentUMA& pinning audit (title/shadow.rs:1184, 1201-1226,title/pinned.rs):in_place_enabled()toh.memory.uma && h.memory.in_place.is_ok()(without requiringCacheCoherentUMA == true, instead guarding on the startupunified::self_testbidirectional visibility + write-watch probe) is validated directly by hardware below; explicitVICTORY_IN_PLACEoverrides cleanly.pin_heapand unpins viaID3DDestructionNotifier::RegisterDestructionCallback(with immediate cleanup on registration failure).uma_proberesults (Windows 11, Rust 1.98.1):uma=false, ReBAR,31419 MiB local / 45969 MiB non-local-> defaultin_place_enabled() == false.unified with the CPU's, cache-coherent false; title memory opens in place; budgets 47991 MiB local, 0 MiB non-local (4.06 ms)—private 4 MiB,private write-watched 4 MiB, andsection viewall reportGPU sees CPU writes true, CPU sees GPU writes true, GPU write triggers0watch pages, and CPU write to 2 pages triggers2watch pages. Directly confirms enabling in-place on AMD APUs despiteCacheCoherentUMA=false.uma=true, cache-coherent true; title memory opens in place-> defaultin_place_enabled() == true.VICTORY_D3D12_DEBUG=1):cargo xtask policy:195 files ok;cargo clippy -p victory-gpu -p victory-hle --all-targets -- -D warnings(default +--features diagnostics): 0 warningsunified:: title_memory_is_in_place_by_default the_title_frees_memory_a_window_is_in_place_over pinned::): 10/10 passed--features diagnostics,unified:: shadow:: pinned::): 33/33 passed;victory-hle -- xmem memoryapi: 16/16 passed.Looks great once the stacked prerequisites (
#2112/#2912/#2921) land; LGTM.@kotekompotek on GitHub · 2026-11-26 02:53 UTC · original · approved these changes
LGTM — reviewed the delta on top of the stacked PRs (
7b6882b7,cdf12e9e).in_place_enabledsemantics match the PR description exactly:=1on everywhere, any other set value off, unset → UMA +self_testpass. TheOnceLockruns the self-test at most once, lazily on first use, and only on UMA hosts — discrete hosts never pay it.self_testout ofdetectis the right call: every host creation used to run a 3-20 ms GPU round trip whose answer nothing consumed.detectis now the cheap queries it's described as;Memoryno longer carries thein_placefield.pin_heapcovers both heap paths: whole-allocation opens pin[start, start+size)withlet_go_in_place(start, len)releasing the placed window, and sub-range heaps pin their own range withlet_go_heap(id). The two destruction outcomes are handled symmetrically — heap destroyed by itself →forgetdrops the registration; title tries to change pinned memory →releaseruns first, outside the registry lock. TheRegisterDestructionCallbackfailure path correctly leaves the pin registered rather than silently losing it.the_title_frees_memory_a_window_is_in_place_overis discriminating on both halves:held_over1→0 acrosstitle_memory_change+VirtualFree, LOOSE entry removed, then heap self-destruction drops its own registration.uma_bench.rsremoval is fair — the benchmark was the justification evidence; its summary is in #2912 and history keeps it.Noting scope per the PR description: I reviewed the new commits only; the base mechanics are #2112/#2912/#2921's.
@pickles976 on GitHub · 2026-11-26 03:32 UTC · original · edited 2026-11-26 06:26 UTC
Important Wine/vkd3d-proton 3.2.0 RTX 4060 Laptop GPU (discrete, 16 GiB system RAM) caveat before anyone enables
VICTORY_IN_PLACE=1: on exact earlier stacked head7b6882b7, the PR testshadow::tests::the_title_frees_memory_a_window_is_in_place_overfailed 0/1 at theheld_overassertion.in_place_bufferreturned a valid placed buffer, butheld_overhad already fallen to 0, expected 1. Local logs:.compat-runtime/logs/verify-pr2945-wine-inplace-pin{,-probe}.log(not attached). In a temporary test-only diagnostic, the pin was 1 immediately after registration, then the heap destruction callback fired before the caller asserted; diagnostic edit was restored.The opened heap COM handle appears to be dropped when
in_place_bufferreturns only the placed buffer/GPU address/numeric heap ID; on this Wine backend that destroys the heap COM object while the placed buffer is still alive, so its notifier forgets the pin prematurely. A later titleVirtualFree/remap could bypass the intended release. Please retain a strong heap lifetime with the placed resource (or otherwise tie the pin to the lifetime of all placed resources), and add a test that asserts pin is held for as long as the returned buffer is alive, then relinquished before the title changes memory. The newer1c87ba06commit changes UMA-default/self-test behavior but not this failing pin path, so I have not rerun the same failure.This is a Wine/backend-specific negative, not a claim the PR fails on native Windows or UMA. The PR defaults in-place off on this discrete GPU; it is not a safe 16 GiB loading workaround here. No title launched with this mode.
Revised-head verification:
3ed7d725f6895fe1a235eb6fa8ff2485261ca151, including the actual heap-retention fix1fc54410, now passes the earlier title-free regression and the new both-path pin-lifetime regression on this Wine/NVIDIA backend. 3passed/0failed/0ignored,0.75s, fresh compile8.85s, NVIDIA enumerated. Third check locally invokes yourunified::self_test(&host.device)on the selected discrete NVIDIA host: the real CPU→GPU→CPU aliasing round trip passed too. No forced in-place title run yet.Local test-only differences: missing host or refused heap now fails rather than silently returning in the two lifetime fixtures, plus the selected-host self-test entry point. Production unchanged from head. This clears the specific early-pin-drop and real-aliasing gates reported above; it does not certify all release/remap or rendering behavior. Latest #2112
29decb3changes GPU-write invalidation, which is absent from this stacked head and is a separate correctness consideration before a title experiment.Environment: Wine11.0, NVIDIA590.48.1, DXVK3.1.1, diagnostic relaxed vkd3d-proton3.2.0
2576c0b4adfae4a+, assertions disabled and allocator/listfrom_ifacevtable checks removed, null checks retained. Not stock-runtime certification. Same6,000MiB GPU/2,048MiB availableRAM/10GiB disk guards and9GiB/512MiB scope caps. Log.compat-runtime/logs/verify-pr2945-fixed-pin-alias.logand sampled metrics.Mixed local title follow-through (2026-11-26, Wine/NVIDIA)
After the three exact-production-head pin/alias fixtures passed, I tested a mixed local integration, not pristine #2945:
3ed7d725f6895fe1a235eb6fa8ff2485261ca151plus only #2112 commit29decb3719142296cad124453a3b8651068f22f6's GPU-write notification fix, a read-only logical-span probe, and test hardening. This retains the stack's fixed 256 KiB loose window and default 1 MiB in-place floor, rather than claiming current #2112 defaults. The notification port passed a local two-real-view alias tracking regression (including subsequent CPU writes); that regression is not a GPU-dispatch test.A fresh release build named this checkout.
VICTORY_IN_PLACE=1, with account selection at 20 s, produced actual loading artwork at 60/90 s. RAM guard stopped loading at 112.88 s: available RAM 2,012.1 MiB (2,048 MiB floor); GPU peak 3,297 MiB; scope peak 7,693.2 MiB, anonymous peak 3,079.9 MiB; user-available disk minimum 19.090 GiB. Exit 137 was the guard, not an unhandled title exception. No gameplay, controls, or gameplay FPS claim.Last logical-span probe (~112 s):
These are logical resource spans: they can overlap and exclude allocation/driver overhead. Not total RAM or unique physical bytes. They show the in-place path is active, but copy-backed growth still exceeds this machine's safe loading budget. Different stacks/loading timing make earlier no-in-place runs unsuitable for a matched-stage savings claim. Host compute PSOs
b68f0931f1f47e61,13dfdd3b1136e407,88994c3496045f51still returned0x80070057; a missing-host-pipeline dispatch was also logged.Local artifacts:
.compat-runtime/logs/20261126T062146Z-{console.log,resources.csv,guard-events.jsonl}, screenshotsmenu-20261126T062246996159Z.png/menu-20261126T062317003405Z.png, andverify-pr2945-gpu-write-notification.log.Environment remains Wine 11.0, RTX 4060 Laptop 8 GiB / NVIDIA 590.48.1, 16 GiB system RAM, diagnostic relaxed vkd3d-proton 3.2.0
2576c0b4adfae4a+(assertions disabled, allocator/list vtable identity checks removed; null checks retained), not stock-runtime certification. Same GPU 6000 MiB / RAM 2048 MiB / available-disk 10 GiB guards and 9 GiB cgroup / 512 MiB swap caps; no limits raised. No code PR/push.@0xkn0wh3r3 on GitHub · 2026-11-26 03:36 UTC · original
@pickles976 thanks, you were right. Fixed in
1fc54410: each placed buffer now holds its heap throughSetPrivateDataInterface, on both the sub-range and the whole-allocation paths. So the heap, and the pin it carries, live exactly as long as the buffer, whatever the backend does with the opened heap's handle. A buffer that can't hold its heap is refused rather than placed.The new test
a_buffer_in_place_holds_its_heap_and_pinchecks both paths with only the returned buffer holding the heap: the pin stays while the buffer lives and goes with it. It passes on an RTX 5070 Ti. It hasn't been run on vkd3d-proton yet, so a rerun of your case on that backend would confirm it.@0xkn0wh3r3 on GitHub · 2026-11-26 08:05 UTC · original
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.
Pull request closed