Skip to content

D3D12.X: prepare for the unified memory copy path - #1326

Closed
vakaobr wants to merge 1 commit into
xcl-dev:mainfrom
vakaobr:uma/prepare
Closed

vakaobr wants to merge 1 commit into
xcl-dev:mainfrom
vakaobr:uma/prepare

Conversation

@vakaobr

@vakaobr vakaobr commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

First of four PRs that bring the unified memory copy path to main (Part of #258): helpers it needs, with no change in behaviour. D3DMetal answers E_NOTIMPL for OpenExistingHeapFromAddress, so on a Mac there is no GPU unified memory; the copy path (the fourth PR) gives the committed window a copy in video memory instead.

Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip ("Unified memory without OpenExistingHeapFromAddress: the committed window gets a copy in video memory"), which he handed over in #258 (comment). Rebased onto main 930e8b4 and split into four PRs.

What is in it

  • crates/xcl/src/gpu/uma.rs: Uma::shadowed (never set in this PR) and is_gpu_copy(p): a sparse window, or a committed one the GPU only has a copy of.
  • crates/xcl/src/hle/d3d12x/sparse.rs: new_state extracted from init, so the copy path can build the state without sparse windows; it keeps main's parked list and debug names.
  • crates/xcl/src/hle/d3d12x/list_x.rs: note_copy_into, which records PC copies into console buffers whose memory the GPU only has a copy of; it returns at once while shadowed is false.
  • crates/xcl/src/hle/d3d12x/real.rs: the places that asked is_sparse ask is_gpu_copy, which is the same thing while shadowed is false.

Tested

  • MacBook Pro M5 Pro (20-core GPU), 48 GB, macOS 27.2.1, CrossOver 26.3.0.39832 with D3DMetal 3.0 ("AMD Compatibility Mode"), Rosetta 2. Rust 1.100.0, x86_64-pc-windows-gnu (mingw-w64 GCC 16.2.0), debug, DXC 1.9.2609. Each test in its own process (<test exe> --exact <test> --test-threads=1 --nocapture).
  • Head 3dd994a: the seven UMA tests that fail on main on this host fail the same way, at the same lines (gpu_uma_import_check_at_init, gpu_unified_memory_arena, gpu_memory_windows_above_4_gib, gpu_mesh_mode_reads_memory_windows, gpu_bvh64_intersect_ray_across_memory_windows_and_grazing, gpu_memory_windows_reject_out_of_uma_aliasing, gpu_sparse_vram_descriptors_buffers_and_xmem), and the list_x and vram tests I sampled still pass.
  • Independent runs at this head: NVIDIA RTX 5070 Ti and the AMD Radeon iGPU of a Ryzen 9800X3D (RDNA2), Windows 11, debug, cargo test --workspace -- --test-threads=4: 751 passed, 0 failed, 41 ignored on both (@futurepro62, D3D12.X: prepare for the unified memory copy path #1326 (comment)); AMD RX 9070 XT (RDNA4), Windows 11, release: 751 passed, 0 failed, 41 ignored, with the seven UMA tests passing natively (@eizispark, D3D12.X: prepare for the unified memory copy path #1326 (comment)).

Regression run

This changes runtime files, so it needs an xcl-smoke pair from someone with a title; I have none. Nothing in it is reached while shadowed is false.

Not tested

  • The whole suite on Windows by me (see the independent runs above), and a release build.

AI use

  • Claude Code with Claude Opus 4.6 ported c70bf8a onto main and split it. Claude Code with Claude Opus 5.5 reviewed the slices, ran the tests above on this machine and wrote this description.

Helpers for the copy path that changes no behaviour yet:

- sparse.rs: extract new_state from the inline closure in init, so
  shadow_window (next commit) can call it when no sparse windows exist
- uma.rs: Uma::shadowed flag and is_gpu_copy(p): a sparse window or a
  committed one the GPU has a copy of. Never set to true in this commit.
- list_x.rs: note_copy_into tracks PC copies into console buffers whose
  memory the GPU has a copy of; note_write uses is_gpu_copy
- real.rs: uma_shadowed helper, res_map and dev_create_placed_resource_x
  use is_gpu_copy (= is_sparse while shadowed is false)

Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip.

Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com>
Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed it)
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 3dd994a (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 751 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 751 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@eizispark

Copy link
Copy Markdown
Contributor

Hardware test report — commit 3dd994a

Verified clean merge with main (930e8b4) on 3dd994adb78c2b758d07866632083d261c3e8871: pass.

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 751 passed, 0 failed, 41 ignored (GPU tests skipped on this adapter: none)
  • All 7 UMA, sparse, and BVH GPU tests that could not run on D3DMetal passed natively on Windows D3D12 (gpu_uma_import_check_at_init, gpu_unified_memory_arena, gpu_memory_windows_above_4_gib, gpu_mesh_mode_reads_memory_windows, gpu_bvh64_intersect_ray_across_memory_windows_and_grazing, gpu_memory_windows_reject_out_of_uma_aliasing, gpu_sparse_vram_descriptors_buffers_and_xmem)

Regression run
main (930e8b4):

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1667 (PresentX 1667)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 14861 MB

PR (3dd994a):

xcl-smoke v1
commit: 3dd994adb78c2b758d07866632083d261c3e8871
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1679 (PresentX 1679)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14730 MB

Not tested

  • wave32-only GPUs (NVIDIA / Intel); retail run under XCL_D3D12_DEBUG=1; gameplay past the menus

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) — ran the workspace test suite and 60 s retail smoke check and formatted this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 707-709 passed, 0 failed, 21 ignored.

Thanks!

@Kalmarv

Kalmarv commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Regression pair for 3dd994a against main 930e8b4 (this PR's base), for the Regression run section. Both runs pass: no device removal, no crash, 101 % of main's frames, 94 % of its peak commit.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200.
  • scripts/smoke.ps1, the same retail title for 60 s each: main at 930e8b4 (this PR's base) first, then this PR's head, one after the other on the same machine.

main 930e8b4:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1308 (PresentX 1308)
presents per 2 s (last 3): 35 56 12
device removals: 0
crashes: 0
peak commit: 27996 MB

this PR, 3dd994a:

xcl-smoke v1
commit: 3dd994adb78c2b758d07866632083d261c3e8871
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1324 (PresentX 1324)
presents per 2 s (last 3): 44 34 47
device removals: 0
crashes: 0
peak commit: 26363 MB

Not tested

  • The copy path itself: shadowed is never set in this PR, so the run only shows no regression.
  • World loading: a 60 s run ends before it.
  • The test suite (futurepro62's and eizispark's runs above cover it), AMD, Linux, macOS.

AI use: Claude Code (Claude Opus 5.5)

@JoaoPauluu

Copy link
Copy Markdown

A regression run under Wine on Linux, on a retail title.

Tested

Regression run

main (first run):

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1371 (PresentX 1371)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: 3dd994adb78c2b758d07866632083d261c3e8871
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1401 (PresentX 1401)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1338 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified main.)

Thanks!

@github-actions

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 27, 2026
@vakaobr

vakaobr commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Closing: its commit is in main through #1329 (merged 28 Nov), patch for patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants