D3D12.X: CopyMemoryToMemoryX from the title's own memory into unified memory is dropped #319
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#319
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@emirduran707 on GitHub · 2026-11-23 23:14 UTC · original
CopyMemoryToMemoryX(#60) is dropped when its source is the title's own CPU memory and its destination is in unified memory:copy_memory_xonly 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 from9ab7d76to4017f8flogged it; 0 of 2 on21b8723(after #252 / #283), so whether it still happens on currentmainis not settled yet:The coherent window is at
0x400000000(4095 MB) in that run;0x729ffd900is in the sparse windows,0x1fe7f080000is 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.ExecuteCommandListsandKickoffX), the latest moment the title's data can be there; keep the buffers alive until the queue's fence (thecpu_writesworker).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.
@emirduran707 on GitHub · 2026-11-23 23:32 UTC · original
Update: on current
mainthis no longer shows at the first menu.9ab7d76…4017f8f21b8723,85bdf21(after #252 / #283)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, on85bdf21, +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 on GitHub · 2026-11-24 01:01 UTC · original
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.
@ivall on GitHub · 2026-11-24 11:03 UTC · original
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.