Skip to content

D3D12.X: console UAV clears (#53 / #54) get the slots' PC descriptors - #1291

Open
emirduran707 wants to merge 1 commit into
xcl-dev:mainfrom
emirduran707:d3d12x-clear-uav-console-handles
Open

emirduran707 wants to merge 1 commit into
xcl-dev:mainfrom
emirduran707:d3d12x-clear-uav-console-handles

Conversation

@emirduran707

@emirduran707 emirduran707 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Console command lists' ClearUnorderedAccessViewUint / Float (#53 / #54) went straight to the PC's #49 / #50 (console_remap). No XCL code ran on them, so the console's descriptor handles reached the PC unchanged. Console code gets those handles from heap #9 / #10, which return console heap slot memory in unified memory, not PC descriptors. So the GPU handle was not in the bound shader-visible heap, and the CPU handle pointed at the console's T# words. Microsoft's documentation of ClearUnorderedAccessViewUint: the GPU handle "must be in a shader-visible descriptor heap, which must be set on the command list via SetDescriptorHeaps", and the CPU handle must be "in a non-shader visible descriptor heap that references an initialized descriptor". Only the opt-in console-list replay (XCL_CONSOLE_LISTS=1) translated them.

clear_uav_uint_x / clear_uav_float_x now take #53 / #54:

  • When both handles are console view slots with a PC UAV, the PC clear gets the slots' PC descriptors: the UAV in the shader-visible heap and its CPU-only copy, as the replay uses.
  • When neither is a console slot, the call passes through unchanged.
  • Anything else (one of each, a heap that is not shader-visible, a sampler slot) is skipped and logged once.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs:
    • the two methods and uav_clear_handles;
    • test uav_clear_handles_translate_console_slots, with no device;
    • test clear_uav_with_console_handles_clears_the_slots_view on WARP. It registers an R32_UINT buffer UAV in a console heap, clears it with the console handles and 0xDEADBEEF, and reads it back.
  • crates/xcl/src/hle/d3d12x/real.rs: slots 53 / 54 in console_slots(Kind::CommandList), and test console_clear_uav_slots_translate_handles.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on 1a1a07f (rebased onto main 1a0bbe3): 1251 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record)
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) fail identically on unmodified main 1a0bbe3 on this GPU (seeds 722 and 1599).
  • without the slots in console_slots, console_clear_uav_slots_translate_handles fails; with a pass-through decision (what the default path did), the WARP test ends the test process with STATUS_ACCESS_VIOLATION inside the PC clear; with the change all three pass

Regression run

main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1454 (PresentX 1454)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18610 MB

this PR:

xcl-smoke v1
commit: 1a1a07f9d444f04dd20331c194d4006b89ac327e
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1545 (PresentX 1545)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20222 MB

Not tested

  • A title's own UAV clears on hardware; the smoke title's run is a regression check only.
  • Rects are passed on as given (the replay drops them).
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the tests and this description; I reviewed the diff and ran the tests and smoke runs above.
  • Claude Code with Claude Opus 5.5: rebased the change onto main 1a0bbe3 (a conflict in the tests of crates/xcl/src/hle/d3d12x/list_x.rs; both tests kept) and reran the suite and smoke runs above.

🤖 Generated with Claude Code

@thehollowedone

thehollowedone commented Nov 24, 2026 •

Copy link
Copy Markdown

Independent native NVIDIA float clear check on 0fd1b66, Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug with Windows Graphics Tools.

I adapted the WARP fixture to use an R32_FLOAT buffer on the native adapter. With the console CPU-only and shader-visible slots registered, I passed their console handles directly to XCL’s clear_uav_float_x on an adopted command list. After a fence and GPU readback, all 64 elements were exactly 0.375. The D3D12 debug layer recorded zero messages during the clear and copy. The three stock tests also passed, including the WARP unsigned-integer readback.

Synthetic buffer and handler coverage only. AI-assisted. Codex (GPT-6, exact variant unavailable) adapted and ran the scratch fixture and drafted this report.

Recheck on current head 1a1a07f on the same RTX 3080 Ti. The clean workspace built and reported 1,253 passed, 0 failed, 46 ignored, including 25 reported skips (20 without wave64, 3 unsupported per-lane forms, 1 driver-cache toggle and 1 heap-window test). All three stock UAV tests passed, including the WARP readback.

I also ran the unsigned-integer clear on the RTX 3080 Ti with separate CPU-only and shader-visible heaps, a buffer created in COMMON and transitioned to UAV, and D3D12 debug and GPU-based validation enabled. All 64 elements matched. The device stayed healthy, with zero validation warnings or errors. The native check changed only the test fixture. No retail or shared-heap coverage in this recheck. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the suite, adapted the native fixture and drafted this update.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib new UAV clear tests: 3 passed, 0 failed.

Thanks!

@WASDeKeys

WASDeKeys commented Nov 24, 2026 •

Copy link
Copy Markdown

Thanks for running this. Is retail-title the actual folder name, or did you anonymize the title? I’m trying to reproduce the smoke test—could you share the title name and confirm it was an authorized, unpacked Xbox build? I am very confused as to how to run the smoke test. No game files needed. @emirduran707

@futurepro62

Copy link
Copy Markdown

Full-suite run on NVIDIA and AMD (the checks above are NVIDIA only). Tested exact head 0fd1b66 (on its base 47efa2e).

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: 744 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: uav_clear_handles_translate_console_slots, clear_uav_with_console_handles_clears_the_slots_view, console_clear_uav_slots_translate_handles.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 744 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.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…cl-dev#1286-xcl-dev#1291, xcl-dev#1294, xcl-dev#1296-xcl-dev#1297, xcl-dev#1300

Prevent background shader preloading and concurrent DXC/RADV compiles from exhausting host RAM under Wine, and integrate 11 open upstream PRs:
- dxc.rs & real.rs: check free physical RAM (ullAvailPhys.min(ullAvailPageFile)) under Wine instead of swap-inclusive ullAvailPageFile, avoid bypassing the guard after 60 s under Wine, and serialize giant (>= 4 MiB DXIL) driver compiles with BIG_COMPILES under Wine.
- pso_async.rs: cap background preload workers to 1 under Wine.
- title_textures.rs: use real::create_raw_fence in submit_on_title_queue and read coherent-window hash bytes safely via with_title_bytes.
- Integrate upstream PRs xcl-dev#968 (sparse::queue lock-free for late_release), xcl-dev#1286 (v_dot2_f32_f16 NEG_HI abs), xcl-dev#1287 (XMA >8 channels), xcl-dev#1288 (Sleep pauses during PSO bind waits), xcl-dev#1289 (pipeline stream bounds check), xcl-dev#1290 (root signature MAX_ARGS cap), xcl-dev#1291 (console UAV clears xcl-dev#53/xcl-dev#54), xcl-dev#1294 (shadowed PENDING accuracy), xcl-dev#1296 (16-bit compare low halves), xcl-dev#1297 (fence_x pre-cell signal arming), xcl-dev#1300 (log driver compute PSO refusal).

Verified on RX 9060 XT under GE-Proton11-14 (MemoryMax=12G, 80 s): committed RAM stays flat at 4830 MB (down from 27.6 GB OOM), 1493 frames shown, exit 0x0.

Assisted-by: Antigravity (Google DeepMind)
@madaraXor

Copy link
Copy Markdown
Contributor

Retail title check on AMD RDNA2: the upscaler's UAV clears no longer fault in the driver

This covers the "Not tested: a title's own UAV clears on hardware" point, with the retail title (1.0.2.1).

Setup: AMD Radeon RX 6700 XT 12 GB (RDNA2), driver 32.0.21045.29003, Ryzen 5 5600X, 16 GB RAM, Windows 10 Pro 22H2 (19045.6466), Agility SDK 1.620.2, Rust 1.90.0, release build. device_type = "lockhart", XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_PRELOAD=0 XCL_PSO_WAIT_MS=50 XCL_DXC_THREADS=3, menus driven with XCL_PRESS_AT into the story start. The title needs #684 to get this far on this machine (it stops in xg::copy_from at ~535 s without it), so every build below has it.

Without the change (main 47efa2e + #684 + #615 + #495), two runs: when the world starts, amd_fidelityfx_upscaler_xbox.dll calls ID3D12PipelineState1::#11, then the list's #53 from +0x72f4, and the process ends with 0xc0000005 in amdxc64.dll+0x3167ae (read at address 0xffffffffffffffff), the upscaler's +0x72f4 / +0x138b4 on the stack: at 598 s and at 600.9 s.

With it, exact head 0fd1b66 merged with main 930e8b4 + #684 + #615 + #495 + #1288 + #1315/#1316 (none of them touches the clears): the upscaler starts at 607.9 s (#11 stub, then its passes), no ClearUnorderedAccessView … not done warning in the whole run, and no fault there. The same title ran on for another 50 s and then ended in a different place, amdxc64.dll+0x6f30ce (read at 0x24) with only driver frames on the stack, while the driver compiled the world's compute pipelines with local video memory at 13.9 GB on this 12 GB card – not the clears.

An equivalent change of mine (same slots, same translation through console_heap::slot) on b8b1f49 + #684 + #615 + #495 passed the same point twice, at 595.9 s and 676.1 s.

Not tested: NVIDIA / Intel with the retail title; whether the clears give the right values (nothing on screen to check yet – the title is still on its loading art at that point here).

AI use: Claude Code, Claude Opus 5.5 ran the builds and runs on my PC and wrote this report. Counts, times and offsets only.

@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!

@emirduran707

Copy link
Copy Markdown
Contributor Author

@WASDeKeys retail-title is a folder link (junction) I made so that the smoke block does not carry a commercial title's name. I'd rather not name it here. Any GDK title you own and have installed works the same way:

  1. Build: cargo build --release -p xcl
  2. Run: .\scripts\smoke.ps1 -Game <the title's install folder> (60 s by default, networking off). It prints the xcl-smoke block at the end.

For a PR, run it once on a build of main and once on the PR's head, on the same title. "Building and usage" in the README covers running a title.

Written with Claude Code (Claude Opus 5.5).

simnJS added a commit to MiamiGame/XTP that referenced this pull request Nov 24, 2026
Series S: BTP 6 runs AMD's FidelityFX upscaler (FSR4), whose console
compute programs XTP cannot translate (20 refused, "no DXIL part"); with
its DLLs refused the title divides by zero at title+0x28f03e8.

xtp-hle `ffx` stands in for amd_fidelityfx_loader_xbox.dll and
amd_fidelityfx_upscaler_xbox.dll unless XTP_FSR4=1. From the title's own
calls (title+0x28ef2cc, +0x28ef30f, +0x28ef625, +0x28f03db, +0x28f0651):
- create (upscale 0x10000 + console backend + version chain): a context;
- query 0x10004: the jitter phase count, 8 x (display / render)^2, 18 for
  720p -> 1080p (the divisor at title+0x28f03e8);
- query 0x10005: AMD's Halton (2, 3) jitter offsets, written into the
  title's uninitialised locals;
- query 0x10008: the upscaler's GPU memory, 0 (the title adds it to a
  memory total, again from uninitialised locals);
- dispatch 0x10001: xtp_gpu::list::upscale, a bilinear compute pass of
  XTP's own from the colour input to the output, the jitter taken back
  as FidelityFX places its samples, clamped to the rendered region.
No AMD code runs.

xtp-gpu list slots 0x1a8/0x1b0, ClearUnorderedAccessViewUint/Float. The
two handles are console descriptor slots holding XTP's view records;
the host gets its own descriptors of the same view: a dynamic slot of
XTP's view heap (bound for the clear) and a CPU-only slot. Texture
views move to unordered access, buffer views write their host copy,
copied back to title memory after the submission. Float clears of raw
and structured buffer views are refused, as the host would (#948's
review).

Outside the task's files, granted by the orchestrator:
- draw.rs: State::forget_host, so the title's pipeline, root signature
  and heaps go back on the host list after the upscale or a clear;
- descriptor/host.rs: make_view (a view into a CPU-only heap) and
  make_at says whether it made the view.
Mechanical: modules/mod.rs, the `ffx` module line and its registration.

Tests: phase count, Halton offsets, the three queries and the create
chain as the title lays them out, a dispatch description read at the
title's offsets; on WARP, the upscale (bilinear, jitter, regions) and
UAV clears of a texture and a buffer through console handles.

Ported from Marvisak/VIctory#1284 (head f96ad82) by AwkGrep256: the
module standing in for both DLLs, its exports, the description layouts,
unknown types logged once. Not taken: its passing on to AMD's PC loader,
the picker and scale patches (Series X diagnostics).
UAV clears after Marvisak/VIctory#948 (head 35802af) by Sakura-Byte,
reimplemented on XTP's descriptors; the handle translation is the idea
of xcl-dev/xcl#1291 (GPL-2.0-only, no code taken).

Co-authored-by: AwkGrep256 <AwkGrep256@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
@jessenic

Copy link
Copy Markdown
Contributor

Test report: on a retail title, this PR removes a GPU hang at the first frame of the world. DRED put the hang at a ClearUnorderedAccessView on a title list. With this PR the title gets past it to the intro cutscene's title card.

Setup: RTX 5070 Ti 16 GB (driver 610.88), Ryzen 7 9700X, 32 GB, Windows 11 Pro 26300, rustc 1.97.0, release. Retail title, Series S profile (device_type = "lockhart"), story load with scripted A presses. Every compute pipeline was precompiled into the driver cache, including the > 8 MB ones (XCL_PIPELINE_MAX_KB=0), so no build runs during the load.

Tree: a local integration branch on main 8f5fca5, with #1323, #1143, #1221, #765, #1405, #1464, #751, #684, #1110, #615, #1315/#1316, #495, #1993, #2009, #929 and a local port of #640 (it conflicts with main). This PR's commit 0fd1b66 was cherry-picked on top cleanly as 62e86ec. Local diagnostics only, none of them touching clears. All runs used XCL_HEAP_WINDOWS=1 XCL_DRED=1 XCL_COHERENT_HEAPS=sparse:256 XCL_PAGE_BUDGET_MB=5120.

runs how they end DRED at the removal
without this PR 3 0x887a0006 (DEVICE_HUNG), 1–5 s after the last presents one list stopped at 34 of 108 operations in all three, breadcrumbs 15 7 15 >13 15 13 (ClearUnorderedAccessView in progress); the other lists not started; no page fault
with this PR 2 0x887a0005 (DEVICE_REMOVED), about 1 s after the last presents, 8 s after the title's first #101 no list in progress, no page fault

What still ends the run (not this PR): the 0x887a0005 removal with nothing in flight, right after the intro's title card, as in other reports on #505. The debug layer's last 64 messages before it hold only errors already present in the menus (1047, 527) and a graphics pipeline created 15 ms before.

Not tested: main alone (the hang needs the rest of the stack to reach the world on this card); AMD; Series X; more than 2 runs with the PR. This was not a scripts/smoke.ps1 regression run.

AI use: Claude Code (Claude Opus 5.5) ran the runs on the machine above, read the DRED output and wrote this report.

@WASDeKeys

WASDeKeys commented Nov 25, 2026 •

Copy link
Copy Markdown

@emirduran707 I have a retail-title, I was just wondering if there's a specific title I need to run the smoke test on or if any xbox series unencrypted title would do.

@emirduran707

Copy link
Copy Markdown
Contributor Author

@WASDeKeys Any unpacked Xbox Series (GDK) title you own works; there is no specific one. What matters is that you run the same title twice: once with an xcl.exe built from main and once with one built from the PR's head, each for the same 60 s (.\scripts\smoke.ps1 -Game <folder> -Xcl <that build's xcl.exe>). Then paste both xcl-smoke blocks. A title that does not reach the code a PR changes still counts as a regression check; say so under Not tested.

Written with Claude Code (Claude Opus 5.5).

@WASDeKeys

Copy link
Copy Markdown

@emirduran707

Thanks a ton, this has cleared a big confusing part for me. Also could you tell me if there is a list of things that need work right now, like improvement issues that need fixing and testing or really anything you would point a new contributor towards? Also is there a chat room/community like in discord yo coordinate with other devs?

Thanks!

…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

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

throny commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Two contributors checked independently and found that #2329 solves the same problem (for #675) in a different way: #1607, group D80. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

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.

8 participants