D3D12.X: ExecuteIndirect skips a stand-in whose build ends during the call #2598

Open
github-bot wants to merge 1 commit from github-bot/gh-2598 into main AGit
Owner

@⁠iggyvilla on GitHub · 2026-11-26 01:16 UTC · original
iggyvilla:execute-indirect-pending-race-r2 → main · +50 −1 · 2 files · 1 commits · open

execute_indirect resolves the bound pipeline with resolve_wait, then asks is_pending whether it was a stand-in of a pipeline still being built. If the build ends between the two calls, is_pending is false while pso is still the stand-in (or, for a shared stand-in, the shared driver pipeline). With a signature that is not a Dispatch one, the call then goes to the PC ExecuteIndirect with the stand-in and the list's root signature. That is the pair the skip exists to avoid (debug layer 953; a retail title's world hung the GPU, 0x887a0006, see the comment above the check). The window opens whenever a bind does not wait for the build to the end: with XCL_PSO_WAIT_MS or XCL_PSO_IMAGE_SKIP=1, and for every bind of a cold pipeline with #2615, which makes no bind wait by default. Either of the two can land first.

pso_async::bound_unbuilt(raw_pso, pso) takes one lookup and answers for what the bind got: pso is the stand-in and the build has not failed. A build that ended since does not change the answer. A failed build's stand-in is still not "unbuilt", so it goes on to the console-compute check below, as before (#2342).

#2118 puts a dispatching ExecuteIndirect of a console compute pipeline that is still being built off to the submit. That check comes before resolve_wait and leaves this window as it was. A pipeline whose build ends between resolve_wait and the check still takes the path above. So does a call recorded at the submit, through the same function. So does a call that could not be put off: a signature that does not dispatch, or a list that cannot be split.

#1652 also fixes this, with resolve_wait_critical returning (pso, pending) from one lookup, as part of a much larger change (bind waits, pending-draw guards, target init). This PR is the small fix on its own. If #1652 lands first, this one is not needed.

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs: bound_unbuilt.
  • crates/xcl/src/hle/d3d12x/bind.rs: execute_indirect uses it in place of is_pending(raw_pso).
  • Test (pso_async.rs): a_stand_in_bound_before_its_build_ended_stays_unbuilt_for_that_bind. A bind gets the stand-in, then the build ends. is_pending is false (what the old check read) while bound_unbuilt stays true. A bind after the build is not unbuilt, nor is a failed build's stand-in, nor a pipeline that is no stand-in.

Tested

  • AMD Radeon RX 6650 XT 8 GB (RDNA2), driver 32.0.21045.29003, Ryzen 7 5700X, 32 GB, Windows 11, rustc stable-x86_64-pc-windows-msvc. Tests in debug, smoke in release, run in an interactive session, clean trees.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 1e280117: 1429 passed, 1 failed, 47 ignored. The failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 783, res[64] = 0xc, CPU 0x7fffffff), which also fails on main. e2e: 4 passed.
  • SKIPPED: 6× lower_dxil f16/f32 per-lane programs (refused, #1426 semantics), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (the driver cache cannot be disabled without Developer Mode).
  • cargo test -p xcl --lib pso_async on 1e280117: 15 passed, 0 failed.

Regression run (scripts/smoke.ps1, same title, 60 s, adjacent runs in the order main, another PR's head, this PR, main)

main 08db802 (run 1):

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1563 (PresentX 1563)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20035 MB

this PR, 1e280117:

xcl-smoke v1
commit: 1e28011782dd52bdbe245885cc1cb2a4baee9810
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1583 (PresentX 1583)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20132 MB

main 08db802 (run 2):

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1581 (PresentX 1581)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20168 MB

Not tested

  • The race itself on a title, or inside one execute_indirect call: it is rare. Reproducing it needs a hook between the bind's lookup and the check. After this change there is a single lookup, so the decision is bound_unbuilt's, and the unit test covers it.
  • graphics_bound reads is_pending(pso) after its resolve_wait the same way, but only to count a dropped draw and for a frame-trace log line. Not changed here.
  • Tested on AMD RDNA2 only (Radeon RX 6650 XT). NVIDIA, RDNA4 and wave32-only GPUs were not measured.

AI use

  • Duplicate check: o5, Muse Spark 1.3 (XCL-164).
  • Code, test and this description: Claude Code, Claude Opus 5.5 (a3).
  • Workspace suite and smoke runs: Claude Code, Claude Sonnet 5.5 (a1).
  • Launched the runs in the interactive session and read the diff: Claude Code, Claude Opus 5.5 (the coordinator).
  • Diff reviews: o6, Muse Spark 1.3 (XCL-168, XCL-173).
**@⁠iggyvilla** on GitHub · 2026-11-26 01:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/2598) `iggyvilla:execute-indirect-pending-race-r2` → `main` · +50 −1 · 2 files · 1 commits · open `execute_indirect` resolves the bound pipeline with `resolve_wait`, then asks `is_pending` whether it was a stand-in of a pipeline still being built. If the build ends between the two calls, `is_pending` is false while `pso` is still the stand-in (or, for a shared stand-in, the shared driver pipeline). With a signature that is not a Dispatch one, the call then goes to the PC `ExecuteIndirect` with the stand-in and the list's root signature. That is the pair the skip exists to avoid (debug layer 953; a retail title's world hung the GPU, 0x887a0006, see the comment above the check). The window opens whenever a bind does not wait for the build to the end: with `XCL_PSO_WAIT_MS` or `XCL_PSO_IMAGE_SKIP=1`, and for every bind of a cold pipeline with #2615, which makes no bind wait by default. Either of the two can land first. `pso_async::bound_unbuilt(raw_pso, pso)` takes one lookup and answers for what the bind got: `pso` is the stand-in and the build has not failed. A build that ended since does not change the answer. A failed build's stand-in is still not "unbuilt", so it goes on to the console-compute check below, as before (#2342). #2118 puts a dispatching `ExecuteIndirect` of a console compute pipeline that is still being built off to the submit. That check comes before `resolve_wait` and leaves this window as it was. A pipeline whose build ends between `resolve_wait` and the check still takes the path above. So does a call recorded at the submit, through the same function. So does a call that could not be put off: a signature that does not dispatch, or a list that cannot be split. #1652 also fixes this, with `resolve_wait_critical` returning `(pso, pending)` from one lookup, as part of a much larger change (bind waits, pending-draw guards, target init). This PR is the small fix on its own. If #1652 lands first, this one is not needed. **What is in it** - `crates/xcl/src/hle/d3d12x/pso_async.rs`: `bound_unbuilt`. - `crates/xcl/src/hle/d3d12x/bind.rs`: `execute_indirect` uses it in place of `is_pending(raw_pso)`. - Test (`pso_async.rs`): `a_stand_in_bound_before_its_build_ended_stays_unbuilt_for_that_bind`. A bind gets the stand-in, then the build ends. `is_pending` is false (what the old check read) while `bound_unbuilt` stays true. A bind after the build is not unbuilt, nor is a failed build's stand-in, nor a pipeline that is no stand-in. **Tested** - AMD Radeon RX 6650 XT 8 GB (RDNA2), driver 32.0.21045.29003, Ryzen 7 5700X, 32 GB, Windows 11, rustc stable-x86_64-pc-windows-msvc. Tests in debug, smoke in release, run in an interactive session, clean trees. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `1e280117`: **1429 passed, 1 failed, 47 ignored**. The failure is `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (seed 783, `res[64] = 0xc, CPU 0x7fffffff`), which also fails on `main`. e2e: 4 passed. - SKIPPED: 6× `lower_dxil` f16/f32 per-lane programs (refused, #1426 semantics), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` (the driver cache cannot be disabled without Developer Mode). - `cargo test -p xcl --lib pso_async` on `1e280117`: 15 passed, 0 failed. **Regression run** (`scripts/smoke.ps1`, same title, 60 s, adjacent runs in the order main, another PR's head, this PR, main) main `08db802` (run 1): ``` xcl-smoke v1 commit: 08db8020d323bf478964fcc586152cce54959cfc gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1563 (PresentX 1563) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 20035 MB ``` this PR, `1e280117`: ``` xcl-smoke v1 commit: 1e28011782dd52bdbe245885cc1cb2a4baee9810 gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1583 (PresentX 1583) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 20132 MB ``` main `08db802` (run 2): ``` xcl-smoke v1 commit: 08db8020d323bf478964fcc586152cce54959cfc gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1581 (PresentX 1581) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 20168 MB ``` **Not tested** - The race itself on a title, or inside one `execute_indirect` call: it is rare. Reproducing it needs a hook between the bind's lookup and the check. After this change there is a single lookup, so the decision is `bound_unbuilt`'s, and the unit test covers it. - `graphics_bound` reads `is_pending(pso)` after its `resolve_wait` the same way, but only to count a dropped draw and for a frame-trace log line. Not changed here. - Tested on AMD RDNA2 only (Radeon RX 6650 XT). NVIDIA, RDNA4 and wave32-only GPUs were not measured. **AI use** - Duplicate check: o5, Muse Spark 1.3 (XCL-164). - Code, test and this description: Claude Code, Claude Opus 5.5 (a3). - Workspace suite and smoke runs: Claude Code, Claude Sonnet 5.5 (a1). - Launched the runs in the interactive session and read the diff: Claude Code, Claude Opus 5.5 (the coordinator). - Diff reviews: o6, Muse Spark 1.3 (XCL-168, XCL-173).
`execute_indirect` resolved the bound pipeline (`resolve_wait`) and then
asked `is_pending` again to decide whether what it got is a stand-in of a
pipeline still being built. A build that ended between the two calls made
`is_pending` false while `pso` was still the stand-in (or the shared
stand-in driver pipeline). With a signature that is not a Dispatch one the
call then went to the PC ExecuteIndirect with the stand-in and the list's
root signature, the pair the skip exists to avoid (debug layer 953, a
retail title's GPU hang 0x887a0006).

`pso_async::bound_unbuilt(raw, pso)` answers for what the bind got: `pso`
is the stand-in and the build did not fail. A build that ended since does
not change that; a failed build's stand-in still goes on to the console
compute check below.

The window is reached when a bind does not wait for the build to the end:
`XCL_PSO_WAIT_MS`, `XCL_PSO_IMAGE_SKIP=1`, and without any wait if a bind
stops building cold pipelines itself.

Assisted-by: Claude Code (Claude Opus 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:34:40 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 01:20 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 01:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/2598#issuecomment-7179673125) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 26 ignored. Thanks! — Devin
Author
Owner

@⁠SlopTart on GitHub · 2026-11-26 05:13 UTC · original

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of a_stand_in_bound_before_its_build_ended_stays_unbuilt_for_that_bind: passed.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-26 05:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/2598#issuecomment-7183293359) **Tested**: current PR head merged onto current `origin/main` (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). `gpu_` suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted run of `a_stand_in_bound_before_its_build_ended_stays_unbuilt_for_that_bind`: passed. **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
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/2598/head:github-bot/gh-2598'
git switch 'github-bot/gh-2598'

Merge

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