D3D12.X: stage GPU-view CopyMemoryToMemoryX sources and shift newer CL1 remaps #1995
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!1995
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1995"
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?
@raylitebull on GitHub · 2026-11-25 00:29 UTC · original
raylitebull:feat/world-frame-list-slots→main· +211 −42 · 3 files · 1 commits · openStages GPU-view
CopyMemoryToMemoryXsource ranges (kernelx::mirrors::source_range,resolve_readable_source,list_x::MIRRORS) and shifts vacated older CL1 command-list remap slots104/105to console-extension stubs whenQUEUE_SHIFTED == true.Part of #1833.
What is in it
crates/xcl/src/hle/kernelx.rs: addmirrors::source_range(va, len)enforcing(va - gpu) + len <= sizeend-of-range bounds on GPU mirror reservations (preserved alongside#1985'smirrors::gpu_views_of).crates/xcl/src/hle/d3d12x/list_x.rs: routecopy_memory_x(saturating_addoverlap check) throughresolve_readable_source, and keylist_x::MIRRORSby(title_start, cpu_src_start, len, uma_mirror)so repeatedgpu_vabinds hitmirrored(va, bytes)directly with zero per-drawVirtualQuerywhilesync_title_buffersreads fromcpu_src_start.crates/xcl/src/hle/d3d12x/real.rs: route vacated older CL1 slots104/105to console-extension stubs whenQUEUE_SHIFTED == trueand add unit testsresolve_readable_source_accepts_direct_and_rejects_unmappedandnewer_cl1_slots_shift_older_cl1_remaps_by_two.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly ontof368928(bdfb2fb).cargo check --workspace --tests: passed onbdfb2fb.cargo test -p xcl --lib resolve_readable_source_accepts_direct_and_rejects_unmapped: passed onbdfb2fb.cargo test -p xcl --lib newer_cl1_slots_shift_older_cl1_remaps_by_two: passed onbdfb2fb.50ef7dc): verified across AMD Radeon RX 9070 (1635/1623frames, 0 device removals/crashes,@Toons29), NVIDIA RTX 3060 Ti, and Intel Arc A770.Regression run
bdfb2fb1by@Toons29(AMD Radeon RX 9070, 60 s retail title smoke vs1a0bbe3a):0device removals,0crashes,1628 -> 1627frames (100%),14561 -> 14598 MBpeak commit (100%).Not tested
scripts/smoke.ps1pair on rebased headbdfb2fb, fullcargo test --workspacesuite, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use
f368928, and unit tests; the author reviewed the diff and test output.@eizispark on GitHub · 2026-11-25 00:41 UTC · original
Hardware test report — commit
3fcc982@raylitebull Verified
3fcc9822e736b4e616d22d3f18140957a2952667on AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64): pass, with the 60 sxcl-smokepair against ancestormain(8e87fc7).Tested
32.0.32015.16001), 32 GB RAM,rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smokecargo test --workspace --no-fail-fast -- --test-threads=4:997 passed, 2 failed, 45 ignored(8 skipped), with0new failures:hle::d3d12x::list_x::tests::resolve_readable_source_accepts_direct_and_rejects_unmapped,hle::d3d12x::real::map_tests::newer_cl1_slots_shift_older_cl1_remaps_by_two) and alld3d12x,list_x, ande2e(test_title_runs_and_game_folder_is_untouched) GPU tests passed#1679AMD fuzz seeds failed (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3seed 1599)8 skipped: 6gpu::recomp::lower_dxil::testsf16/f32 direct-DXIL per-lane cases refused where#1426semantics differ from the console's;shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode required,0x887A002D);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsCopyMemoryToMemoryX stagedfired0times during the unattended 60 s boot/menu window (0unmappedCopyMemoryToMemoryXwarnings logged there either; the unattended smoke run stops in menus before entering the 3D world)Regression run (
scripts/smoke.ps1, 60 s, warm shader/driver cache)main(8e87fc7b62a87ea589ccb9ea6182f514016cf7db):PR (
3fcc9822e736b4e616d22d3f18140957a2952667):Not tested
CopyMemoryToMemoryXsources and newer-layoutResolveSubresourceRegion(#110) executeAI use
@raylitebull on GitHub · 2026-11-25 00:43 UTC · original
@eizispark Thank you for the RX 9070 XT verification (997 passed,
@gsucristo on GitHub · 2026-11-25 00:57 UTC · original
Technical review findings:
Major
list_x.rs,resolve_readable_source):kernelx::mirrors::source(va)only checksva < gpu + sizefor the start address, not that[va, va + len)stays within the GPU mirror reservation ((va - gpu) + len <= size). If a copy spans past the end of the mirror reservation and another readable CPU allocation sits adjacent to the CPU backing view,readable(cpu, len)succeeds andcopy_nonoverlappingreads out-of-bounds memory.VirtualQueryregression ingpu_vafor GPU-view buffers (list_x.rs,gpu_va): Whenvais a GPU view (src_va != va),mirror_of(src_va, bytes, what)registers the mirror undersrc_va, notva. Subsequent binds ofvamissmirrored(va, bytes)and fall through toresolve_readable_source(twoVirtualQuerywalks +mirrorslock) on every draw.Minor
dst < effective_src + size && effective_src < dst + sizeincopy_memory_xcan overflow on hugesize(preferchecked_add/saturating_add).QUEUE_SHIFTED == true, older CL1 slots104/105stay mapped to PC60/61(AtomicCopyBufferUINT/UINT64) instead of being unmapped/stubbed.@raylitebull on GitHub · 2026-11-25 01:15 UTC · original
Thanks for the careful review and catches,
@gsucristo!Updated
#1995cleanly onto0f293be(50ef7dc):kernelx.rs): addedmirrors::source_range(va, len)enforcing(va - gpu) + len <= sizeinsideresolve_readable_sourceso reads crossing the end of a GPU mirror reservation are rejected.list_x::MIRRORSkeyed bycpu_src_start(list_x.rs): changed theMIRRORScache value to track(title_start, cpu_src_start, len, uma_mirror)so repeatedgpu_vabinds of GPU-view buffers hitmirrored(va, bytes)directly with zero per-drawVirtualQuerywhilesync_title_buffersreads fromcpu_src_start.saturating_add& vacated CL1 slots (list_x.rs,real.rs): switchedcopy_memory_x's overlap check tosaturating_add, and routed vacated older CL1 slots104/105to console-extension stubs whenQUEUE_SHIFTED == true.Verified locally (
cargo check --workspace --tests+resolve_readable_source_accepts_direct_and_rejects_unmapped+newer_cl1_slots_shift_older_cl1_remaps_by_two:2 passed, 0 failed).@Anon64 on GitHub · 2026-11-25 01:47 UTC · original
Regression run for this PR: head
3fcc982, based onmain80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
80f4819:this PR:
No device removals or crashes; 101 % of main's frames, 93 % of its peak commit.
Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings:
XCL_DIRECT_DXILandXCL_HEAP_WINDOWSunset).Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@JJAutoCompare on GitHub · 2026-11-25 02:49 UTC · original
Empirical verification — PR #1995 (
50ef7dcbb6300119933dade417edf88cca64e055)Tested clean detached PR head
50ef7dcbb6300119933dade417edf88cca64e055on STOR-WINLAB.Environment
26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver32.0.101.9175, wave range 8–32,DoublePrecisionFloatShaderOps=0,d3d12SDKLayers.dllabsent).rustc 1.100.0 (0ef1bc386 2026-11-09)(CARGO_INCREMENTAL=0, debug info 0). Standalone DXC/DXIL1.9.2609.5was onPATH; the test title logged Windows SDK DXC1.9.2602.17(21d28f72).Tested
cargo build --workspaceandcargo test --workspace --no-runexited 0 outside the GPU lock.cargo test -p xcl --lib <name> -- --nocapture): 3 passed, 0 failed, 0 ignored, 0 skipped (all 3 also passed in full suite):resolve_readable_source_accepts_direct_and_rejects_unmappednewer_cl1_slots_shift_older_cl1_remaps_by_twolayout_split_keeps_the_runtime_on_the_pc_methodCopyMemoryToMemoryXscratch copy.cargo test --workspace --no-fail-fast -- --test-threads=4(underInvoke-ArcTest.ps1, exited 101): 1,041 passed, 26 failed, 45 ignored across 20 test harnesses, with 23SKIPPEDlines across 13 tests (excluded from coverage; 18 wave64, 3 refused wave32 f16 lowerings, 1 driver-cache disable0x887A002D, 1 heap-window fallback; missing debug-layer early return captured separately).xcl --libnative D3D12 shader tests (21CreateComputePipelineState0x80070057+ 4 shader output assertions) and 1 ine2e(test_title_runs_and_game_folder_is_untouched,RSSetDepthBiasX#94 blue vs green). Re-runningtest_title_runs_and_game_folder_is_untouchedon parent commit0f293bec8fd53b1478328627a1f08a6155dd2813under the same Arc lock reproduced the identical depth-bias failure, confirming it predates PR #1995.Not tested
scripts/smoke.ps1, D3D12 debug layer, live GPU-view reservation copy / vertex-index refresh, and title dispatch through shifted CL1 slots.AI use
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1995-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 03:42 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@raylitebull on GitHub · 2026-11-25 10:38 UTC · original
Thanks @Toons29 for running and sharing the exact-head 60 s
scripts/smoke.ps1pair on50ef7dc(0 device removals, 0 crashes) — added to the PR description!@raylitebull on GitHub · 2026-11-25 10:44 UTC · original
Rebased
#1995cleanly ontof368928in commitbdfb2fb:crates/xcl/src/hle/kernelx.rsadjacency conflict cleanly alongside#1985(mirrors::gpu_views_of+mirrors::source_rangeside-by-side insidekernelx::mirrors).cargo check --workspace --tests,resolve_readable_source_accepts_direct_and_rejects_unmapped, andnewer_cl1_slots_shift_older_cl1_remaps_by_twodirectly onbdfb2fb.@Toons29 on GitHub · 2026-11-25 03:47 UTC · original · edited 2026-11-25 15:29 UTC
Regression run of
bdfb2fb1on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon1a0bbe3a, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; both blocks are exactly as printed, and I approved posting this.@raylitebull on GitHub · 2026-11-25 18:15 UTC · original
Thanks @Toons29 for running and sharing the exact-head 60 s
scripts/smoke.ps1pair onbdfb2fb1(0device removals,0crashes,1628 -> 1627frames) — absorbed into the PR description!@pickles976 on GitHub · 2026-11-25 18:41 UTC · original · edited 2026-11-25 19:04 UTC
Tested an adapted integration of this PR on Linux/Wine with vkd3d-proton and an RTX 4060 Laptop GPU (8 GiB), using the GTA VI Xbox 1.0.2.1 title through its initial world-load path. The integration also contains #877 and the Wine native-vtable changes from closed #1395, which this title currently needs to boot with stock assert-enabled vkd3d-proton.
Build/tests:
hle::d3d12x::list_x::tests::resolve_readable_source_accepts_direct_and_rejects_unmapped: passedhle::d3d12x::real::map_tests::newer_cl1_slots_shift_older_cl1_remaps_by_two: passedRuntime result: the title reached illustrated loading screens and sustained 29.8 fps over the last 300 presents before my 7.5 GiB VRAM safety guard terminated it. DirectStorage reported 0 failed requests and there was no crash/device removal. However, the real 16 KiB operation this was intended to cover still took the fallback, not the new staging path:
Correction after source review: the absence of a staged-copy log does not prove
resolve_readable_sourcereturnedNone. Staging is gated bydst_uma.is_some()first. The destination0x3d5be890is below the logged UMA base0x400000000, so this observed call does not establish coverage of the PR’s GPU-source resolver. The failing copy also needs a non-UMA destination path; my earlier inference blaming source readability was unsupported.The control also reached this fallback. These results verify build/unit tests and boot/loading regression only, not successful GPU-view staging or playable gameplay. AI-assisted test and source review.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@Oliwettoo on GitHub · 2026-11-25 22:15 UTC · original
Review on
bdfb2fb(read from the diff, not built or run). The end-of-range fix and the(title, cpu_src, len, mirror)re-keying look right to me; two points not raised above:copy_memory_xruns while the title records the list, and copiessrc_cpuinto upload memory right then; on the console,CopyMemoryToMemoryXreads its source when the GPU executes it. If the title (or earlier GPU work in the same submission) writes that source betweenCopyMemoryToMemoryXandExecuteCommandLists, the destination gets the old bytes.gpu_vaalready binds "a copy made now", so there is precedent, but for an explicit copy command it's a semantic change worth stating in the description, or the CPU copy could be deferred to submit (the waysync_title_buffersrefreshes mirrors before a draw).apply_newer_cl1_remaps) can be reviewed, tested and reverted independently; CONTRIBUTING asks for one logical change per PR.@Oliwettoo on GitHub · 2026-11-25 22:34 UTC · original
Heads-up for whichever of these merges second: #1995 and #2478 (stacked on #2437) both rewrite the per-draw mirror sync in
list_x.rs, andgit merge-treereports a conflict between their heads. Beyond the text conflict:MIRRORS(title_start, cpu_src_start, len, mirror), so a mirror of a GPU-view address copies from its CPU backing.mirror_sources, theGetWriteWatchinwritten_pages,MIRROR_STALE) works on the title address.Combined as they are, a GPU-view mirror's
GetWriteWatchfails, so the draw copies the whole range every time. That stays correct, but it loses #2478's saving for exactly the buffers #1995 adds. Switching the write-watch and stale-page lookups tocpu_src_startwhen resolving would keep both. (Read from the diffs a6ec51e /bdfb2fb, not run.)@DavidM1911 on GitHub · 2026-11-26 06:51 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: 1 failure under parallel scheduling; clean on--test-threads=1rerun (1307 passed, 0 failed, 27 ignored, 78s). Intermittent single-test flake — tracked in #1978.Thanks!
— Devin
@luckyteagirl on GitHub · 2026-11-26 09:03 UTC · original · reviewed
On
bdfb2fb, a GPU-view address can retain the wrong CPU backing after release and reuse.gpu_vareturns an existingmirrored(va, bytes)entry before callingresolve_readable_source;MIRRORSrecords the original(title_start, cpu_src_start, ...)and is not invalidated bykernelx::mirrors::released, which only removes the reservation mapping.For example, reserve GPU view B paired with CPU view A1, bind B once, release B, then reserve B again paired with a newer CPU view A2. A subsequent bind of B finds the old mirror, and
sync_title_buffersrefreshes it from A1 (or leaves prior bytes if A1 is no longer readable), rather than A2. The new title address is valid but draws can use stale vertex/index data. The fresh reservation lookup used byCopyMemoryToMemoryXdoes not prevent this draw path.Could the cached entry be checked against the current reservation identity before reuse, or invalidated/replaced when the GPU-view mapping changes? A focused release-and-rebind fixture with different bytes in A1 and A2 would cover it. I reviewed source only; I did not run a title or GPU repro.
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.