Skip to content

D3D12.X: an ExecuteIndirect dispatch of an untranslated compute pipeline is skipped, as Dispatch is - #1195

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
ofc0urse:fix/execute-indirect-untranslated-compute
Nov 24, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
ofc0urse:fix/execute-indirect-untranslated-compute

Conversation

@ofc0urse

@ofc0urse ofc0urse commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Dispatch skips a console compute pipeline that has no translation (its build failed). ExecuteIndirect sent the same pipeline to the PC call, after setting only the graphics root signature. The dispatch then ran with whatever compute root signature the list held, which can still be XCL's ABI one from a translated dispatch before it. The debug layer reports that pair as error 953 ("the currently set Root Signature doesn't match the currently set Pipeline State Object"). Follows #574, which skips the same call for a pipeline that is still being built.

What is in it

  • crates/xcl/src/hle/d3d12x/device_x.rs: create_command_signature_x notes whether a new signature has a Dispatch argument, at every creation, so a signature made later at a freed one's address does not inherit the kind.
  • crates/xcl/src/hle/d3d12x/real.rs: compute pipelines made from a console shader that runs untranslated (the stand-in of a background build, the fallback of a console shader that failed) are noted in CONSOLE_COMPUTE and dropped with the pipeline in forget_pso.
  • crates/xcl/src/hle/d3d12x/bind.rs: execute_indirect skips a Dispatch signature when the bound pipeline is one of those, counted as a skipped dispatch and logged like dispatch does. Draw signatures and native PC compute pipelines go to the PC call as before.
  • Test: async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect gets two more cases. A failed console compute stand-in with a Dispatch signature must not reach the PC ExecuteIndirect (fails without the change in bind.rs). A native PC compute pipeline with the same signature still reaches it (fails with a guard on the signature alone, the first version of this PR, found by @thehollowedone). The same address noted again without a Dispatch argument goes to the PC call, and a released pipeline's address is no longer a console one.

Tested

  • NVIDIA GeForce RTX 4060 Ti 8 GB (driver 32.0.16.2124), Intel Core i5-14400F, 32 GB RAM, Windows 11 Pro 26300, rustc 1.100.0, debug (tests) and release (game runs, smoke).
  • cargo build --workspace + cargo test --workspace -- --test-threads=4: 741 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2, no wave64)
  • Retail title 1.0.2.1 with XCL_D3D12_DEBUG=1, XCL_PSO_WAIT_MS=50, through the account screen into the world load. To get compute builds that fail, these runs also carry a local patch that is not part of this PR: compute programs of 768 KB of DXIL or more are refused instead of compiled (XCL_SKIP_CS_KB=768, 11 programs refused per run; on this card such programs take 60 to 97 s each in the driver).
    • without this change, two runs: error 953 reached the cap of 8 per id at 138 s and at 199 s, a few seconds after the world load starts.
    • with this change, same build otherwise, two runs (the first version of this PR, then the current one): 0 errors 953; the new skip line appears at 197.8 s and at 109.9 s.
    • plain main without the local patch: no compute build failed in that run and 953 did not appear, so on this title the case needs a compute program that fails to translate or that the driver rejects.
  • All runs, with and without this change, still end in DEVICE_HUNG between 188 and 257 s (the queue stalls of Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505). This PR does not change that.

Regression run

main with the cache warm. A first pair, run in the order main then PR, gave 274 and 1046 frames: whichever build ran first on a cold pipeline cache paid for it. The PR block is the current head; the first version of this PR (c1ebdac) showed the same 1558 frames as main.

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 4060 Ti
title: 83d1f0b1
seconds: 60
exit: 0x0
frames shown: 1558 (PresentX 1558)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18355 MB

PR:

xcl-smoke v1
commit: d6ff44ce9ac2bacb4d58f3a832cccc39239fd9d3
gpu: NVIDIA GeForce RTX 4060 Ti
title: 83d1f0b1
seconds: 60
exit: 0x0
frames shown: 1421 (PresentX 1422)
presents per 2 s (last 3): 49 60 60
device removals: 0
crashes: 0
peak commit: 20087 MB

Not tested

  • AMD and Intel GPUs, Wine.
  • A compute build that fails on its own (without the local patch above).

AI use

  • Claude Code (Claude Opus 5.5) traced the 953 to this path from debug-layer logs, wrote the change and the test, ran the builds, tests and game runs. I reviewed the change and the results.

🤖 Generated with Claude Code

@thehollowedone

Copy link
Copy Markdown

The new guard also skips a valid native PC compute pipeline when its indirect signature is created through XCL’s console path. A synthetic one-group dispatch used a native cs_5_0 pipeline, a matching compute root signature and UAV, and a DispatchX signature created by create_command_signature_x. I called XCL’s console execute_indirect and read back the UAV after the fence.

  • Main 47efa2e wrote 0x12345678.
  • PR c1ebdac logged the new skip message and left the UAV at zero.
  • In scratch, I required the bound pipeline to be a tracked async compute stand-in with done == true and real == 0 before taking the new skip branch. This restored 0x12345678 and the stock async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect test still passed.

All three GPU runs completed with zero debug-layer messages. Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. Command cargo test --offline --locked -p xcl --lib <filter> -- --nocapture --test-threads=1. This verifies the native control and the failed async case. Retail and synchronous fallback behavior were outside the check.

AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch checks and drafted this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

  • cargo test -p xcl --lib bind: 8 passed, 0 failed — the ExecuteIndirect untranslated-compute skip matches the Dispatch behaviour and the bind suite stays green.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

…ine is skipped, as Dispatch is

Dispatch skips a console compute pipeline without a translation (a build that failed). ExecuteIndirect sent the same pipeline to the PC call after setting only the graphics root signature, so the dispatch ran with the list's compute root signature, which can still be XCL's ABI one from a translated dispatch before it. The D3D12 debug layer reports that pair as error 953 during a retail title's world load.

Command signatures with a Dispatch argument are now noted when they are made (and forgotten when a signature without one is made at the same address). Compute pipelines made from a console shader that runs untranslated (a background build's stand-in, the fallback of a console shader that failed) are noted too, and dropped with the pipeline. ExecuteIndirect skips a Dispatch signature only for those; a native PC compute pipeline still goes to the PC call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xTehuti

Copy link
Copy Markdown

Test report on NVIDIA GeForce RTX 2070 SUPER (Turing, wave32)

Commit tested
c1ebdacf0cd2cab91c2fc1ca7227c2074885c8ff (PR #1195 head)

Tested

  • Hardware:
    • GPU: NVIDIA GeForce RTX 2070 SUPER (Driver 595.79 / 32.0.15.9579, 7989 MiB VRAM)
    • CPU: Intel Core i7-10700K CPU @ 3.80GHz
    • OS: Windows 11 x64, Rust 1.99.0, DXC 1.8.2502.11
  • Command run and results:
    • cargo test --test gpu_compute_e2e:
      2 passed; 0 failed; finished in 0.54s
      • async_compute_pso_registers_real_pso_and_not_standin ... ok
      • console_wave64_compute_through_the_pso_hook_dispatch_and_read_back ... ok
  • Findings:
    • Verified D3D12.X compute PSO registration, stand-in behavior, and compute dispatch/read-back through the real backend on NVIDIA hardware.
    • No regressions observed in compute list execution or command signature dispatch.

Not tested

  • Retail game smoke run with synthetic debug-layer error injection.

AI use

  • Tool: Antigravity / T3 Code
  • Model: Gemini 3.8 Flash
  • Details: Checked out PR commit in isolated worktree, built and verified compute E2E test suite against real D3D12 hardware.

@ofc0urse
ofc0urse force-pushed the fix/execute-indirect-untranslated-compute branch from c1ebdac to d6ff44c Compare November 24, 2026 13:35
@ofc0urse

Copy link
Copy Markdown
Contributor Author

@thehollowedone Thanks, you're right: the guard looked only at the signature, so a native PC compute pipeline went down with the failed console ones.

Fixed in d6ff44c (squashed into the one commit). XCL now notes compute pipelines made from a console shader that runs untranslated: the stand-in of a background build, and the fallback of a console shader that failed while it was being made. They are dropped with the pipeline. ExecuteIndirect skips a Dispatch signature only for those, so your native cs_5_0 control goes to the PC call as on main.

The test has your case as step 4: a pipeline not made from a console shader, bound with the same Dispatch signature, reaches the PC ExecuteIndirect. It fails with the old guard and passes now. I used a set of console pipelines instead of done && real == 0 so that the synchronous fallback is covered as well.

@JoaoPauluu

Copy link
Copy Markdown

A regression run under Wine on Linux, on a retail title.

Tested

Regression run

main (first run):

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1384 (PresentX 1384)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: d6ff44ce9ac2bacb4d58f3a832cccc39239fd9d3
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1405 (PresentX 1405)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1425 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…vall#1142, ivall#1150, ivall#1156, ivall#1182, ivall#1191, ivall#1195, ivall#1221

Integrate 10 high-impact open upstream PRs on top of upstream/main (930e8b4):
- ivall#1182: share video memory across render targets aliased onto one physical page (~1.85-2.1 GB VRAM saved)
- ivall#1142: declare tiled texture pools texture-only (D3D12_HEAP_FLAG_DENY_BUFFERS) for vkd3d-proton
- ivall#1097: report process memory under Wine via PagefileUsage fallback
- ivall#1078: bound BCPack record scratch memory to 2 KiB stack batches
- ivall#1150: convert console clear-value formats in CreatePlacedResource
- ivall#1156: release the interface returned by QueryInterface in class_for
- ivall#1139: check pointer alignment in is_adopted before dereferencing
- ivall#1195: skip ExecuteIndirect dispatch of untranslated console compute pipelines
- ivall#1191: VirtualProtect commits lazy pages in its range first
- ivall#1221: unmark lazy away mappings in FreeTitlePhysicalPages

Assisted-by: Antigravity (Google DeepMind)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…ll#1221, and updated Linux PRs

Update fork README for upstream/main 930e8b4 (BCPack BC1-BC7, XCL_PSO_WAIT_MS, low-VA ASLR < 2^40, alloc_pool, sparse tile parking/pool reuse, direct page moves, write-watch merge), newly integrated PRs (ivall#1078, ivall#1097, ivall#1139, ivall#1142, ivall#1150, ivall#1156, ivall#1182, ivall#1191, ivall#1195, ivall#1221), and updated Linux PRs (ivall#867, ivall#871, ivall#877).

Assisted-by: Antigravity (Google DeepMind)
@thehollowedone

Copy link
Copy Markdown

Confirmed the follow-up fix on d6ff44c. Windows 11 build 26300, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug.

The synthetic fixture created a real console DispatchX command signature through XCL and submitted the list to D3D12. With a native compute pipeline, ExecuteIndirect wrote all eight expected values and the skipped-dispatch counter stayed flat. With the same pipeline marked as an untranslated console stand-in, the eight outputs stayed zero and the counter rose by one.

cargo test --offline --locked -p xcl --lib hle::d3d12x::bind::tests -- --test-threads=1 passed 5/5. The scratch GPU readback test passed once per case with no skips. Synthetic inputs only.

AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the fixture and drafted this reply.

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…d harden compute/sparse paths

- crates/xcl/src/hle/d3d12x/pso_async.rs (fixes 1 MiB thread stack overflow / deadlock seen alongside ivall#611):
  Add urgent_queue() spawning dedicated 64 MiB-stack xcl-pso-wait-* workers and offload unstarted jobs in resolve_wait_for(..., None) instead of executing job() inline on the title's 1 MiB stack threads, avoiding silent Wine thread deaths without skipping compute dispatches (ivall#675, ivall#891). Guard build() with std::panic::catch_unwind plus a Drop completion guard so panics always call complete(p, 0) and notify waiters.
- crates/xcl/src/hle/d3d12x/pso_async.rs & kernelx.rs (ivall#1288, ivall#505, ivall#232):
  Track active pipeline bind waits via HELD / title_held() and export kernelx::Sleep backed by title_sleep() so Sleep skips counting time spent blocked on background PSO compilation (XCL_SLEEP_HOLD=0 disables).
- crates/xcl/src/hle/d3d12x/bind.rs, device_x.rs & real.rs (ivall#1195):
  Track console compute PSOs (CONSOLE_COMPUTE) and Dispatch-capable command signatures (DISPATCH_SIGNATURES) so ExecuteIndirect skips dispatches against untranslated console compute stand-ins or fallbacks while still forwarding native PC compute pipelines.
- crates/xcl/src/hle/d3d12x/sparse.rs (ivall#1419, ivall#1277):
  Extract wait_fence_until() to ResetEvent before SetEventOnCompletion and re-check GetCompletedValue() until target or deadline so stale signals on the reusable auto-reset event cannot end waits early; bail cleanly from upload_dirty() if ring fence reclaim times out instead of holding STATE indefinitely.
- crates/xcl/src/gpu/recomp/emit.rs & tests.rs (ivall#1361):
  Split GFX10.30 SADDR == 0x7F (ST immediate-only 0u base) from SADDR == 0x7D (v[ADDR] base) in Em::scratch and update ENC_FLAT_SCRATCH VADDR test encodings to 0x7D.

Assisted-by: Antigravity (Gemini 4 Neon)
@raylitebull
raylitebull merged commit 6c89285 into xcl-dev:main Nov 24, 2026
3 of 4 checks passed
wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
…cl-dev#1288 Sleep hold, xcl-dev#1195 ExecuteIndirect skip)

Conflicts:
- tests.rs memory_windows_reject_out_of_uma_aliasing: xcl-dev#1693 builds the switch /
  heap form through direct_or (the direct translator with XCL_DIRECT_DXIL=1);
  the flat form of our flat window loads stays a DXC compile, as in
  gpu_sparse_vram_descriptors_buffers_and_xmem.
- pso_async.rs resolve_wait: xcl-dev#1288's `Held` guard (pso_async::title_held, which
  kernelx::Sleep does not count) goes into our resolve_wait_in after note_use, so it
  covers the bind's whole wait in every form: XCL_PSO_WAIT_MS /
  XCL_PSO_WAIT_MS_GRAPHICS budgets, XCL_PSO_SKIP_HUGE, a build on the binding thread.
  Its test calls our three-argument resolve_wait_for.

xcl-dev#1195 merged without conflict: in execute_indirect our skip of a pending stand-in or
a two-pass pipeline comes first, then xcl-dev#1195's skip of a Dispatch signature with an
untranslated console compute pipeline (a failed build's stand-in, the fallback of a
console shader that failed), which we sent to the PC call, then the PC-pipeline block
with 515b576's gpu_profile::end(.., breadcrumb). xcl-dev#1195's skip leaves a breadcrumb, as
our other ExecuteIndirect skips do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants