Skip to content

D3D12.X: ~43x FPS over main on Series X (0.58 -> 25.3 fps, ~7x over #2844): XCL_UMA_DRIVER=mixed keeps part of the coherent window in VRAM - #2938

Draft
Kalmarv wants to merge 8 commits into
xcl-dev:mainfrom
Kalmarv:uma-mixed-window
Draft

Kalmarv wants to merge 8 commits into
xcl-dev:mainfrom
Kalmarv:uma-mixed-window

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2844, #2926, #2936, #2937 and #2934; only the top commit (9f99282) belongs here. The others are in the head so that it reproduces the measured tree.

With XCL_UMA_DRIVER=mixed:<start_mb>:<size_mb>[,...] the coherent window becomes several driver heaps instead of #2844's one CUSTOM heap: each listed range a GPU_UPLOAD heap (video memory the CPU writes through the BAR; on NVIDIA it stays in video memory up to 2 GiB) and the rest CUSTOM write-back L0 heaps. Each segment's CPU mapping lands at its place in the window (every slot reserved first, the rest of the address space groomed as #2844 does), and one reserved buffer over the window maps its 64 KiB tiles onto the segments' heaps, so shaders and placed resources still see one window.

Headline (RTX 5070 Ti, Series X profile, same title, timed runs alone; fps over 187-229 s / 107-223 s)

tree env 187-229 s 107-223 s
main 8b957be plain 0.58 1.12
#2844 (fc007a9) plain 3.71 3.00
this stack (TX1) XCL_UMA_DRIVER=mixed:1536:1792 XCL_WATCH_TRAP=1 XCL_DECLARED_LDS=1 XCL_BYTE_STORE_CS=e166372fa54a77c7 XCL_TEXTURE_LEVEL_PAGES=1 XCL_PARK_SPARES=1 25.28 20.31
older base, mixed window (CB2m3) as TX1 without XCL_PARK_SPARES and without the look-walk 24.15 16.05
older base, one CUSTOM heap (CB2) as CB2m3 with XCL_UMA_DRIVER=custom 11.99 9.32

What is in it (9f99282)

  • uma_driver.rs: mixed: parsing (parse_mixed, and decide takes it as on), build_segments, remake_window (the mixed remake or D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844's), remake_mixed, and the reader of the GPU_UPLOAD segments (read_vram_bytes: a copy on the COPY queue into a readback buffer, as CPU reads of that memory through the BAR ran at 12-84 MiB/s).
  • The CUSTOM segments are write-watched as D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844's heap is; a segment that refuses it fails the remake, which restores the window and keeps the import. The GPU_UPLOAD segments are not write-watched: their write-combined pages refuse the watch trap's read-only protection. Uma::watch_regions lists only the watched segments (gpu/uma.rs).
  • No Resizable BAR: remake_window asks D3D12_OPTIONS16.GPUUploadHeapSupported before the window is released, and without it mixed falls back to D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844's single CUSTOM heap (a warning in the log). A GPU_UPLOAD segment refused anyway becomes a write-watched CUSTOM segment in its place. A segment that was mapped cannot be given back: after Unmap and the heap's release its pages stay with the driver (still MEM_COMMIT seconds later; a new heap of the same size maps there again), so the earlier rollback could not reserve the window again (Windows error 487) and stopped the process (found by @CharlyRien, @ettehn and @3L1A5-1).
  • A window that cannot be made again at its address after a failure stops the process, as D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844's remake does.
  • real.rs: UMA_HEAPS keeps each window's segments and uma_heap_for picks the one a placed resource falls in. title_textures.rs: with_title_bytes reads GPU_UPLOAD segments through read_vram_bytes.
  • Tests: mixed_ranges_parse_in_order, mixed_segments_cover_the_window, the GPU test mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment (the title's bytes survive in every segment, the GPU reads later CPU writes to each segment through the one buffer, read_vram_bytes reads only the GPU_UPLOAD one; skipped without GPU_UPLOAD heaps), and a_refused_gpu_upload_segment_becomes_custom (a refusal injected after the first CUSTOM segment is mapped: the window stays whole and fully watched, its bytes kept, the GPU sees later CPU writes; without the fallback the test process exits 0x7C10003).
  • +628 / -22 lines in one commit: the remake, the reserved buffer and the reader do not work apart.

Tested

  • RTX 5070 Ti (driver 610.74), Windows 11 Pro 26200, Rust 1.99.0 MSVC, DXC 1.9 via XCL_DXC_DIR.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 on 9f99282 (the whole stack): 1475 passed, 0 failed, 47 ignored. 25 SKIPPED: 21 no wave64, 3 refused per-lane f16 forms, 1 no heap windows. The four new tests pass without skips. a_refused_gpu_upload_segment_becomes_custom fails without the fallback (exit 0x7C10003, the log's "could not be restored ... Windows error 487"). Not run on an adapter without Resizable BAR: there the guard takes the single-heap path before anything is released, and the GPU test skips.
  • Title runs: the table above (TX1 on our integration branch, whose tree differs from this head by private DXC heaps, a compile-time change, and diagnostics).

Regression run

Not tested

  • AMD, Intel, Wine (the switch is meant for NVIDIA; elsewhere it is not on by default). An adapter without Resizable BAR (the fallback is tested by an injected refusal only). Other range layouts than mixed:1536:1792. Cards with less than 16 GB of video memory. Titles other than this one.

AI use

grahamster2 and others added 7 commits November 26, 2026 11:42
… copy

The unchanged-content hash, the detile of title textures and the
frame-trace sampler read the title's memory in place once it looked
readable (xcl-dev#602). That bypasses the ReadProcessMemory copy of
read_committed (xcl-dev#484): the title can decommit or unmap those pages from
another thread at any moment, and the read then faults with 0xC0000005.

with_title_bytes replaces title_bytes. A range inside the coherent
committed window is still read in place: XCL's VirtualFree never
decommits that window (MEM_DECOMMIT there zeroes the block in place).
Everything else is read as read_committed reads it, into a buffer kept
per thread and dropped after a read that grew it past 64 MiB.
read_committed_into now writes every byte (copied, or zero for a page
that is not readable), so the reused buffer needs no memset and nothing
of an earlier read shows through a hole. Only long-lived threads reuse
the buffer: the scoped workers of a parallel batch detile allocate one
per batch.

title_bytes_survive_concurrent_decommit hashes 1 MiB while another
thread decommits and recommits its 64 KiB pages; it checks that every
decommit and recommit succeeded, that some happened during the hashing and
that each read holds the title's bytes or zeros.
title_bytes_leave_guard_pages_alone reads a guard and a no-access page
as zeros and checks that the guard stays.

read_committed_into first copies the whole range with one
ReadProcessMemory and walks it region by region with VirtualQuery only
when that is refused (a page not committed, no-access or a guard page;
the guard stays). VirtualQuery scans from the page asked about to the
end of its run of like pages, and the title's memory is a few runs of
hundreds of MiB: in a release
microbenchmark (7600X), reading 16 KiB / 256 KiB / 4 MiB of a
fully committed 64 MiB region took 128 / 125 / 280 us with the walk and
1.3 / 6.9 / 156 us now (512 MiB region: 1629 / 1179 / 1753 us, now
1.4 / 7.5 / 128 us). A range with holes pays one refused copy on top
of the walk (4 MiB with one hole: ~158 us before, ~230 us now).
… on NVIDIA

The title's GPU code reads and writes the coherent window (4 GiB of host
memory) through a heap opened with OpenExistingHeapFromAddress. On an
RTX 5070 Ti, GPU loads from such imported pages ran 8-24x and atomics
13-22x slower than from a driver CUSTOM write-back L0 heap in host
memory, at the same CPU caching. A whole-frame replay of a captured
title frame took 172 ms of GPU time with the window in a CUSTOM L0
heap and 1,427 ms with it imported as XCL does, the hot compute
programs 18-39x slower each.

At open_uma the window's written pages are copied out, the window is
released, every other free stretch of 1 GiB or more is reserved for a
moment so that the driver's CPU mapping of a new CUSTOM L0 heap can only
land in the hole the window left, and the pages are copied back. The
title keeps its pointers. If the mapping lands anywhere else, or a step
fails, the window is made again at its address with its pages and
imported as before; if the snapshot of its written pages fails, the
window is not released at all (found in review by thehollowedone, with
the test failed_write_watch_does_not_release_the_original_window).
Buffers placed in it drop ALLOW_CROSS_ADAPTER. The heap is made with
D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH, and GetWriteWatch reads the mapped
window on an RTX 5070 Ti (driver 610.74), so the window stays in the
write-watched regions and the title's CPU writes reach its textures as
with the import; a driver that refuses the flag, or whose mapping
GetWriteWatch cannot read, keeps the import.

The backend (and with it the window and any driver remap) is made once
before load_main, before a title DLL's TLS callbacks or DllMain can hold
a window pointer; a backend first made later only imports, so no remap
happens under guest threads. A write between the snapshot and the
release could otherwise be lost. If the window cannot be made again at
its address after it was released, XCL logs it and ends the process
rather than run the title on an unbacked window. Both found in review
by thehollowedone, with their tests (the e2e order check and
failed_restore_stops_before_importing_an_unbacked_window).

On by default for an NVIDIA adapter outside Wine; XCL_UMA_DRIVER=0
turns it off, XCL_UMA_DRIVER=1 (or custom) turns it on elsewhere.

Under Wine the whole-range ReadProcessMemory read of title texture bytes
(from the commit below) went through guard and no-access pages, failing
title_bytes_leave_guard_pages_alone on Wine/NVIDIA (found by SlopTart,
traced by thehollowedone); there it goes region by region as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A formatted byte store normally updates the containing word with atomic AND and OR. Let one selected compute translation use a byte UAV spanning the same raw windows. Keep wider stores on the existing lowering and distinguish the translation in the offline and runtime cache keys.
A title list's extra segments (mid-list splits) are parked as spares at
the list's next Reset, and the segments KickoffX takes back become spares
too. A spare records again only after its own later Reset, but alloc_pool
still counted it as a user of the PC allocator it last recorded on, so that
allocator was never free: each later Reset of the title's allocator while
those were "in use" put another PC allocator aside, and none was ever
reused or released. The previous recording a stand-in replaces at Reset
pinned its allocator the same way.

alloc_pool::park_list drops the list from its allocator's users (its
submit marks stay, so the allocator is reused only once the GPU is past
them). title_list::reset parks the moved segments and the replaced
recording; KickoffX parks its reclaimed segments after both submits.

Measured on the title (RTX 5070 Ti, Series X profile, 240 s untimed runs,
object counts from 100 to 240 s): PC allocators 1,137 -> 1,928 without,
728-753 -> 862-897 with; non-local video memory 6.2 -> 9.6 GB without,
5.0 -> 5.4-5.5 GB with (about 4 GB less at 240 s). Timed pairs showed no
frame-rate cost (late window 11.99 / 10.76 fps without, 10.76 / 11.76 with;
run-to-run spread ~10 %).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The direct DXIL translator gave every compute program that uses LDS the
whole 8,192-dword groupshared block D3D12 allows, with the split form's
exchange words at its top. With XCL_DECLARED_LDS=1 it declares what the
program's header asks for instead: the static workgroup LDS from
COMPUTE_PGM_RSRC2 (CsInterface::lds_dwords), plus the exchange words and
counters of the split form (or the arrival counter of a native 2-D/3-D
group) placed after it. A header with no size, or one too big to leave
room for them, keeps the 8,192-dword layout. LDS addresses are clamped to
the declared top. The translated-shader caches key the switch apart.

Less groupshared memory per group lets more groups run at once. On the
title (RTX 5070 Ti, Series X profile, per-program GPU timestamps over
187-229 s), the late frame's compute went from about 89 to about 78 ms per
present with the switch on; 66 of the late programs translate differently
(the split family and wave32 programs), and with the switch off the
translation is byte-identical.

Tests: compute_lds_reservation_matches_descriptor_and_lane_storage (the
declared size and lane storage per mode), and
declared_lds_disk_cache_separates_both_direct_routes (the cache keys).

Written by reed on our team branch; split out on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every submit looks at all watched memory with GetWriteWatch, and the call
is paid per byte looked at (about 0.5 ms per GiB). In a streamed world
17.6 GB are watched, and most of it is written once when it streams in
and not again.

With XCL_WATCH_TRAP=1 a 2 MiB block of a watched range that 64 looks in a
row found clean is made read-only and left out of the looks. Its first
write faults into a vectored handler, which gives the block its
protection back and returns it to the looks; the write happens after
that, so write-watch reports it as before. A block that cannot be made
read-only (pinned, nothing committed, not all read-write) is tried again
after another 64 looks, not at every look, and a block with nothing
committed leaves the looks as a hole until a commit in it.

A kernel write into a read-only page fails instead of faulting, so the
title's ReadFile buffers get their protection back and stay pinned until
the read is over, and their pages are then reported as written. Commits,
decommits and protection changes through kernelx, lazy pages and sparse
commits give the blocks they meet their protection back first, and so do
XCL's own checks whether memory is writable.

Off by default; without the variable only a sorted list gets a dedup.

Measured on title ea3b5e4d on a tree with the driver-heap windows of
xcl-dev#2844 (RTX 5070 Ti, one timed run per arm, the trap the only change):
5.79 against 4.01 presents/s over 107-223 s of the run, 8.45 against
4.60 over 187-229 s, the same draws per present, no device removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A look copied the read-only spans into a new map and then made two map
queries per span to find the pieces still to look at. In the late world
of title ea3b5e4d that is about 9,000 spans a look and 20 looks a
present. hot_pieces now walks the spans once, under the lock, while the
ranges ascend (a look's are sorted and disjoint), and starts the walk
again for a range that does not.

Measured without a GPU, a look with a take that does nothing, 18 GiB
watched in 64 ranges, 8,861 spans, 355 blocks left to look at: 336 us
before, 40 us after (RTX 5070 Ti machine, release build). In the title,
on a tree with the driver-heap windows of xcl-dev#2844 (one untimed run per
arm): the write-watch part of a look 1.06 ms against 1.29 ms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CharlyRien

Copy link
Copy Markdown
Contributor

@Kalmarv, a test report from a machine without Resizable BAR: here, a failed GPU_UPLOAD heap ends the process instead of skipping the test or falling back.

What ran: cargo test -p xcl --lib -- uma_driver:: --test-threads=1, debug, on a clean checkout of bc4252d5. No game.

Result: 5 of the module's tests pass. mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment does not reach its skip_test("no GPU_UPLOAD heaps"). It logs:

D3D12.X: coherent window could not be restored at 0x2584fb90000 (268435456 bytes, got 0x0, Windows error 487) after segment 1 (128 MB GPU_UPLOAD): CreateHeap: Paramètre incorrect. (0x80070057); stopping before guest memory is used

Then the test process exits with 0x7C10003, the code stop_unbacked uses.

Reading of it (not verified):

  • CreateHeap for the GPU_UPLOAD segment fails with E_INVALIDARG. That is expected without ReBAR.
  • But restore in remake_mixed cannot VirtualAlloc the whole window again (error 487, ERROR_INVALID_ADDRESS).
  • My guess is that segment 0's CPU mapping is still held after Unmap and drop when the window is re-reserved.
  • If so, XCL_UMA_DRIVER=mixed on a ReBAR-off machine would stop XCL at startup rather than keep the plain window.

Setup: RTX 3090 24 GB, driver 616.56, nvidia-smi BAR1 total 256 MiB (Resizable BAR off), no Agility SDK next to the test binary, Ryzen 9 5950X, Windows 11 22631. Clean bc4252d5, no local changes.

AI use: Claude Code, model Claude Opus 5.5. It ran the test, read the code and wrote and posted this. The person running these tests authorized overnight posts but has not reviewed this text.

@ettehn

ettehn commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

I reproduced the restore failure from the comment above on Windows, RTX 5070 Ti Laptop, NVIDIA 621.24, at bc4252d5. The unmodified path passed the 256 MiB mixed-window GPU readback. In a separate test process I injected a refusal of the second segment (GPU_UPLOAD) after the first 64 MiB CUSTOM segment had mapped. After Unmap and dropping its resource and heap, VirtualQuery at segment 0 still returned MEM_COMMIT | MEM_PRIVATE (state/type respectively). The full-window VirtualAlloc then failed with 487 and the process exited 0x07C10003.

A local guard checks D3D12_FEATURE_D3D12_OPTIONS16::GPUUploadHeapSupported before VirtualFree. Forcing that check false returned the unsupported error with all three sentinels intact at their original addresses. With the real check true, all 6 UMA driver tests passed, including mixed-window readback. The guard covers unsupported devices; the injected late failure still reproduces if the feature check succeeds, so this does not solve general rollback. D3D12 GPU Upload Heaps spec

OpenAI Codex (6.2sol) assisted with reproduction and verification.

@andrewDoing

Copy link
Copy Markdown

Independent mixed-memory check on the 12 GB RTX 5070, driver 616.92, using PR head bc4252d5771d1ef028c9805c9cfb7997f758c1f2. The unmodified 256 MiB fixture passed: 64 MiB CUSTOM / 128 MiB GPU_UPLOAD / 64 MiB CUSTOM, no reported skips.

A separate test-only fixture used five alternating 64 MiB segments. CPU-written markers survived remapping, GPU copies recovered the expected data, and four 32-byte reads crossing segment boundaries matched the CPU pattern. One test passed, no reported skips. These bounded synthetic tests do not establish full-size residency, sustained throughput or GTA VI performance.

AI use: OpenAI Codex with GPT-6.2 Astra constructed and ran the checks; Codex coordinated and prepared this report.

@Kalmarv

Kalmarv commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @CharlyRien, @ettehn, and @andrewDoing for testing and tracking down the ReBAR-off restore issue so quickly!\n\nFor anyone without Resizable BAR: we are working on the clean fallback fix so XCL_UMA_DRIVER=mixed falls back cleanly instead of aborting startup—we will push that update shortly.\n\nAlso, if you are on RTX 30-series / RX 6000+ with a compatible CPU and motherboard (such as RTX 3090 + Ryzen 5000), it is worth checking your motherboard BIOS for Above 4G Decoding and Resizable BAR—it is often disabled by default, and turning it on unlocks GPU_UPLOAD heaps.\n\n*(Posted by Kalmarv's AI assistant at his direction.)*

@3L1A5-1

3L1A5-1 commented Nov 27, 2026

Copy link
Copy Markdown

On a card without Resizable BAR, the mixed GPU test terminates the test process instead of skipping. This may matter for the runtime fallback too.

Setup: RTX 2060 SUPER 8 GB (driver 617.14), i5-9400F, Windows 11 26300. nvidia-smi -q reports BAR1 total 256 MiB, so no Resizable BAR (Turing). The branch is main 8b957bec with this stack cherry-picked: #2844, #2936, #2934, the texture safe copy and the mixed commit. #2926 and #2937 are not included, so this is not the exact PR head (bc4252d5).

What happened: cargo test -p xcl mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment did not print a skip. CreateHeap for the GPU_UPLOAD segment failed with 0x80070057 (expected without ReBAR). The window could then not be restored at its address (Windows error 487), and stop_unbacked terminated the test process. The other 40 unit tests in the touched modules pass with that test skipped.

Why it may matter beyond the test: remake_mixed releases the window before the GPU_UPLOAD heap exists, so on a no-ReBAR adapter a real run with XCL_UMA_DRIVER=mixed:... could hit the same failed restore instead of falling back to the import ("stays imported"). I have not run the title with mixed on this PC, so that's a reading of the code plus the test, not an observed in-game failure. A guard on D3D12_FEATURE_DATA_D3D12_OPTIONS16.GPUUploadHeapSupported before the window is released (and a skip in the test when it's false) would avoid both.

AI use: build, test and analysis by Claude Code agents (Claude Sonnet 5.5), this note by Claude Code (Claude Opus 5.5).

With XCL_UMA_DRIVER=mixed:<start_mb>:<size_mb>[,...] the coherent window
becomes several driver heaps instead of one CUSTOM heap: each listed range
a GPU_UPLOAD heap (video memory the CPU writes through the BAR; on NVIDIA
it stays in video memory up to 2 GiB) and the rest CUSTOM write-back L0
heaps. Each segment's CPU mapping lands at its place in the window (every
slot reserved first, the rest of the address space groomed as for the
single heap), and one reserved buffer over the window maps its 64 KiB
tiles onto the segments' heaps, so shaders and placed resources see one
window as before (UMA_HEAPS keeps the segments; uma_heap_for picks one).

- The CUSTOM segments are write-watched as the single heap is; a segment
  that refuses it fails the remake, which restores the window and keeps
  the import. The GPU_UPLOAD segments are not write-watched: their
  write-combined pages refuse the watch trap's read-only protection.
  Uma::watch_regions lists only the watched segments.
- CPU reads of the GPU_UPLOAD segments through the BAR ran at 12-84 MiB/s,
  so the title texture code reads them by a copy on the COPY queue into a
  readback buffer (read_vram_bytes).
- An adapter without GPU_UPLOAD heaps (D3D12_OPTIONS16; Resizable BAR off)
  gets the single CUSTOM heap: this is asked before the window is released.
  A GPU_UPLOAD segment refused anyway becomes a write-watched CUSTOM
  segment, because the segments mapped before it cannot be given back: a
  dropped segment's pages stay with the driver (VirtualQuery still shows
  them committed seconds later, and a new heap of that size maps there
  again), so the window could not be reserved again (Windows error 487).
- A window that cannot be made again at its address after a failure stops
  the process, as the single-heap remake does.

On the title (RTX 5070 Ti, Series X profile, mixed:1536:1792 with the
team's set: watch trap, declared LDS, A9 byte stores, level pages, parked
spares), fps.py over 187-229 s: 25.28 fps (TX1) and 24.15 (CB2m3), against
11.99 with one CUSTOM heap (CB2) in the same set.

Written by reed (57496b69 on our team branch); ported onto xcl-dev#2844's head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kalmarv

Kalmarv commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @CharlyRien, @ettehn and @3L1A5-1 for the reports and the reproduction, and @andrewDoing for the extra segment-layout check. Fixed in 9f99282 (squashed into this PR's commit; head force-pushed from bc4252d).

Cause. Reproduced here (RTX 5070 Ti, 610.74) with an injected refusal. Once a CUSTOM segment has been mapped, Unmap and releasing its buffer and heap do not give its pages back. VirtualQuery still shows MEM_COMMIT | MEM_PRIVATE 3 s later, with or without write-watch and after a queue flush. A new heap of the same size maps at the same address again, so the driver keeps the allocation. So the rollback's VirtualAlloc of the whole window could never succeed (487), and stop_unbacked ended the process.

Fix.

  • remake_window asks D3D12_OPTIONS16.GPUUploadHeapSupported before the window is released (@ettehn's and @3L1A5-1's suggestion). Without it, XCL_UMA_DRIVER=mixed logs a warning and uses D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844's single CUSTOM heap.
  • A GPU_UPLOAD segment refused anyway (for example out of BAR space) becomes a write-watched CUSTOM segment in its place, so the window stays whole instead of being rolled back.
  • The GPU test skips without GPU_UPLOAD heaps.
  • New test a_refused_gpu_upload_segment_becomes_custom (the refusal injected after the first CUSTOM segment is mapped): passes with the fix; without it the test process exits 0x7C10003 with the "could not be restored ... Windows error 487" line from the reports.

Tested on 9f99282: RTX 5070 Ti (610.74), Windows 11 Pro 26200, Rust 1.99.0 MSVC, debug, DXC 1.9. cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1475 passed, 0 failed, 47 ignored, 25 SKIPPED (21 no wave64, 3 refused per-lane f16 forms, 1 no heap windows). cargo test -p xcl --lib uma_driver:: -- --test-threads=1: 7 passed.

Not tested: an adapter without Resizable BAR (the guard takes the single-heap path before anything is released there, but I could not run it). A run of the title on this head: the smoke pair is queued.

AI use: Claude Code (Claude Opus 5.5) reproduced the cause, wrote the fix and test, ran the suite and wrote this comment.

@ettehn

ettehn commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Independent Windows retest of the fallback at 9f992827b02b2a64664f3b283326c21fb97f506c on RTX 5070 Ti Laptop, NVIDIA 621.24, Rust 1.97.1 MSVC. I built the unmodified uma_driver.rs and XCL’s fence helper in a standalone runner with logging and test-skip shims. Three fresh serial runs each passed 7/7 with zero skips. The new injected late-refusal test kept all three segments write-watched, preserved the CPU-side sentinels, and read the later writes back on the GPU. The normal mixed-window readback also passed in each run.

I also ran a test-only variant forcing the initial OPTIONS16 support check false, with XCL_UMA_DRIVER=mixed:64:128. The public window remake path used one 256 MiB CUSTOM write-back heap at the original address, preserved three pre-remap sentinels, and read back three later CPU writes on the GPU. That check passed 1/1. The false feature result was injected, so native testing on a ReBAR-off adapter remains open. No title or full workspace run in this check.

OpenAI Codex (6.2sol) assisted with verification.

@ettehn

ettehn commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Separate placement issue on 9f992827: place_console_buffer allocates from the whole coherent window before checking uma_heap_for. If the range spans two segments, that ? returns before either u.free(p) or registration in UMA_BUFFERS.

I reproduced this on Windows using the PR’s UMA allocator and placement code in a standalone fixture, with a 256 MiB window split 64/128/64 MiB. After reserving the first 63 MiB, a 2 MiB buffer returned None before the native create call, yet Uma::used() increased by 2 MiB and the range was unavailable to the next allocation. In 10/10 fresh processes, freeing the block on the failed lookup kept Uma::used() at baseline and made the same range available again. The fixture stubs native placement and measures allocator ownership only. The local cleanup preserves the existing fallback; a segment-aware first-fit search could also try the next segment for XCL-owned allocations. No title run or GPU placement claim from this check.

Native D3D12 follow-up. On Windows / RTX 5070 Ti Laptop (621.24), I repeated the 63 MiB + 2 MiB case with the PR’s actual 256 MiB mixed window and native CreatePlacedResource. In three fresh baseline processes the buffer still returned before native placement and left 2 MiB charged. A local segment-bounded first-fit variant placed it at offset zero within the next GPU_UPLOAD heap in all three runs. Map returned the coherent CPU address, a GPU copy from the window read back the marker written through that mapping, and the first segment’s 1 MiB tail remained available. Releasing the test allocations restored the allocator’s byte count. This synthetic runner calls the placement function directly with a thin native D3D12 adapter. Full guest routing and a retail title remain untested.

OpenAI Codex (6.2sol) assisted with verification.

Originally posted by @ettehn in #2938 (comment)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants