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

Open
github-bot wants to merge 2 commits from github-bot/gh-1349 into main AGit
Owner

@⁠emirduran707 on GitHub · 2026-11-24 15:08 UTC · original
emirduran707:d3d12x-console-set-predication → main · +161 −1 · 2 files · 2 commits · open

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 (#85). So predication set through #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)

  • D3D12.X: list #31 SetPredication adds the buffer's placement delta:
    • set_predication_x in list_x.rs, installed at slot 31 in real.rs;
    • tests set_predication_x_adds_the_buffer_delta and title_slot_31_runs_set_predication_x.
  • D3D12.X: KickoffX and mid-list splits keep #31 SetPredication:
    • the #31 call is recorded in the list's bindings and re-issued by restore_bindings on direct and compute lists. The last of #31 and #85 wins; #85's copy into its own buffer switches #31's predicate off first;
    • test set_predication_x_is_restored_after_a_pc_reset.

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

  • A title that predicates through #31 on a placed buffer, or across a kickoff; the smoke title's run is a regression check only.
  • The #31 record keeps the title's buffer pointer: a title that released the buffer while predication was set, then kicked off, would have it re-issued.
  • NVIDIA and Intel GPUs.

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

**@⁠emirduran707** on GitHub · 2026-11-24 15:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349) `emirduran707:d3d12x-console-set-predication` → `main` · +161 −1 · 2 files · 2 commits · open 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 (#85). So predication set through #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) - `D3D12.X: list #31 SetPredication adds the buffer's placement delta`: - `set_predication_x` in `list_x.rs`, installed at slot 31 in `real.rs`; - tests `set_predication_x_adds_the_buffer_delta` and `title_slot_31_runs_set_predication_x`. - `D3D12.X: KickoffX and mid-list splits keep #31 SetPredication`: - the #31 call is recorded in the list's bindings and re-issued by `restore_bindings` on direct and compute lists. The last of #31 and #85 wins; #85's copy into its own buffer switches #31's predicate off first; - test `set_predication_x_is_restored_after_a_pc_reset`. **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** - A title that predicates through #31 on a placed buffer, or across a kickoff; the smoke title's run is a regression check only. - The #31 record keeps the title's buffer pointer: a title that released the buffer while predication was set, then kicked off, would have it re-issued. - NVIDIA and Intel GPUs. **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](https://claude.com/claude-code)
A title's #31 is the PC's SetPredication (#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 #31. Tests: with a delta of 0x200, #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 <[email protected]>
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
#85 SetPredicationBufferX sets; `restore_bindings` had none. So
predication set through #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 #31 and #85 is the one in effect, as on the PC list: #31 clears
#85's op (its buffer still goes back to COMMON at Close / KickoffX
through `pred_in_state`), #85 clears the #31 record, and #85's copy
into its predication buffer first disarms a #31 predicate too, so the
copy is not predicated away.

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:51:32 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 15:14 UTC · original · edited 2026-11-24 15:19 UTC

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.
**@⁠futurepro62** on GitHub · 2026-11-24 15:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7135683635) · edited 2026-11-24 15:19 UTC 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 16:17 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-24 16:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7137435423) 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!
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-25 09:16 UTC · original

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.

**@⁠thehollowedone** on GitHub · 2026-11-25 09:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7158103433) Independent Windows check on [6337e42](https://github.com/xcl-dev/xcl/commit/6337e421952a0a0c6bbe24a94d04bfb5275fb4c1). 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.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-26 04:03 UTC · original

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.

**@⁠thehollowedone** on GitHub · 2026-11-26 04:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7182262608) 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](https://git.gtahub.st/github/xcl-dev--xcl/pulls/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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:53 UTC · original

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

**@⁠DavidM1911** on GitHub · 2026-11-26 04:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7182988349) 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
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-26 09:21 UTC · original

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).

**@⁠emirduran707** on GitHub · 2026-11-26 09:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7187852051) 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).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1349/head:github-bot/gh-1349'
git switch 'github-bot/gh-1349'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1349'
git switch 'github-bot/gh-1349'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1349'
git switch 'github-bot/gh-1349'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1349'
git switch 'main'
git merge --squash 'github-bot/gh-1349'
git switch 'main'
git merge --ff-only 'github-bot/gh-1349'
git switch 'main'
git merge 'github-bot/gh-1349'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.