GPU: the Xbox's shared CPU/GPU memory on PC GPUs: simulated in video memory on discrete cards, title memory itself on unified ones #3102
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!3102
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3102"
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 08:03 UTC · original
0xkn0wh3r3:gpu/host-memory-placement→main· +5792 −56 · 20 files · 24 commits · openGoal: give titles the Xbox Series' shared memory model on a PC whose GPU has its own video memory.
On the console, the CPU and GPU share one pool of memory. A title builds vertex data, constants and command data at an address, hands the GPU that address, and reads back what shaders wrote at that same address, with nothing copied. Titles are written around that.
A PC with a discrete GPU has two pools: system memory next to the CPU, and video memory on the card, joined by PCI Express. Each processor is fast in its own pool and slow in the other: on an RTX 5070 Ti, the GPU reads system memory at ~23 GB/s and video memory at ~720 GB/s.
This PR simulates the console's single pool on such a GPU:
Where the host really has one pool (an APU or integrated GPU), no simulation is needed: the GPU uses title memory itself, exactly as on the console.
Everything here is my own work: new code, plus my open PRs, which this replaces (#2120, #2130, #2222, #2870, #2912, #2921, #2929, #2945). It depends on no one else's PR.
How the shared pool is simulated
Why simulate instead of sharing literally on a discrete GPU? The GPU can read title memory itself across the bus (
VICTORY_IN_PLACE=1). Measured, that takes 43.7 ms per submission, against 29.7–36.7 ms for the simulated pool in video memory: shaders reading across PCI Express cost more than keeping the image coherent. So literal sharing is only the default where the pool really is shared.What each host gets by default
No environment variable is needed. The switches only override.
The startup log names the outcome:
host GPU memory: ..., plus a line when in place turns on or is refused.Overrides:
VICTORY_GPU_UPLOAD=0: every copy in system memory.VICTORY_GPU_UPLOAD_WRITES=0|1: written buffers' copies in system memory, or in video memory on any GPU.VICTORY_IN_PLACE=0|1: in place off, or on wherever the GPU can open title memory as a heap.The diagnostics ranking (from #2929) needs a
--features diagnosticsbuild plusVICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1.Results
Synthetic:
shadow::bench::compute_heavy_submissions_by_copy_placementruns one submission of 200 compute dispatches in 8 lists over 320 MiB of title buffers, through the real copy paths (shadow::find,Shadow::refresh,Shadow::gpu_writes,HostList,Host::execute). Each placement runs in its own process, and the test checks that title memory ends up byte-identical in all of them. Ryzen 9 7900X, Windows 11. Each number is the median of three runs, each the median of 5 submissions, ms per submission.VICTORY_TEST_BENCH_LOOSE=1, 5070 Ti): 30.6-44.4 ms with its 4 MiB windows' copies in video memory, against 66.3-103.1 ms in system memory (−54 to −57%). The GPU's time falls from about 50 ms to 10 (2 with snapshots).VICTORY_IN_PLACE=1: 43.6-43.8 ms. That beats copies in system memory but loses to copies in video memory, so in place stays off on discrete GPUs.VICTORY_GPU_UPLOAD_WRITES=1the GPU's time falls from 151 to 138 ms, but copying back grows from 58 to 78 ms, for 438 ms. No dropped draws, new warnings or device removals. That is the second AMD card where written copies in video memory don't pay, so they stay NVIDIA-only.docs/gpu-memory.mdhas the full tables, every placement on both GPUs.What changes
Detecting the host (from #2912)
crate::unified::detectruns at host creation:ARCHITECTURE1.UMA/CacheCoherentUMA,GPUUploadHeapSupportedand the DXGI budgets. It costs about 0.3 ms and logs one line (host GPU memory: ...), which also goes into the GPU failure text.Copies in video memory on discrete GPUs (from #2120, #2130, #2222, #2870)
VICTORY_GPU_UPLOAD=0andVICTORY_GPU_UPLOAD_WRITES=0|1override.Title memory in place on unified hosts (new,
crate::in_place)OpenExistingHeapFromAddress1), with one buffer placed at its start.Shadowgains an in-place kind whosedatais title memory itself. Refresh, snapshot and copy-back do nothing for it.unified::self_test. The self-test runs once, only on unified hosts: it has the GPU copy into and out of memory allocated like the title's pools, and checks that both sides see the other's writes. That guards against layers that have the API but hand the GPU new memory, such as vkd3d-proton withoutVK_EXT_external_memory_host.VICTORY_IN_PLACE=1turns it on wherever heaps open;=0turns it off.Freeing memory held in place (from #2921, now with its caller)
VirtualFree,VirtualProtectandUnmapViewOfFile*with error 87.title_memory_change. That releases the buffers held over the range first, then retries for up to 100 ms while lists still holding them are reset.Withholding still works with in place
memory::withholding). A buffer in place cannot withhold anything, so:Mirrors stay consistent (review fixes, from r4tedx's findings on this PR)
Host::copy_nowreports whether it saw its fence reached on a live device, and doesn't reuse its allocator until it has. When it didn't (no copier, a failed call, a removed device),bring_backreads the pages through the CPU's mapping of video memory. That's slow, but the mirror still gets the shaders' writes. Written copies made after that stay in system memory. Before this, the stale bits were cleared anyway, and the copy-back pushed the mirror's old bytes into title memory and video memory.VICTORY_COPIES_IN_VIDEO_MEMORY(diagnostics) now places copies as the video-memory placements do: written ones with their mirrors, within the upload budget. Mirrors, the marks bitmap and other shared buffers stay in system memory.Diagnostics (from #2929)
VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1). Buffers in place aren't ranked.Limits
shadow::exact, ~2 KB each, in shared buffers) stay in system memory.Tests
shadow::tests::a_title_buffer_in_place_needs_no_copiesthe_title_frees_memory_a_buffer_is_in_place_overa_buffer_in_place_holds_its_heap_and_pinpage_tables_move_written_buffers_to_copieshost::withholding::a_program_using_title_memory_moves_a_buffer_in_place_to_a_copyin_place::tests::the_switch_decides_and_unset_follows_the_hostin_place::tests::a_host_that_never_opens_heaps_is_not_asked_againshadow::tests::loose_memory_is_in_video_memory_with_a_mirrora_failed_copy_back_from_video_memory_loses_no_shader_writes(a buffer's copy, marked and declared, and a loose window's)an_earlier_undeclared_shader_write_does_not_reach_title_memory_late(a buffer's copy and a loose window's)with_copies_in_video_memory_the_cpu_sides_stay_in_system_memory(diagnostics)VICTORY_IN_PLACE=1; elsewhere tests keep the copies, so the copy machinery stays tested on unified hosts.diagnostics).dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_viewsfail the same way on clean main on this machine.VICTORY_TEST_ADAPTER=radeon): 273 of 273 (291 of 291 withdiagnostics).victory-gpu/diagnostics.Related
@Ahmet-Dedeler on GitHub · 2026-11-26 08:04 UTC · original
A data point for the Mac side, since Apple Silicon is the obvious unified host: through Apple's D3DMetal (CrossOver 26.3, D3DMetal 4.0b3, M5 Max) this path won't turn on, and it can't as written.
UMA=false, sounified::detectwon't see a unified host even though it is one.OpenExistingHeapFromAddressreturns E_NOTIMPL,OpenExistingHeapFromAddress1E_FAIL, andOpenExistingHeapFromFileMapping(SEC_COMMIT and SEC_RESERVE) E_NOTIMPL. So the self-test should fail cleanly and fall back to copies, which is the right outcome.What does work there is the reverse direction: let D3DMetal allocate a mapped write-back buffer, then use
mach_vm_remap(copy=FALSE, fixed + overwrite) to put that buffer's pages at the title's own address. The title and the GPU then share the pages. It's written up with a standalone probe in pragyaangaur/VIctory-macOS#204, and pragyaangaur/VIctory-macOS#207 (merged there,VICTORY_ALIAS_BUFFERS=1) implements it behind a startup probe. It only covers buffers: Metal textures have their own swizzled storage, so textures keep their copies.So if
in_placehad a seam where the "open the title's pages as a heap + place a buffer" step can be swapped for "make a host buffer + alias it over the title's pages", the shadow side of this PR (the in-place kind with no refresh, snapshot or copy-back, the pinning, the withholding rules) looks like it would carry over to the Mac as is. I haven't tried this PR on the Mac myself.@Dukestar69 on GitHub · 2026-11-26 08:08 UTC · original · approved these changes
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):cargo test -p victory-gpu shadow::tests -- --test-threads=1(RTX 5090 & WARP): 24 passed, 0 failed on both (including all new video-memory mirror and in-place tests).cargo test -p victory-gpu draw::tests -- --test-threads=1(RTX 5090): 20 passed, 0 failed.cargo test -p victory-hle memoryapi&xmem: all tests passed.cargo clippy -p victory-gpu -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 199 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Marvisak on GitHub · 2026-11-26 08:24 UTC · original
Automated triage for the maintainers.
Needs work, and needs the maintainer's decision. This merges cleanly, but it is 5,425 added lines in 20 files, folding in eight earlier PRs, and some of it is beyond what triage can pass:
docs/gpu-memory.md(529 lines of rationale, charts and measurement tables) goes against the repo's rule that docs stay short. Please cut it to a few lines on the switches (VICTORY_GPU_UPLOAD,VICTORY_GPU_UPLOAD_WRITES,VICTORY_IN_PLACE) and keep the measurements in the PR description.std::process::Command::new(std::env::current_exe())with environment switches (shadow.rs,in_place.rs,shadow/bench.rs). Spawning processes needs the maintainer's decision.crates/victory-hle/src/modules/memoryapi.rsnow interceptsVirtualFree,VirtualProtect,UnmapViewOfFileand their variants, retrying for up to 100 ms while the GPU side lets go of pinned heaps. That changes runtime behaviour for every title memory change, and it is only exercised synthetically ("No title has been run on either host").unified.rs), video-memory copies (budget.rs,heat.rs,shadow.rs), in place (in_place.rs,pinned.rs) and the HLE wrappers can each be reviewed and reverted on their own. Splitting them would make each reviewable. The PR is the replacement for #2120, #2130, #2222, #2870, #2912, #2921, #2929 and #2945, so those can be closed in its favour once a direction is chosen.CI (
check) was still running when this was written. What would change the verdict: the doc trimmed, the maintainer's call on the child-process tests and thememoryapioverrides, and ideally a split into reviewable pieces.Generated by Claude Code
@r4tedx on GitHub · 2026-11-26 09:02 UTC · original
Thanks for pulling #2120, #2130, #2222 and the rest into one PR. The lazy mirror and the in-place path for unified hosts are nice, and keeping read-only copies in a single buffer saves the RAM that #2993 spends. I read #3102 against #2993, which covers the same ground, and wrote synthetic tests for the places where the two differ. Below are only the findings those tests reproduce on #3102's own code, at
63ab7631.How the tests run. All of them are in one file,
crates/victory-gpu/src/shadow/tests/repro_3102.rs, on the branchr4tedx/VIctory:repro/3102-findings(commit47bd0cf3). That branch is one commit on top of #3102's63ab7631, with tests only and no fixes.They use your helpers (
mirrored_buffer,gpu_store,gpu_bytes,mark_entry).Each runs in a child process with the switches your own mirror tests set:
VICTORY_GPU_UPLOAD=1andVICTORY_GPU_UPLOAD_WRITES=1. That is the default on NVIDIA.They ran on WARP with
--features diagnostics --test-threads 1. WARP reports GPU upload heaps, so no test returns early. Each one asserts and printsadapter "Microsoft Basic Render Driver" vendor 0x1414: gpu_upload true gpu_upload_writes true.I added two hooks, both
#[cfg(test)], so they are compiled out of every other build:Host::copy_now, a switch that makes the copy not run;Shadow::copy_back_marked, a closure that runs just beforetaken.Nothing else in the production code changed.
Command:
VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib repro_3102 -- --test-threads 11. A failed bring-back loses a marked shader write on every side, and can write stale mirror bytes into title memory
Where:
host.rs:4127-4189.copy_nowreturns(). With no copier it returns silently (:4164). Errors fromReset,Close,SignalorSetEventOnCompletionare only logged (:4187). The result ofWaitForSingleObjectis ignored (:4182).shadow.rs:1376.bring_backclears the stale bits before it callscopy_now(:1385).shadow.rs:695and:705.copy_back_markedcompares the mirror with title memory, then alwayspushes the mirror into video memory.What goes wrong. When the copy that brings the shaders' writes back doesn't run:
pushwrites the mirror's old bytes over the shader's write in video memory too. The write is gone from title memory, the mirror and video memory.Tests:
e_a_failed_bring_back_keeps_the_shaders_writes(mirror current)e_a_failed_bring_back_keeps_the_shaders_writes_stale_mirrorEach test runs one submission. Its shaders write
0x5ainto a marked page and into a declared range, and the GPU copies after the submission do not run.Output
How #2993 handles it (
d2c20e28, from fuzeofficlal's review there):copy_nowreturns whether it saw the list end.a_failed_gpu_copy_of_shaders_writes_loses_none_of_them.You're welcome to take any of it. For a lazy mirror, the smallest change would be to clear the stale bits only after
copy_nowreports success, and to skip the copy-back's compare andpushfor pages whose pull failed.2. An old unmarked GPU write reaches title memory late, over a title write
Where:
shadow.rs:1275-1277: the shortcut, under which writes outside declared ranges and marked pages stay in video memory.shadow.rs:1304-1329:snapshots_aheadbrings back stale pages only.shadow.rs:483:keep_beforetakes the snapshot from the mirror.host.rs:1649:pull(&snapshots)after the submission brings back whole pages.shadow.rs:620: the merge.What goes wrong. An earlier shader writes a byte through a view no list declares or marks, as a shader without write marks does. The byte lands in video memory only and sets no stale bit. Later, the title writes that byte while a submission declares the page unmarked and its shader writes another byte there. The snapshot comes from the mirror, which lacks the old byte. The pull after the submission brings the old byte in, so the merge takes it for this submission's write and puts it over the title's byte. On main, and on #3102 with
VICTORY_GPU_UPLOAD_WRITES=0, the snapshot already holds the old byte, so the title's byte stays.Tests:
h_an_old_unmarked_write_does_not_reach_title_memory_late_with_mirrorsfails.h_..._in_system_memory(VICTORY_GPU_UPLOAD_WRITES=0), passes.Output
How #2993 handles it (
477c6c6f):Shadow::writingbrings the range back from video memory before taking the snapshot, wherever no snapshot covers it yet. Tests:an_old_unmarked_write_does_not_reach_title_memory_late_at_2and_at_0. With a lazy mirror, the equivalent is forsnapshots_aheadto pull the whole declared range, not only its stale pages, before the snapshot. That costs one GPU copy per unmarked range.3. With
VICTORY_COPIES_IN_VIDEO_MEMORYset as well (diagnostics), the CPU sides go to GPU upload heapsWhere:
host.rs:4208. The diagnostics override inshared_mapped_bufferapplies to everyshared_buffer. That includes:shadow.rs:1541);None => mirror,shadow.rs:1555);shadow.rs:1090).What goes wrong:
UPLOAD_POOL's budget.freshencopies video memory into video memory.It affects diagnostics builds only.
Tests:
f_with_both_switches_the_cpu_sides_stay_in_system_memory_mirrorf_with_both_switches_the_cpu_sides_stay_in_system_memory_kept_copy(_WRITES=0, the same branch a copy the budget refuses takes)Output
(heap type, CPU page property): 5 =
GPU_UPLOAD, 4/3 =CUSTOM/WRITE_BACK.How #2993 handles it (
d2c20e28): while its switch is on,Host::system_bufferalways makes CPU sides in the CUSTOM write-back L0 heap, and the diagnostics override no longer applies to them. Test:with_both_switches_the_cpu_sides_stay_in_system_memory.4. A title write during a marked copy-back misses the copy (main's window, now on both sides)
Where:
shadow.rs:676-708. The copy-back reads title memory, merges, writes title memory,pushes the mirror, and then callstaken(:708). Nothing re-reads title memory after the page is guarded again.copy_back_or_not(:620-638) has the same order.What goes wrong. A title write to the page after the copy-back's read and before
takenreaches neither the mirror nor video memory.takenthen counts the page as current, so the next refresh copies 0 bytes, and the GPU keeps the old byte.Tests:
c_a_title_write_during_a_copy_back_reaches_video_memory_with_mirrorsfails._WRITES=0,c_..._in_system_memoryfails the same way. So this is main's existing window, not something #3102 adds. With mirrors it covers both sides.Output
How #2993 handles it (
80aac1c3): after taking the page,settlereads title memory into the system side once more, and only then writes video memory. Test:a_title_write_during_a_copy_back_reaches_video_memory. It is lower priority than 1–3 because main has the same window.Not confirmed
copy_queuedto write the mirror alone. #3102 doesn't contain #2051, so I couldn't test that directly.d_refreshes_of_mirrored_copies_reach_video_memorypasses: it checks the first refresh, a title write, and a write under a busy range, read back by GPU copy.d_a_write_of_the_mirror_alone_is_seen_by_read_host_not_the_gpuwrites the mirror by hand, ascopy_queuedwritesself.data.read_hostthen reports0xc1, while the GPU side still has0x28.gpu_bytes, or adebug_assert!(self.vram.is_none())incopy_queued, would catch it.#3102 and #2993 overlap: two designs for the same feature, and only one can merge. Which one is the maintainer's call. Whichever lands, we'd be glad to help port the fixes and tests above onto it.
The title was not used in these tests.
AI-assisted
@r4tedx on GitHub · 2026-11-26 09:09 UTC · original
Follow-up: I re-ran the tests from my earlier comment on the new head,
aab00070("title memory outside buffers is in video memory where written copies are").The tests are rebased onto it at
r4tedx/VIctory:repro/3102-findings-2(head5ae42265, tests only). That commit lets loose 4 MiB windows be mirrored, so I added loose-window variants of (e), (h) and (f) (copy_of(loose, ..)). The setup is unchanged: WARP,--features diagnostics --test-threads 1,VICTORY_GPU_UPLOAD=1 VICTORY_GPU_UPLOAD_WRITES=1in a child process, and every test printsgpu_upload_writes true. Yourshadow::tests pass with the two test-only hooks in place: 26 passed, 3 ignored.aab00070aab00070_WRITES=0) passestakenThe new cases come from the loose windows: until
63ab7631their copies were in system memory with no mirror, so findings 1 and 2 couldn't apply to them. Nowloosegoes throughcopy_buffer(len, false)(shadow.rs:1610), so they get the same mirror and the same paths. The window in the test (0x400000bytes) has write marks, and its results match a buffer's exactly.Output at
aab00070The
d_checks are unchanged:d_refreshes_of_mirrored_copies_reach_video_memorypasses, and the mirror-only write stand-in still showsread_host0xc1 against 0x28 on the GPU side.The title was not used in these tests.
AI-assisted
@0xKaji on GitHub · 2026-11-26 13:49 UTC · original
Tested on Linux (Wine 11.22 + DXVK + vkd3d-proton, RTX 3060 8 GiB with 8 GiB Resizable BAR, 16 GiB system RAM, GTA VI
--console series-s):DXVK vendor spoofing disables
writtenin VRAM by default: DXVK reports the RTX 3060 asvendor=0x1002(AMD), sohost copies of title buffers in GPU upload heapslogs:supported=true vendor=0x1002 read_only=true written=falseleaving ~3.9 GB of written host copies in system memory with ~4.0 GiB of local VRAM unused.
VICTORY_GPU_UPLOAD_WRITES=1uses VRAM, but system-memory mirrors still OOM 16 GiB hosts: ForcingVICTORY_GPU_UPLOAD_WRITES=1cleanly moves ~1.93 GiB into VRAM (localrose from3,469to5,399 MBof7,445 MBbudget,nvidia-smipeak5,902 MiB), confirmingGPU_UPLOADworks under vkd3d-proton. However, because written buffers keep a full system-memory mirror, GPU system memory only dropped from4,054to3,987 MBand process RSS stayed at14,360 MiB(OOMexit=137at 87s).VICTORY_IN_PLACE=1fallback on page-table activation: WithVICTORY_IN_PLACE=1, once title-memory page tables activate, 189 written buffers move back to copies (host copies: 4181 (4018.9 MB),15,206 MiBRSS → OOM at 88s). By comparison,#2112avoids those copies/mirrors and reachesframe=1716without OOM under the same 16 GiB setup.@potatoe0100 on GitHub · 2026-11-26 14:06 UTC · original
Benchmark on a narrower link than the 5070 Ti, since NVIDIA gets all copies in video memory by default: RTX 4060 8 GB (Ada, PCIe 4.0 x8, Resizable BAR on, driver 621.14), i5-13600KF, 32 GB, Windows 11 Pro 26300. Head
669f428,cargo test --release -p victory-gpu --lib --locked compute_heavy -- --ignored --nocapture. Each figure is the median of 3 runs (each the median of 5 submissions), in ms per submission. Synthetic only, no game files.The "16 MiB per submission" rows track their "none" rows within a few ms.
VICTORY_TEST_BENCH_LOOSE=1: system memory 159.2 / 144.0, all copies in video memory 99.5 / 52.4 (write marks / snapshots). Read-only copies in video memory give nothing there, and in place is skipped ("title memory does not open in place here").What differs from the 5070 Ti numbers:
mainby a wide margin here (−34% to −67%), so the PR helps this card a lot.docs/gpu-memory.md). My guess is the system-memory written-pages bitmap that the description mentions (marking about 9 of 11 GPU ms there): over an x8 link, the marks from written copies seem to cost more than video memory saves. #2175 / #2465 would test that.VICTORY_IN_PLACE=1opened on this discrete card. It sits between system memory and video memory, as on the 5070 Ti.So on x8 cards the NVIDIA default may want "written copies only with snapshots", or a link-width check. I haven't checked where the link width could be read from D3D12/DXGI. "Making buffers" was 94-110 ms with copies in video memory, against 17-19 in system memory, once per run.
AI-assisted (Claude)
@latentdev on GitHub · 2026-11-26 14:27 UTC · original
In the title on an RTX 4090: no gain while the views' bitmap is in system memory, then GPU time −65 %
The description notes that no title has been run yet, so here is one:
aab0007in the title on an NVIDIA card. In short, the written-pages bitmap your Limits section mentions decides the result here. While it stays in system memory, this PR changes almost nothing. Once it moves to video memory, this PR cuts GPU time by about two thirds.Setup
main63bcca4plus what this card needs to draw a lit world: #1630, #1832, #2332, #2178, #2121, #439, #2214, with the structure builder held back.¹ The 528 and the 178 were measured with
VICTORY_GPU_TIMING=1, which runs each list on its own. On this build that adds about a quarter: 178 with it, 141 without.Why this PR alone barely moves it.
shared_bufferin system memory, so each of them crosses the bus.deferred_tiled:CS_ResetTilesMask(a7eeed0646be1ab7, the clear #2958 measured at 20–41 ms on a 4070 SUPER) took about 1 s per dispatch;What moved it. I ported wbkepler's #2465 approach onto current main's two bitmaps, read marks included:
DEFAULT-heap UAV buffer;That alone took the GPU from 4.6 s to about 0.5 s per frame. Copies of title buffers in video memory then matter: this PR took it to about 0.15 s.
Same build, this PR's switch only.
VICTORY_GPU_UPLOAD=0gave a median of 1,016 ms on the GPU, against 141–178 ms with the default. That=0run ended early (9 samples), so treat it as a rough figure.No device removal attributable to this PR. Several runs ended in
0x887A0005with empty breadcrumbs. A memory monitor alongside showed the PC out of memory at that moment (commit 50.2 of a 50.5 GB limit, 0.7 GB RAM free). That happened withVICTORY_GPU_UPLOAD=0too, so it is this 31 GB machine and this tree, not the placement.Happy to rerun a newer head the same way.
@0xkn0wh3r3 on GitHub · 2026-11-26 17:58 UTC · original
Thanks for the careful repros. Findings 1–3 are fixed in
669f428a, with new tests of our own that cover buffers' copies and loose windows:copy_nownow returns whether it saw its fence reached on a live device. It doesn't reuse the allocator until the earlier fence is reached. When a copy fails,bring_backreads the pages through the CPU's mapping of video memory, so the mirror still gets the shaders' writes and the copy-back compares against them. Written copies made after a failure stay in system memory. Test:a_failed_copy_back_from_video_memory_loses_no_shader_writes(a marked page, a declared range and a loose window, with the mirrors stale).snapshots_aheadbrings the declared ranges back whole, not only their stale pages. On the 5070 Ti bench that costs about 2 ms per submission in the snapshot rows, which are still −47% against main. Test:an_earlier_undeclared_shader_write_does_not_reach_title_memory_late.VICTORY_COPIES_IN_VIDEO_MEMORYno longer overrides shared buffers. It now places read-only and written copies in video memory the way the placements do, with written copies keeping their mirrors, so mirrors, the marks bitmap and kept copies stay in CUSTOM write-back memory. Test:with_copies_in_video_memory_the_cpu_sides_stay_in_system_memory.Finding 4 is main's existing window, so I've listed it under Limits rather than fixing it here.
@zed6000 on GitHub · 2026-11-26 17:59 UTC · original
In the title on AMD (RX 7900 XTX): no gain in the intro, by default or with written copies in video memory.
Setup: RX 7900 XTX 24 GB (RDNA3, Resizable BAR; the startup line reports
supported=true vendor=0x1002), driver 32.0.32029.2010, Ryzen 9 7900X3D, 95 GB, Windows 11 26200. Base:main63bcca4+ the #1247 shader stack + #2703, which leave 0 dropped draws in this scene. This PR at669f428merged onto that base (clean). Diag build, Series X profile, warm caches,VICTORY_KEYSinto the intro cutscene. Medians of 36 frame-rate lines under 10 fps (about 3 minutes), the same method as my copy-PR table on #400.read_only=true written=false)VICTORY_GPU_UPLOAD_WRITES=1(written=true)written=falselooks right for this card.@0xkn0wh3r3 on GitHub · 2026-11-26 18:41 UTC · original
Thanks for running this in the title. It's the first run of #3102 outside synthetic tests. The RX 7900 XTX result matches the RX 9070 XT: written copies in video memory save GPU time, but the mirrors' copy-back costs more, so they stay NVIDIA-only by default. I've added your numbers to the description's results and limits.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.