d3d12: skip named compute programs on request (RT-SKIP-COMPUTE-DIAGNOSTIC) #1341

Closed
github-bot wants to merge 1 commit from gh-pr/1341/head into gh-pr/1341/base
Owner

@⁠Moriz82 on GitHub · 2026-11-24 22:02 UTC · original
split/rt-skip-compute-diagnostic → main · +322 −0 · 3 files · 1 commits · closed without merging

Claimed in the coordination issue as: RT-SKIP-COMPUTE-DIAGNOSTIC (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 (integration source; there the switch hooks into a lazy compute build that main does not have and logs at the first dropped dispatch, here it acts where create_compute builds the pipeline and logs when the state is created). #42 (LEONIDA_STUB_PIPELINES) makes a pipeline with no translated shader a no-op stub. It does not take a translated program out of a run by name.

What and why

A compute program that hangs the GPU or loses the device stops a run at that dispatch. Nothing after it can be looked at until the program or its input is fixed, and there was no way to take one program out of a run to see whether it is the cause.

LEONIDA_SKIP_COMPUTE=<part of a name>[,<part>...] is a diagnostic and is unset by default. A compute program whose library name contains one of the parts (all or *: every compute program) is not built:

  • CreateComputePipelineState does everything it did before except vkCreateShaderModule and vkCreateComputePipelines, returns the same result and writes one line, [rt] d3d12: compute program <name> is skipped (LEONIDA_SKIP_COMPUTE): it is not built and its dispatches are dropped.
  • Replay drops each Dispatch and each ExecuteIndirect dispatch that names the program, with or without a count buffer, and records the rest of the command list. ComputePipeline::skipped carries the mark.
  • What the program would have written keeps its previous contents.

It is a way to isolate a program, not a fix, and no list of names is part of the change: nothing is skipped unless the person running sets the variable. The variable is read once, at the first compute pipeline state.

With the variable unset the list of parts is empty, no pipeline is marked, and the four added tests in prepare and record are false for every pipeline. The existing lines of both functions are unchanged.

Tested

Cross-built on CachyOS Linux 7.3.5 with clang-cl 23.1.5 and the xwin SDK. Ran the Windows tests one at a time under Wine 11.22 (distribution package, fresh prefix) on a Ryzen 5 5600X, 16 GB RAM, NVIDIA GeForce RTX 4070 12 GB, driver 620.73.04.

cmake --build runtime/build/boot --target d3d12_skip_compute_test d3d12_compute_test d3d12_fspx_compute_test d3d12_m4_compute_test d3d12_indirect_zero_test d3d12_execute_indirect_validation_test d3d12_indirect_dispatch_count_test d3d12_pipeline_library_test command_list_test gta6rt -j6
wine d3d12_skip_compute_test.exe
wine d3d12_skip_compute_test.exe --skip-one
wine d3d12_skip_compute_test.exe --skip-all
wine command_list_test.exe
wine d3d12_compute_test.exe
wine d3d12_fspx_compute_test.exe
wine d3d12_m4_compute_test.exe
wine d3d12_indirect_zero_test.exe
wine d3d12_execute_indirect_validation_test.exe
wine d3d12_indirect_dispatch_count_test.exe
wine d3d12_pipeline_library_test.exe
python3 -I scripts/check_no_game_data.py
python3 -I tests/test_docs_env_vars.py
python3 -I tests/test_ctest_registration.py
git diff --check

d3d12_skip_compute_test is new. Two synthetic programs, count_keep and count_drop, share one hand-written GLSL module that counts its dispatches in the buffer its root UAV names. Both buffers are seeded with 100/1000. One command list dispatches count_keep (2 groups), then count_drop three ways (Dispatch, ExecuteIndirect with one record, ExecuteIndirect with two records and a GPU count), then count_keep again (1 group). The test sets or deletes the variable itself before the device exists, captures stderr around the two CreateComputePipelineState calls and reads both buffers back.

Form Variable Base implementation with this test This change
d3d12_skip_compute_test unset Passed: 0 lines, count_keep 103/1004, count_drop 109/1016. Passed in 3 runs with the same 0 lines and the same counts.
d3d12_skip_compute_test --skip-one absent,drop Failed, exit 1: count_drop 109/1016, expected 100/1000. Passed in 3 runs: 1 line naming count_drop, count_keep 103/1004, count_drop 100/1000.
d3d12_skip_compute_test --skip-all all Failed, exit 1: count_keep 103/1004, expected 100/1000. Passed in 3 runs: 2 lines, both buffers 100/1000.

Both pipeline states are created and the list replays with ReplayResult::success in every form. "Base implementation" is this branch with runtime/shims/d3d12_vulkan_device.cpp and runtime/src/vulkan_replay.h as they are on 6293c1c4f.

Other test Result
command_list_test, d3d12_compute_test, d3d12_fspx_compute_test, d3d12_m4_compute_test, d3d12_execute_indirect_validation_test, d3d12_pipeline_library_test Passed (exit 0).
d3d12_indirect_zero_test Exit 77 (skipped): it compares with Microsoft's D3D12 and the host's is Wine's.
d3d12_indirect_dispatch_count_test Exit 1 with no output on the base implementation and on this change. It stops in its native set-up (d3dcompiler_47, WARP) before it creates a Vulkan device.
python3 -I scripts/check_no_game_data.py, tests/test_docs_env_vars.py (4 tests), tests/test_ctest_registration.py (4 tests), git diff --check Passed.
Python loop over the non-semantic test files (compileall, 520 files of tests/, the content guard) One failing file, tests/test_imhex_patterns.py, as on the base. None added.

Not run: the * spelling of all, the variable set from the shell instead of by the test, native Windows, Proton, AMD and Intel GPUs, the Vulkan validation layer (not installed), CTest itself (the executables were started directly), the translator's semantic suite (no Python or translator file changed) and a boot of the title.

GPUs tested: NVIDIA GeForce RTX 4070, driver 620.73.04, Linux under Wine 11.22.
AI-assisted: yes (Claude Code).

Checklist

  • One commit based on upstream main 6293c1c4f.
  • One topic: one opt-in diagnostic switch, its documentation and its test.
  • Off by default. The unset form of the test gives the same counts as the base implementation and no log line.
  • Synthetic test, no game data. Content guard and whitespace check passed.
  • No translator rule changed.

🤖 Generated with Claude Code

**@⁠Moriz82** on GitHub · 2026-11-24 22:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1341) `split/rt-skip-compute-diagnostic` → `main` · +322 −0 · 3 files · 1 commits · closed without merging Claimed in the coordination issue as: RT-SKIP-COMPUTE-DIAGNOSTIC ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 (integration source; there the switch hooks into a lazy compute build that `main` does not have and logs at the first dropped dispatch, here it acts where `create_compute` builds the pipeline and logs when the state is created). #42 (`LEONIDA_STUB_PIPELINES`) makes a pipeline with no translated shader a no-op stub. It does not take a translated program out of a run by name. ### What and why A compute program that hangs the GPU or loses the device stops a run at that dispatch. Nothing after it can be looked at until the program or its input is fixed, and there was no way to take one program out of a run to see whether it is the cause. `LEONIDA_SKIP_COMPUTE=<part of a name>[,<part>...]` is a diagnostic and is unset by default. A compute program whose library name contains one of the parts (`all` or `*`: every compute program) is not built: - `CreateComputePipelineState` does everything it did before except `vkCreateShaderModule` and `vkCreateComputePipelines`, returns the same result and writes one line, `[rt] d3d12: compute program <name> is skipped (LEONIDA_SKIP_COMPUTE): it is not built and its dispatches are dropped`. - Replay drops each `Dispatch` and each `ExecuteIndirect` dispatch that names the program, with or without a count buffer, and records the rest of the command list. `ComputePipeline::skipped` carries the mark. - What the program would have written keeps its previous contents. It is a way to isolate a program, not a fix, and no list of names is part of the change: nothing is skipped unless the person running sets the variable. The variable is read once, at the first compute pipeline state. With the variable unset the list of parts is empty, no pipeline is marked, and the four added tests in `prepare` and `record` are false for every pipeline. The existing lines of both functions are unchanged. ### Tested Cross-built on CachyOS Linux 7.3.5 with clang-cl 23.1.5 and the xwin SDK. Ran the Windows tests one at a time under Wine 11.22 (distribution package, fresh prefix) on a Ryzen 5 5600X, 16 GB RAM, NVIDIA GeForce RTX 4070 12 GB, driver 620.73.04. ```sh cmake --build runtime/build/boot --target d3d12_skip_compute_test d3d12_compute_test d3d12_fspx_compute_test d3d12_m4_compute_test d3d12_indirect_zero_test d3d12_execute_indirect_validation_test d3d12_indirect_dispatch_count_test d3d12_pipeline_library_test command_list_test gta6rt -j6 wine d3d12_skip_compute_test.exe wine d3d12_skip_compute_test.exe --skip-one wine d3d12_skip_compute_test.exe --skip-all wine command_list_test.exe wine d3d12_compute_test.exe wine d3d12_fspx_compute_test.exe wine d3d12_m4_compute_test.exe wine d3d12_indirect_zero_test.exe wine d3d12_execute_indirect_validation_test.exe wine d3d12_indirect_dispatch_count_test.exe wine d3d12_pipeline_library_test.exe python3 -I scripts/check_no_game_data.py python3 -I tests/test_docs_env_vars.py python3 -I tests/test_ctest_registration.py git diff --check ``` `d3d12_skip_compute_test` is new. Two synthetic programs, `count_keep` and `count_drop`, share one hand-written GLSL module that counts its dispatches in the buffer its root UAV names. Both buffers are seeded with 100/1000. One command list dispatches `count_keep` (2 groups), then `count_drop` three ways (`Dispatch`, `ExecuteIndirect` with one record, `ExecuteIndirect` with two records and a GPU count), then `count_keep` again (1 group). The test sets or deletes the variable itself before the device exists, captures stderr around the two `CreateComputePipelineState` calls and reads both buffers back. | Form | Variable | Base implementation with this test | This change | |---|---|---|---| | `d3d12_skip_compute_test` | unset | Passed: 0 lines, `count_keep` 103/1004, `count_drop` 109/1016. | Passed in 3 runs with the same 0 lines and the same counts. | | `d3d12_skip_compute_test --skip-one` | `absent,drop` | Failed, exit 1: `count_drop` 109/1016, expected 100/1000. | Passed in 3 runs: 1 line naming `count_drop`, `count_keep` 103/1004, `count_drop` 100/1000. | | `d3d12_skip_compute_test --skip-all` | `all` | Failed, exit 1: `count_keep` 103/1004, expected 100/1000. | Passed in 3 runs: 2 lines, both buffers 100/1000. | Both pipeline states are created and the list replays with `ReplayResult::success` in every form. "Base implementation" is this branch with `runtime/shims/d3d12_vulkan_device.cpp` and `runtime/src/vulkan_replay.h` as they are on `6293c1c4f`. | Other test | Result | |---|---| | `command_list_test`, `d3d12_compute_test`, `d3d12_fspx_compute_test`, `d3d12_m4_compute_test`, `d3d12_execute_indirect_validation_test`, `d3d12_pipeline_library_test` | Passed (exit 0). | | `d3d12_indirect_zero_test` | Exit 77 (skipped): it compares with Microsoft's D3D12 and the host's is Wine's. | | `d3d12_indirect_dispatch_count_test` | Exit 1 with no output on the base implementation and on this change. It stops in its native set-up (`d3dcompiler_47`, WARP) before it creates a Vulkan device. | | `python3 -I scripts/check_no_game_data.py`, `tests/test_docs_env_vars.py` (4 tests), `tests/test_ctest_registration.py` (4 tests), `git diff --check` | Passed. | | Python loop over the non-semantic test files (`compileall`, 520 files of `tests/`, the content guard) | One failing file, `tests/test_imhex_patterns.py`, as on the base. None added. | Not run: the `*` spelling of `all`, the variable set from the shell instead of by the test, native Windows, Proton, AMD and Intel GPUs, the Vulkan validation layer (not installed), CTest itself (the executables were started directly), the translator's semantic suite (no Python or translator file changed) and a boot of the title. GPUs tested: NVIDIA GeForce RTX 4070, driver 620.73.04, Linux under Wine 11.22. AI-assisted: yes (Claude Code). ### Checklist - [x] One commit based on upstream main `6293c1c4f`. - [x] One topic: one opt-in diagnostic switch, its documentation and its test. - [x] Off by default. The unset form of the test gives the same counts as the base implementation and no log line. - [x] Synthetic test, no game data. Content guard and whitespace check passed. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A compute program that hangs the GPU or loses the device stops a run at
that dispatch. Nothing after it can be examined until the program or its
input is fixed, and there was no way to take one program out of a run.

LEONIDA_SKIP_COMPUTE=<part of a name>[,<part>...] (all or *: every compute
program) is a diagnostic and is unset by default. A compute program whose
library name contains one of the parts gets no shader module and no
VkPipeline. CreateComputePipelineState still succeeds and logs the name
once. Replay drops each direct and indirect dispatch of the program and
records the rest of the command list. What the program would have written
keeps its previous contents. With the variable unset no pipeline is marked
and no dispatch is dropped.

Cross-built gta6rt and d3d12_skip_compute_test with clang-cl and ran the
test under Wine 11.22 on an RTX 4070. It runs two synthetic counting
programs with direct, indirect and counted indirect dispatches. Unset:
both run and no line is logged. "absent,drop": one program is dropped, the
dispatches before and after it run. "all": both are dropped. With the base
implementation the unset form passes with the same counts and the two set
forms fail.

AI-assisted (Claude Code).

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:48:00 +00:00
github-bot closed this pull request 2026-11-26 09:48:01 +00:00
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 23:20 UTC · original

Independent verification (AI-assisted, overnight shift worker). Built the PR head (d0f3079) RelWithDebInfo/Ninja; TEMP/TMP user-writable; LLVM_MC='wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc', Vulkan SDK spirv-val on PATH.

New skip path — NVIDIA RTX 4070 SUPER (VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~):

  • ctest -R d3d12_skip_compute --output-on-failure: 3/3 pass — d3d12_skip_compute_unset, _one (LEONIDA_SKIP_COMPUTE=absent,drop), _all. The test verifies both programs' dispatches (direct and indirect) are dropped while surrounding work runs and skipped buffers keep their seeds; stderr logging of the skipped names is asserted.
  • ctest -R d3d12 -j8: 119/121 — only d3d12_execute_indirect_validation (known WARP/HW parity) and d3d12_pipeline_library_host (0xc0000409, reproduces identically on origin/main — pre-existing).
  • scripts/run_gpu_tests.py --build runtime/build: 252/252 runnable cases pass (49 environment/feature skips; ms_v5_workgroup re-run alone with spirv-val on PATH passes).

AMD Radeon iGPU (VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1):

  • ctest -R d3d12_skip_compute: all 3 fail at FAIL: create count_keep — pipelines need 144 bytes of push constants ... maxPushConstantsSize 128. This iGPU caps push constants at 128 B, the same pre-existing limitation that fails ~15 other d3d12 compute/graphics ctest cases on this GPU (identical failure family on origin/main). The skip path itself could not be exercised here; consider having the test return SKIP (77) when the device can't fit the PSO, like other tests do — non-blocking note.
  • ctest -R d3d12 -j8: failure set is the known AMD family (pushconst + xdxr_rt_check box16 + clear NaN + exec-indirect parity + pipeline_library_host crash) plus the 3 skip_compute cases above; no new failure outside that family.
  • run_gpu_tests.py: 230/252 pass, 20 skip, only ms_clip and ms_wave_info_s3 fail — both on the known-failures list.

No game files used. Verified on this machine only.

— AI-assisted verification

**@⁠whoalin1** on GitHub · 2026-11-24 23:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1341#issuecomment-7147286955) Independent verification (AI-assisted, overnight shift worker). Built the PR head (d0f3079) RelWithDebInfo/Ninja; TEMP/TMP user-writable; `LLVM_MC='wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc'`, Vulkan SDK spirv-val on PATH. **New skip path — NVIDIA RTX 4070 SUPER** (`VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~`): - `ctest -R d3d12_skip_compute --output-on-failure`: **3/3 pass** — `d3d12_skip_compute_unset`, `_one` (`LEONIDA_SKIP_COMPUTE=absent,drop`), `_all`. The test verifies both programs' dispatches (direct and indirect) are dropped while surrounding work runs and skipped buffers keep their seeds; stderr logging of the skipped names is asserted. - `ctest -R d3d12 -j8`: 119/121 — only `d3d12_execute_indirect_validation` (known WARP/HW parity) and `d3d12_pipeline_library_host` (0xc0000409, reproduces identically on origin/main — pre-existing). - `scripts/run_gpu_tests.py --build runtime/build`: **252/252 runnable cases pass** (49 environment/feature skips; ms_v5_workgroup re-run alone with spirv-val on PATH passes). **AMD Radeon iGPU** (`VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1`): - `ctest -R d3d12_skip_compute`: all 3 fail at `FAIL: create count_keep` — `pipelines need 144 bytes of push constants ... maxPushConstantsSize 128`. This iGPU caps push constants at 128 B, the same pre-existing limitation that fails ~15 other d3d12 compute/graphics ctest cases on this GPU (identical failure family on origin/main). The skip path itself could not be exercised here; consider having the test return SKIP (77) when the device can't fit the PSO, like other tests do — non-blocking note. - `ctest -R d3d12 -j8`: failure set is the known AMD family (pushconst + xdxr_rt_check box16 + clear NaN + exec-indirect parity + pipeline_library_host crash) plus the 3 skip_compute cases above; no new failure outside that family. - `run_gpu_tests.py`: 230/252 pass, 20 skip, only `ms_clip` and `ms_wave_info_s3` fail — both on the known-failures list. No game files used. Verified on this machine only. — AI-assisted verification
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 03:51 UTC · original

Thanks for finding the 128-byte push-constant limit. The rebased head 4c54b804 keeps main’s lazy pipeline path and tests the first-dispatch diagnostic. The test now uses the same device capability check as the set-0 test and returns CTest skip code 77 when this fixture needs more push constants than the device supports. Fresh GPU results are pending.

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 03:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1341#issuecomment-7152305389) Thanks for finding the 128-byte push-constant limit. The rebased head `4c54b804` keeps main’s lazy pipeline path and tests the first-dispatch diagnostic. The test now uses the same device capability check as the set-0 test and returns CTest skip code 77 when this fixture needs more push constants than the device supports. Fresh GPU results are pending. AI-assisted.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.