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
…v#1305-xcl-dev#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- xcl-dev#1321 (xcl-dev#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)
- xcl-dev#549, xcl-dev#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- xcl-dev#1365 (xcl-dev#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- xcl-dev#1368: translated compute PSOs use NodeMask 0
- xcl-dev#1371 (xcl-dev#105): deduplicate packed ISG1 vertex input struct fields
- xcl-dev#1375 (xcl-dev#1360): ES s_setpc_b64 ends block before gs_start
- xcl-dev#1350, xcl-dev#1351, xcl-dev#1352, xcl-dev#1353, xcl-dev#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- xcl-dev#1305, xcl-dev#1306, xcl-dev#1314, xcl-dev#1319, xcl-dev#1322, xcl-dev#1334, xcl-dev#1339, xcl-dev#1355, xcl-dev#1357, xcl-dev#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
…v#1305-xcl-dev#1379

Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability:
- xcl-dev#1321 (xcl-dev#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)
- xcl-dev#549, xcl-dev#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests
- xcl-dev#1365 (xcl-dev#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0
- xcl-dev#1368: translated compute PSOs use NodeMask 0
- xcl-dev#1371 (xcl-dev#105): deduplicate packed ISG1 vertex input struct fields
- xcl-dev#1375 (xcl-dev#1360): ES s_setpc_b64 ends block before gs_start
- xcl-dev#1350, xcl-dev#1351, xcl-dev#1352, xcl-dev#1353, xcl-dev#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication
- xcl-dev#1305, xcl-dev#1306, xcl-dev#1314, xcl-dev#1319, xcl-dev#1322, xcl-dev#1334, xcl-dev#1339, xcl-dev#1355, xcl-dev#1357, xcl-dev#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
Contributor

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
Contributor

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

@emirduran707

Copy link
Copy Markdown
Contributor Author

Thanks for checking against main b49be18 and flagging the #2118 / #2611 interaction @thehollowedone!

Confirmed: #1349 stores the translated native #31 predicate in Bindings and reapplies it on KickoffX and mid-list splits, while #2118's deferred compute path currently only restores descriptor heaps and #2611 is extending that path to full restore_bindings. Keeping #1349 focused on slot #31 + KickoffX / mid-list splits avoids conflicting with #2611 while both are open; if #2611 merges first, I will rebase #1349 onto it and add a deferred-replay regression covering #31 predication (and if #1349 merges first, #2611's restore_bindings will carry it automatically).

@github-actions

github-actions Bot commented Dec 1, 2026

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 Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 96ecec1

No open or merged PR hooks console list slot #31 SetPredication; main only handles #85 SetPredicationBufferX. The change adds buffer_delta as ResolveQueryData does and restores the predicate in restore_bindings; tests cover the delta, kickoff restore and the #31/#85 interplay.
No problems found in the diff. It conflicts with main and needs a rebase.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

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.

5 participants