Skip to content

D3D12.X: console list #31 SetPredication gets its placement delta and survives kickoffs - #1349

Open
emirduran707 wants to merge 2 commits into
xcl-dev:mainfrom
emirduran707:d3d12x-console-set-predication
Open

emirduran707 wants to merge 2 commits into
xcl-dev:mainfrom
emirduran707:d3d12x-console-set-predication

Conversation

@emirduran707

@emirduran707 emirduran707 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Console command lists' SetPredication (#31) went straight to the PC's #55 (console_remap); no XCL code ran on it. That broke two things.

  1. The offset missed the buffer's placement delta. XCL places some buffers below their title address (place_at_title_address records buffer_delta), and every other PC method that takes a buffer offset adds it: ResolveQueryData, CopyBufferRegion, CopyTextureRegion, ExecuteIndirect. A title that resolves an occlusion query into buf at off, then predicates on buf at off (the pair in Microsoft's predication sample), had the result written at off + delta but the predicate read at off.
  2. The predicate was lost after a kickoff. KickoffX and the Wait64 mid-list split re-apply predication after their internal Close / submit / Reset only from SetPredicationBufferX (xgameruntime: add XAccessibility closed caption and high contrast fallback #85). So predication set through Launcher: honor configured executable before auto-detection #31 was off for every draw after a kickoff, although a console kickoff leaves the list's state as it was.

What is in it (two commits)

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 96ecec1 (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).
  • the new tests use a fake command-list vtable. Without the first change: the delta test records offset 16 instead of 528, and slot 31 has no XCL method. Without the second: the restore records no call instead of (buffer, 528, 1). With the changes they 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: 96ecec12e2cf1ffd8c6fca4bdf24155ea5299f40
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1582 (PresentX 1582)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17048 MB

Not tested

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the changes, 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 test modules at the end of crates/xcl/src/hle/d3d12x/real.rs; both kept) and reran the suite and smoke runs above.

🤖 Generated with Claude Code

@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 6337e42 (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: 754 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: set_predication_x_adds_the_buffer_delta, set_predication_x_is_restored_after_a_pc_reset, title_slot_31_runs_set_predication_x.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 754 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
ivall#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- ivall#1321 (ivall#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB)
- ivall#549, ivall#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- ivall#1365 (ivall#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- ivall#1368: translated compute PSOs use NodeMask 0
- ivall#1371 (ivall#105): deduplicate packed ISG1 vertex input struct fields
- ivall#1375 (ivall#1360): ES s_setpc_b64 ends block before gs_start
- ivall#1350, ivall#1351, ivall#1352, ivall#1353, ivall#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- ivall#1305, ivall#1306, ivall#1314, ivall#1319, ivall#1322, ivall#1334, ivall#1339, ivall#1355, ivall#1357, ivall#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups
- README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap

Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0).

Assisted-by: Antigravity (Google DeepMind)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
ivall#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- ivall#1321 (ivall#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB)
- ivall#549, ivall#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- ivall#1365 (ivall#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- ivall#1368: translated compute PSOs use NodeMask 0
- ivall#1371 (ivall#105): deduplicate packed ISG1 vertex input struct fields
- ivall#1375 (ivall#1360): ES s_setpc_b64 ends block before gs_start
- ivall#1350, ivall#1351, ivall#1352, ivall#1353, ivall#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- ivall#1305, ivall#1306, ivall#1314, ivall#1319, ivall#1322, ivall#1334, ivall#1339, ivall#1355, ivall#1357, ivall#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups
- README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap

Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0).

Assisted-by: Antigravity (Google DeepMind)
@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (One run showed a single flaky failure / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@thehollowedone

Copy link
Copy Markdown

Independent Windows check on 6337e42. RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC 1.8.2502.11.

The clean cargo build --workspace --offline --locked -j 4 passed. cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4 finished with 754 passed, 0 failed, 41 ignored. Cargo's pass count includes two native wave64 runtime skips. The three stock #31 tests passed.

A scratch fixture called the #31 implementation with an injected 8-byte placement delta on a real D3D12 direct list. Offset 0 would have read a nonzero value, while translated offset 8 read zero. GPU readback showed the conditional copies were suppressed both before and after KickoffX. A marker observed after a fence and before the final submission confirmed that kickoff actually submitted the first segment. The null-predicate and nonzero controls both copied successfully. Removing only the binding replay made the copy after kickoff execute and failed the readback assertion. The focused test filter was local_native_predication_survives_kickoff_with_placement_offset. It passed with the D3D12 debug layer enabled and no skips.

This probes the #31 implementation and real kickoff, with slot mapping covered by the stock test. No guest ABI call, mid-list wait split or retail smoke was run. AI use: Codex (GPT-6, exact variant unspecified) wrote the fixture, ran the checks and drafted this report.

emirduran707 and others added 2 commits November 25, 2026 14:52
…elta

A title's xcl-dev#31 is the PC's SetPredication (xcl-dev#55, `console_remap`), but no
XCL code ran on it: slot 31 was in neither `console_slots` nor
`NEWER_LIST_SLOTS`. XCL places some buffers below the title's address
and keeps the difference in `BUFFER_DELTA`; every other PC method that
takes a buffer offset adds `buffer_delta(res)` (ResolveQueryData,
CopyBufferRegion, CopyTextureRegion, ExecuteIndirect). SetPredication
did not, so after ResolveQueryData(heap, BINARY_OCCLUSION, i, 1, buf,
off) wrote the predicate at off + delta, SetPredication(buf, off, op)
read it at off.

`set_predication_x` adds the delta (a null buffer passes through) and
is installed at xcl-dev#31. Tests: with a delta of 0x200, xcl-dev#31 at offset 0x10
reaches the PC method at 0x210 (it reached it at 0x10 before), and
console slot 31 has the handler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KickoffX and the Wait64 mid-list split close, submit and reset the PC
list mid-recording, and set again what the title had set: on the
console a kickoff leaves the list's state as it was (`Bindings`). They
re-applied predication only from `ListState::predication`, which only
xcl-dev#85 SetPredicationBufferX sets; `restore_bindings` had none. So
predication set through xcl-dev#31 SetPredication was lost at a kickoff or a
split, and the draws after it ran unpredicated.

`set_predication_x` records the PC call (buffer, offset with the
buffer's delta, operation) in `Bindings` (none for a null buffer) and
`restore_bindings` issues it again on direct and compute lists. The
last of xcl-dev#31 and xcl-dev#85 is the one in effect, as on the PC list: xcl-dev#31 clears
xcl-dev#85's op (its buffer still goes back to COMMON at Close / KickoffX
through `pred_in_state`), xcl-dev#85 clears the xcl-dev#31 record, and xcl-dev#85's copy
into its predication buffer first disarms a xcl-dev#31 predicate too, so the
copy is not predicated away.

Test: with a delta of 0x200, after xcl-dev#31 at offset 0x10 a restore issues
SetPredication(buf, 0x210, op) on direct and compute lists (none
before); none after xcl-dev#31 with a null buffer or xcl-dev#85 with none; xcl-dev#85
after xcl-dev#31 disarms first and leaves only xcl-dev#85's state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@emirduran707
emirduran707 force-pushed the d3d12x-console-set-predication branch from 6337e42 to 96ecec1 Compare November 25, 2026 12:13
@thehollowedone

Copy link
Copy Markdown

Finding after comparing this PR with current main (b49be18): #1349 tracks native SetPredication through console slot #31, but the deferred path added by #2118 currently restores only descriptor heaps. A predicate stored in Bindings therefore is not reapplied to a deferred segment by #1349 alone.

The newer restore_bindings change in #2611 should carry it when both changes are integrated, but the existing #1349 tests cover KickoffX and mid-list reset, not a pending deferred draw or dispatch. A focused regression could set #31, defer an ExecuteIndirect with a pending pipeline, and verify the predicate and adjusted offset are restored before replay; the same check would cover #2118's deferred dispatch path.

I did not find another open PR for the native #31 tracking. AI-assisted.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

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.

4 participants