You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D3D12.X: CopyMemoryToMemoryX from the title's own memory into unified memory is dropped #319
CopyMemoryToMemoryX (#60) is dropped when its source is the title's own CPU memory and its destination is in unified memory: copy_memory_x only copies when both ends are in a UMA window.
Seen: a retail title (RX 9060 XT, XCL_NETWORK=0), once per run, ~26–48 s in, while DirectStorage loads. Not every run: 7 of 14 runs on builds from 9ab7d76 to 4017f8f logged it; 0 of 2 on 21b8723 (after #252 / #283), so whether it still happens on current main is not settled yet:
D3D12.X: CopyMemoryToMemoryX: 0x1fe7f080000 → 0x729ffd900 (0x4000 bytes) is not in unified memory – not done
The coherent window is at 0x400000000 (4095 MB) in that run; 0x729ffd900 is in the sparse windows, 0x1fe7f080000 is plain committed memory of the title. So the GPU copy of 16 KiB from CPU memory into GPU memory never happens. What the title uses that memory for is not known yet.
Plan (one small PR, test first):
copy_memory_x: source outside the windows but CPU-readable, destination in a window → record the copy from an upload buffer of the list's, with the destination's usual transitions.
Fill those upload buffers from the source right before the list is submitted (ExecuteCommandLists and KickoffX), the latest moment the title's data can be there; keep the buffers alive until the queue's fence (the cpu_writes worker).
Test: the test title copies from its heap into its graphics memory, writing the heap after recording and before submitting.
The other directions (destination outside the windows) stay as they are.
AI-assisted: Claude Code (Claude Opus 5.5) found this in my run's log and wrote this issue.
Same title, RX 9060 XT, scripts/smoke.ps1 (60 s, XCL_NETWORK=0, no input, so the title stays at its first menu). My guess is that #252 or #283 changed what the title does up to there; I have not checked which, nor whether the copy comes back past the menus.
So I am not opening a PR for it now. The fix is ready if it shows up again: emirduran707:copy-from-title-memory (33adeb5, on 85bdf21, +120 lines). It does what the plan above says; the test title's new check (copy from its heap, written after recording) fails on main and passes with it, and cargo test --workspace -- --test-threads=4 gives 665 passed, 0 failed, 41 ignored, no SKIPPED, on the RX 9060 XT. It logs CopyMemoryToMemoryX from memory outside unified memory goes through an upload buffer… once when the path is taken.
AI-assisted: Claude Code (Claude Opus 5.5) made the runs' counts and wrote this comment.
I hit the same shape of problem and want to check the intended fix before writing one, because the obvious one is wrong.
copy_memory_x (crates/xcl/src/hle/d3d12x/list_x.rs:971) requires both ends in a UMA window:
let(Some((d, doff)),Some((s, soff))) = (
real::uma_window_buffer(dst asusize, size asusize),
real::uma_window_buffer(src asusize, size asusize),)else{note_gpu_write("CopyMemoryToMemoryX", dst asusize, size);returnwarn(&N,W,format_args!("{src:#x} -> {dst:#x} ({size:#x} bytes) is not in unified memory"));};
With the source in the title's own CPU memory the whole command is dropped, which is #319.
The tempting fix is a CPU copy_nonoverlapping straight into the destination, since the windows are the title's coherent memory and dst is already a CPU-visible address. I do not think that is correct here: command lists recorded by console code can be replayed, so a copy performed while recording would read the source as it was at record time, not at execution time.
So the fix I would propose, unless you would rather do it another way:
when src is not in a window, copy size bytes out of src into an upload-heap buffer at record time (a small staging pool, like PATTERNS for fills);
emit the GPU copy from that staging buffer to the destination window, which is the path that already exists;
keep note_gpu_write/note_write where they are now, so the tracking stays the same.
Two questions:
is a record-time staging copy the intended answer, or is the source expected to stay valid until execution in every case you have seen?
is the staging buffer allowed to be one size-sized allocation per call (freed when the list is reset), or should it come out of the same bounded pool as pattern_buffer?
I have no copy of the game, so I cannot reproduce it here; I can write the unit test (window plus a source outside any window, checking that the destination bytes arrive after execution) once the direction is clear.
Closing for now: the reported dropped copy did not recur in five later first-menu runs. This does not rule it out beyond the menus; please reopen if it recurs.
Activity
emirduran707 commentedon Nov 23, 2026
Update: on current
mainthis no longer shows at the first menu.Same title, RX 9060 XT,
scripts/smoke.ps1(60 s,XCL_NETWORK=0, no input, so the title stays at its first menu). My guess is that #252 or #283 changed what the title does up to there; I have not checked which, nor whether the copy comes back past the menus.So I am not opening a PR for it now. The fix is ready if it shows up again:
emirduran707:copy-from-title-memory(33adeb5, on 85bdf21, +120 lines). It does what the plan above says; the test title's new check (copy from its heap, written after recording) fails onmainand passes with it, andcargo test --workspace -- --test-threads=4gives 665 passed, 0 failed, 41 ignored, noSKIPPED, on the RX 9060 XT. It logsCopyMemoryToMemoryX from memory outside unified memory goes through an upload buffer…once when the path is taken.AI-assisted: Claude Code (Claude Opus 5.5) made the runs' counts and wrote this comment.
Luislariosss commentedon Nov 24, 2026
I hit the same shape of problem and want to check the intended fix before writing one, because the obvious one is wrong.
copy_memory_x(crates/xcl/src/hle/d3d12x/list_x.rs:971) requires both ends in a UMA window:With the source in the title's own CPU memory the whole command is dropped, which is #319.
The tempting fix is a CPU
copy_nonoverlappingstraight into the destination, since the windows are the title's coherent memory anddstis already a CPU-visible address. I do not think that is correct here: command lists recorded by console code can be replayed, so a copy performed while recording would read the source as it was at record time, not at execution time.So the fix I would propose, unless you would rather do it another way:
srcis not in a window, copysizebytes out ofsrcinto an upload-heap buffer at record time (a small staging pool, likePATTERNSfor fills);note_gpu_write/note_writewhere they are now, so the tracking stays the same.Two questions:
size-sized allocation per call (freed when the list is reset), or should it come out of the same bounded pool aspattern_buffer?I have no copy of the game, so I cannot reproduce it here; I can write the unit test (window plus a source outside any window, checking that the destination bytes arrive after execution) once the direction is clear.
AI-assisted.
D3D12.X: CopyMemoryToMemoryX with neither end in unified memory is do…
D3D12.X: copy from the backing pages of GPU-only views
D3D12.X: copy from the backing pages of GPU-only views
ivall commentedon Nov 24, 2026
Closing for now: the reported dropped copy did not recur in five later first-menu runs. This does not rule it out beyond the menus; please reopen if it recurs.
D3D12.X: copy from the backing pages of GPU-only views
D3D12.X: copy from the backing pages of GPU-only views
D3D12.X: copy from the backing pages of GPU-only views