D3D12.X: respect compute lists and retain root signature in execute_i… #1764

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

@⁠fixgep on GitHub · 2026-11-24 20:23 UTC · original
fixgep:fix/execute-indirect-compute-root-sig → main · +370 −22 · 1 files · 2 commits · open

Fixes untranslated ExecuteIndirect root-signature binding on D3D12_COMMAND_LIST_TYPE_COMPUTE lists and retains COM root signature references in bind::State. Previously, bind::State held an unretained raw rs_gfx: usize without tracking rs_cmp, and execute_indirect unconditionally called SetGraphicsRootSignature with rs_gfx — which is invalid on COMPUTE command lists and vulnerable to COM use-after-free if the caller releases the root signature before ExecuteIndirect. Part of #1488 (XCL-BT-019).

What is in it

  • bc01e87 (crates/xcl/src/hle/d3d12x/bind.rs): track retained Option<ID3D12RootSignature> for both rs_cmp and rs_gfx (dropping replaced references outside STATES), dispatch SetComputeRootSignature vs SetGraphicsRootSignature by GetType in execute_indirect, retain rs_gfx across graphics_bound, and add synthetic COM and D3D12 compute ExecuteIndirect tests.

Tested

  • Hardware & toolchain: NVIDIA GeForce RTX 3060 (driver 32.0.15.9144), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 Pro (build 26200), rustc 1.100.0 (0ef1bc386 2026-11-09) (debug tests, release smoke build).
  • cargo test -p xcl --lib hle::d3d12x::bind::tests: 7 passed, 0 failed, 0 ignored (743 filtered out).
  • cargo test -p xcl --test e2e: 3 passed, 0 failed, 0 ignored.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 777 passed, 1 failed (gpu::recomp::tests::gpu_clamp_and_omod_per_instruction, pre-existing v_pk_add_i16 clamp failure on this GPU), 41 ignored across workspace test binaries:
    • xcl --lib: 728 passed, 1 failed, 21 ignored
    • bcpack_parity: 1 passed, 0 failed, 0 ignored
    • console_dlls_e2e: 13 passed, 0 failed, 0 ignored
    • console_shaders: 3 passed, 0 failed, 4 ignored
    • disasm_e2e: 1 passed, 0 failed, 0 ignored
    • e2e: 3 passed, 0 failed, 0 ignored
    • gpu_compute_e2e: 4 passed, 0 failed, 0 ignored
    • gpu_pso_e2e: 7 passed, 0 failed, 0 ignored
    • heap_probe: 0 passed, 0 failed, 4 ignored
    • low_va: 1 passed, 0 failed, 0 ignored
    • pls_quota: 1 passed, 0 failed, 0 ignored
    • predication_e2e: 1 passed, 0 failed, 0 ignored
    • rpf_e2e: 2 passed, 0 failed, 0 ignored
    • shaders_e2e: 4 passed, 0 failed, 0 ignored
    • sparse_reinit: 1 passed, 0 failed, 0 ignored
    • texture_states: 1 passed, 0 failed, 0 ignored
    • xg_oracle: 6 passed, 0 failed, 12 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), 1 (no heap windows: heap_window_out_of_memory_falls_back_to_the_switch_form).

Regression run

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1152 (PresentX 1152)
presents per 2 s (last 3): 60 59 61
device removals: 0
crashes: 0
peak commit: 15348 MB

```text
xcl-smoke v1
commit: 119d483161074b074fe91574043b1a5eb0e25f5a
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1059 (PresentX 1059)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15384 MB

Not tested

  • AMD / wave64-capable GPUs and the heap-windows path.
  • XCL_SAMPLE_* tests on retail sample data (variables not set).
  • Running execute_indirect_on_d3d12_compute_list_with_and_without_root_signature in a standalone process with EnableDebugLayer() forced on (the test checks ID3D12InfoQueue if already present on the device, while e2e::test_title_draws_with_a_root_signature_under_the_debug_layer ran under XCL_D3D12_DEBUG=1 and passed).

AI use

  • Antigravity with Gemini 4 Hydrogen: wrote the fix in crates/xcl/src/hle/d3d12x/bind.rs, added the two synthetic tests, ran the unit/workspace test suites and both smoke.ps1 runs, and drafted this PR description.
**@⁠fixgep** on GitHub · 2026-11-24 20:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1764) `fixgep:fix/execute-indirect-compute-root-sig` → `main` · +370 −22 · 1 files · 2 commits · open Fixes untranslated `ExecuteIndirect` root-signature binding on `D3D12_COMMAND_LIST_TYPE_COMPUTE` lists and retains COM root signature references in `bind::State`. Previously, `bind::State` held an unretained raw `rs_gfx: usize` without tracking `rs_cmp`, and `execute_indirect` unconditionally called `SetGraphicsRootSignature` with `rs_gfx` — which is invalid on `COMPUTE` command lists and vulnerable to COM use-after-free if the caller releases the root signature before `ExecuteIndirect`. Part of #1488 (`XCL-BT-019`). **What is in it** - `bc01e87` (`crates/xcl/src/hle/d3d12x/bind.rs`): track retained `Option<ID3D12RootSignature>` for both `rs_cmp` and `rs_gfx` (dropping replaced references outside `STATES`), dispatch `SetComputeRootSignature` vs `SetGraphicsRootSignature` by `GetType` in `execute_indirect`, retain `rs_gfx` across `graphics_bound`, and add synthetic COM and D3D12 compute `ExecuteIndirect` tests. **Tested** - Hardware & toolchain: NVIDIA GeForce RTX 3060 (driver `32.0.15.9144`), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 Pro (build `26200`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` (debug tests, release smoke build). - `cargo test -p xcl --lib hle::d3d12x::bind::tests`: 7 passed, 0 failed, 0 ignored (743 filtered out). - `cargo test -p xcl --test e2e`: 3 passed, 0 failed, 0 ignored. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: 777 passed, 1 failed (`gpu::recomp::tests::gpu_clamp_and_omod_per_instruction`, pre-existing `v_pk_add_i16 clamp` failure on this GPU), 41 ignored across workspace test binaries: - `xcl --lib`: 728 passed, 1 failed, 21 ignored - `bcpack_parity`: 1 passed, 0 failed, 0 ignored - `console_dlls_e2e`: 13 passed, 0 failed, 0 ignored - `console_shaders`: 3 passed, 0 failed, 4 ignored - `disasm_e2e`: 1 passed, 0 failed, 0 ignored - `e2e`: 3 passed, 0 failed, 0 ignored - `gpu_compute_e2e`: 4 passed, 0 failed, 0 ignored - `gpu_pso_e2e`: 7 passed, 0 failed, 0 ignored - `heap_probe`: 0 passed, 0 failed, 4 ignored - `low_va`: 1 passed, 0 failed, 0 ignored - `pls_quota`: 1 passed, 0 failed, 0 ignored - `predication_e2e`: 1 passed, 0 failed, 0 ignored - `rpf_e2e`: 2 passed, 0 failed, 0 ignored - `shaders_e2e`: 4 passed, 0 failed, 0 ignored - `sparse_reinit`: 1 passed, 0 failed, 0 ignored - `texture_states`: 1 passed, 0 failed, 0 ignored - `xg_oracle`: 6 passed, 0 failed, 12 ignored - `SKIPPED` GPU tests on this adapter: 2 (`no wave64`: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`), 1 (`no heap windows`: `heap_window_out_of_memory_falls_back_to_the_switch_form`). **Regression run** ```text xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1152 (PresentX 1152) presents per 2 s (last 3): 60 59 61 device removals: 0 crashes: 0 peak commit: 15348 MB ```text xcl-smoke v1 commit: 119d483161074b074fe91574043b1a5eb0e25f5a gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1059 (PresentX 1059) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15384 MB ``` **Not tested** - AMD / wave64-capable GPUs and the heap-windows path. - `XCL_SAMPLE_*` tests on retail sample data (variables not set). - Running `execute_indirect_on_d3d12_compute_list_with_and_without_root_signature` in a standalone process with `EnableDebugLayer()` forced on (the test checks `ID3D12InfoQueue` if already present on the device, while `e2e::test_title_draws_with_a_root_signature_under_the_debug_layer` ran under `XCL_D3D12_DEBUG=1` and passed). **AI use** - Antigravity with Gemini 4 Hydrogen: wrote the fix in `crates/xcl/src/hle/d3d12x/bind.rs`, added the two synthetic tests, ran the unit/workspace test suites and both `smoke.ps1` runs, and drafted this PR description.
Part of #1488 (XCL-BT-019).

Assisted-by: Antigravity (Gemini 4 Hydrogen)
# Conflicts:
#	crates/xcl/src/hle/d3d12x/bind.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:04:14 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 21:21 UTC · original · edited 2026-11-24 21:43 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 119d483 (on its base 4178e88).

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, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 891 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: execute_indirect_compute_list_respects_list_type_and_retains_root_signature, execute_indirect_on_d3d12_compute_list_with_and_without_root_signature.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 893 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (#1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set XCL_REQUIRE_GPU, so there both just print SKIPPED.

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 21:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1764#issuecomment-7144823351) · edited 2026-11-24 21:43 UTC Full-suite run, since this PR has no test report yet. Tested exact head `119d483` (on its base `4178e88`). **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, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record`: **891 passed, 0 failed, 42 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `execute_indirect_compute_list_respects_list_type_and_retains_root_signature`, `execute_indirect_on_d3d12_compute_list_with_and_without_root_signature`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **893 passed, 0 failed, 42 ignored**. SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), `pso_measurement_compiles_an_exact_synthetic_record` (cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)). - Two tests were skipped with `--skip` on NVIDIA. Both fail on main `7f7e768` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns their skips into failures. `heap_window_out_of_memory_falls_back_to_the_switch_form` skips when `XCL_HEAP_WINDOWS` is unset (#1651), and `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set `XCL_REQUIRE_GPU`, so there both just print SKIPPED. **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 23:14 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 23:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1764#issuecomment-7147174039) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠throny on GitHub · 2026-11-25 18:10 UTC · original

Two contributors checked independently and found that #1925 solves the same problem (for #1488) in a different way: #1607, group D93. 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.

**@⁠throny** on GitHub · 2026-11-25 18:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1764#issuecomment-7170552466) <!-- xcl-1607-hint:D93 --> Two contributors checked independently and found that #1925 solves the same problem (for #1488) in a different way: #1607, group D93. 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.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/bind.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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