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

Open
emirduran707 wants to merge 2 commits from upstream-pr/1349 into main
emirduran707 commented 2026-11-24 15:08:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T15:08:23Z.


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

<!-- greyfinch-sync:ivall/xcl:issue:5474798085 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T15:08:23Z. --- 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)
futurepro62 commented 2026-11-24 16:07:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T15:14:14Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7135683635 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1349#issuecomment-7135683635). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T15:14:14Z. --- 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.
DavidM1911 commented 2026-11-24 17:06:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:17:56Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7137435423 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1349#issuecomment-7137435423). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T16:17:56Z. --- 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 commented 2026-11-25 10:10:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T09:16:14Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7158103433 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7158103433). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-25T09:16:14Z. --- 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.
thehollowedone commented 2026-11-26 04:07:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T04:03:55Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7182262608 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7182262608). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-26T04:03:55Z. --- 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://github.com/xcl-dev/xcl/pull/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 commented 2026-11-26 05:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:53:10Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7182988349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7182988349). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T04:53:10Z. --- 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 commented 2026-11-26 10:06:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-26T09:21:43Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7187852051 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7187852051). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-26T09:21:43Z. --- 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[bot] commented 2026-12-01 02:33:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:33:25Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7298743435 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7298743435). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:33:25Z. --- 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.
Foniass commented 2026-12-01 05:30:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:30:23Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7301842373 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1349#issuecomment-7301842373). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:30:23Z. --- **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.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1349:upstream-pr/1349'
git switch 'upstream-pr/1349'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1349'
git switch 'upstream-pr/1349'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1349'
git switch 'upstream-pr/1349'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1349'
git switch 'main'
git merge --squash 'upstream-pr/1349'
git switch 'main'
git merge --ff-only 'upstream-pr/1349'
git switch 'main'
git merge 'upstream-pr/1349'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1339
No description provided.