D3D12.X: stage CopyMemoryToMemoryX from title memory via upload buffers #473
No reviewers
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!473
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-473"
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?
@7ROBE on GitHub · 2026-11-24 00:48 UTC · original
7ROBE:fix/copy-memory-from-title→main· +110 −22 · 4 files · 1 commits · openWhat is in it
Fixes #319. When
CopyMemoryToMemoryXcopies from title CPU memory outside unified memory (crate::gpu::shader::readable) into a unified memory window,copy_memory_xnow recordsCopyBufferRegionfrom a per-list persistently mappedD3D12_HEAP_TYPE_UPLOADbuffer (sharingcreate_mapped_uploadwithpattern_buffer), copies fromsrcinto the upload buffer right before submission (ExecuteCommandListsandKickoffX), and keeps the upload buffer alive until the queue's fence completes viacpu_writes::Write::KeepAlive. Adds test cases intests/testtitle/src/gpu.rs(console_list_methods) writing to the title heap after recording and before bothExecuteCommandListsandKickoffX.Regression run
Main (
2997c9aca6ebf4577fed34ebdb3cb0a77dd9ec21):PR head (
388cf3baec605cef572f6966cb1b34b07fc655fb):Tested
cargo test --workspace -- --test-threads=4on Windows 11 Pro (26H2), Intel Core i5-14600KF, AMD Radeon RX 9060 XT (Adrenalin 26.11.2,XCL_ADAPTER=radeon): 676 passed, 0 failed, 41 ignored (SKIPPED: none). Includestest_title_runs_and_game_folder_is_untouchedexercisingCopyMemoryToMemoryXfrom title heap into graphics memory on bothExecuteCommandListsandKickoffX.Not tested
Linux / Wine / NVIDIA / Intel GPU paths.
AI use
AI-assisted: Antigravity (Gemini 3.1 Pro). Human reviewed and ran tests and smoke runs on Windows 11 Pro + Intel Core i5-14600KF + AMD Radeon RX 9060 XT (26.11.2).
@Icey-Glitch on GitHub · 2026-11-24 01:02 UTC · original
High: upload buffer is refilled while an earlier submission may still read it (reviewed at
388cf3b)fill_uploads(crates/xcl/src/hle/d3d12x/list_x.rs:944) copiessrcinto eachPendingUpload'smappedpointer on everyExecuteCommandLists. Becausepending_uploadsis intentionally kept after submission (a closed list may be executed again), a second execution of the same list writes into the same mapped buffer with no fence check. If the first submission'sCopyBufferRegionhasn't run yet, it copies the second snapshot.Scenario: the title executes list L, updates the source CPU memory, then executes L again on the same or another queue. The first execution's copy can land the second execution's data, or a torn mix of both.
Possible fixes: allocate (or pool) a fresh upload buffer per submission, or wait on or check the previous submission's fence before refilling.
Related (perf): each
CopyMemoryToMemoryXfrom title memory callscreate_mapped_upload(list_x.rs:1020), so each copy creates its own committed resource (at least 64 KB) on the recording thread. A per-list or pooled buffer, as the description says, would address both issues. The description currently says "a per-list persistently mapped upload buffer", but the code creates one buffer per copy.@H0UNDZER0 on GitHub · 2026-11-24 01:32 UTC · original · edited 2026-11-24 02:20 UTC
Tested on an RTX 5080: pass, the same counts as
main, and the test title's new copies take the new path.388cf3baec605cef572f6966cb1b34b07fc655fb, this PR's head as is (on its base2997c9a), release build.XCL_*variables set.cargo build --release --workspace --locked: OK, the same singlefetch_updatewarning asmain.cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with--show-output): 676 passed, 0 failed, 41 ignored both times, the same asmain2997c9aon this PC.SKIPPED: the usual 2,gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).e2e):[PASS] D3D12.X: console command list memory methods (…), the check that holds the two new copies. 50[PASS], 0[FAIL],failures: 0. XCL logsCopyMemoryToMemoryX from memory outside unified memory goes through an upload buffer (0x40 bytes), so the copies went through the new path on this GPU.test_title_draws_with_a_root_signature_under_the_debug_layerpasses. The test title logs the same 5 errors and 9 warnings asmain's on this PC, none new. The only difference is in the live-object report at exit: the device's reference count is 123, against 122 onmain.Not tested
main. At the time of the run that was7ebf1b8;git merge-treeshowed no conflict with it.scripts/smoke.ps1.AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)
@DavidM1911 on GitHub · 2026-11-25 14:05 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.