D3D12.X: a memory window with no GPU buffer gives no GPU address #3658
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3658"
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?
Imported from ivall/xcl. Originally posted by Prime1997 on 2026-12-02T04:35:08Z.
Requested by Prime
On an RTX 3060 Ti, open-world runs of a game title lost the device (0x887a0005) after 3 to 5.5 minutes in about half of them. With
XCL_DREDboth faults were GPU page faults at address 0x0, which DRED placed at "window 10 + 0x0": the memory window table had an entry whose buffer address was 0, souma_va_ofof an address in that window returned the offset alone as the GPU address, anduma_window_buffer(_gpu)a null buffer.uma_window_vanow returns None for such a window, and the buffer lookups return none for a null buffer. Callers then fall back (most bind window 0's address instead) or skip, rather than handing the GPU address 0.Related: #3052 guards the two-pass stage's window view against the same null window. This change fixes the lookup itself, so it also covers that site.
What is in it
crates/xcl/src/hle/d3d12x/real.rs:uma_window_vafilters a 0 buffer address;uma_window_buffer/uma_window_buffer_gpureturn none for a null buffer.Tested
1c8b5514):cargo check -p xcl --lib --tests --target x86_64-pc-windows-gnupasses. The test suite was not run on this exact branch.Regression run
Not tested
scripts/smoke.ps1on this branch; AMD.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T09:17:17Z.
Review (head
7d656c9a, diff read, not a merge-check; checks red):log_device_removed(real.rs ~12489) labels a fault address with the first entry ofuma_window_vas()within 4 GiB below it. A fault at 0x0 therefore matches the first window whose address is 0. In the 16-window layout with one coherent window (sparse 0-2, coherent 3, views 4-9), windows 10-15 areWindowKind::Noneand stay(0, 0)by construction (real.rs ~710).Uma::windowgives them length 0 (uma.rs ~738), sowindow_ofnever returns them (uma.rs ~775), anduma_va_of,uma_window_buffer_gpuandpc_va_innever look them up. The only callers that pass an index ask for windows 0-3 (bind.rs ~3108,~5317). The label "window 10" also shows that windows 0-9 all had addresses, so nothing this PR filters was 0 in that run. By reading, the PR changes nothing on the reported path. The same DRED fault is the evidence for #3657 (vertex or index buffer views at address 0), which fits it better.first_window(uma_window_va(0), ..)(bind.rs ~3083,~5291) now receives None instead ofSome(0). Whensparse::initcould not make the reserved buffers (sparse.rs ~3408), everybind_abiand every two-pass stage is now refused with "unified memory is not open on the GPU", and the draw or dispatch is skipped (bind.rs ~3837). Main kept drawing in that case on purpose:binds_refuse_shadowed_memory_without_window_0(bind.rs ~7964) says "unshadowed memory with none keeps going as before". That test still passes only because it callsfirst_windowdirectly. Thefirst == 0 && shadowedbranch is now dead, and the shadowed case gets the wrong error message.pc_vasends the title's CPU address to the GPU for a window with no buffer. Inpc_va_in(list_x.rs ~5745), a non-view window whose lookup now gives None takes theNone => vaarm. That passes the raw title address on as a GPU address, which the comment above it says hangs the device. Main sent the offset alone instead. Neither of these is a null view.pc_va_inandfirst_windowalready take the window address as a parameter. A test that feeds them a window without a buffer would have shown the two behaviour changes above. The description says no window table with a null buffer exists "on purpose", which agrees with the first point.xcl-smokeblock for the head commit and none for main. The description also says the test suite was not run on this branch.Fine: every caller handles the new None without unwrapping it. The only
unwrapis in a GPU test (gpu/recomp/tests.rs ~5527).bind.rs ~5317andlist_x.rs ~5232already filtered 0 on main, anduma_window_bufferhas no callers. This PR overlaps the open #3052 at the two-pass site.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T11:27:47Z.
Test report (not a merge-check:
PR descriptionred)base:
1c8b551475head:
7d656c9adbmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3658#issuecomment-7340659095 and its findings stand. Most serious: the changed lookups never reach the empty "window 10", so it can't fix the fault it cites, and binds now fail when window 0 has no buffer.
performance: 60 s smoke of a retail title, main
1c8b5514vs this merge (7d656c9a): 1652 -> 1675 frames shown (101 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 17821 MB, 0 device removals, 0 crashes.assessment: merges, builds and passes the whole suite on current main, and the smoke run is clean; the blocking point is in the review: the changed lookups never reach the empty "window 10", so it can't fix the fault it cites, and binds now fail when window 0 has no buffer
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T19:41:50Z.
Review: COMMENTED
Review of
7d656c9a: 3 finding(s) (2 high, 1 medium), most severe first.crates/xcl/src/hle/d3d12x/bind.rs:5305: see below.crates/xcl/src/hle/d3d12x/bind.rs:5076: see below.crates/xcl/src/hle/d3d12x/list_x.rs:5751: see below.On lines outside the diff:
High
crates/xcl/src/hle/d3d12x/bind.rs:5305:va = |p| uma_va_of(p).unwrap_or(first)silently binds window 0's base as the io and res blocks now thatuma_va_ofreturns None for a window with no buffer. The same pattern is at bind.rs:3099 and console_list.rs:884. So the shader reads and writes the wrong memory instead of the bind failing. If the arena putsio_atorres_atin a window with no buffer, the GPU address used to be the bare offset (a fault). Now views[0] and views[1] are window 0's base: the shader reads window 0's first bytes as its io block (table address, limits, loop budget) and writes its results there, corrupting title memory, and may loop or read out of bounds. A None forio_at/res_atshould return Err.High
crates/xcl/src/hle/d3d12x/bind.rs:5076:uma_window_va(0)now returns None instead of Some(0), sofirst_windowrefuses unshadowed memory whose window 0 has no buffer, the case its test documents as 'keeps going as before'. With bufs[0] = (0,0) and memory unshadowed,bind_abiandprepare_two_pass_stageused to go on with first = 0. Now every bind on XCL's ABI fails with "unified memory is not open on the GPU" and every draw and dispatch on that path is dropped. The 'no buffer in window 0' message is never logged, andbinds_refuse_shadowed_memory_without_window_0still passes while testing an input (Some(0)) that can no longer occur.Medium
crates/xcl/src/hle/d3d12x/list_x.rs:5751:pc_va_instill hands the GPU an invalid address for a window that isn't a GPU view and has no buffer:None => vareturns the raw console address (before the PR it returned the offset alone). Ifsparse::initfailed for a sparse or VRAM window (bufs[k] stays (0,0), notis_view_window), IASetIndexBuffer/IASetVertexBuffers at a title address in it get pc_va = va.gpu_vathen seesu.contains(va)and returns it, so a console address is bound as a PC GPU address, giving the page fault or device removal this PR targets. Returning 0 (null view) there, as the view-window branch does, would fix it.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T15:05:27Z.
merge-check
base:
16c2fd082ahead:
7d656c9adbmerge: clean
build: ok
tests: 3012 passed, 0 failed, 56 ignored; 28 skipped, the same as on main
review: 4 high, 3 medium (below)
performance: 60 s smoke run: 1683 → 1664 frames (98 % of main), peak commit 18505 → 18768 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 237 s there, 0 device removals, 0 crashes, 3.1 presents/s; run with
XCL_SKIP_CS=95cc13288a27a96e(the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)verdict: not yet: 4 blocking findings (critical or high, below); also
PR descriptionis redhardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
In short: uma_window_va now returns None for a window whose address is 0, and the buffer lookups return none for a null buffer, to stop GPU faults at address 0. The head has not changed since my earlier review, and all of its findings are still open: the changed lookups never reach the "window 10" the description cites, and when a window lacks a buffer, binds that worked are now refused and addresses that faulted now point at the wrong memory. It blocks.
High
Medium
Checked and fine
How this was tested
16c2fd08, thencargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4.scripts/smoke.ps1: 60 s of a retail title on main16c2fd08and on this merge; presents per 2 s at the end: 60 60 60.XCL_RUN_SECONDS=300and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.