[PR #1341] [CLOSED] d3d12: skip named compute programs on request (RT-SKIP-COMPUTE-DIAGNOSTIC) #1372

Closed
opened 2026-11-26 20:21:01 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1341
Author: @Moriz82
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: split/rt-skip-compute-diagnostic


📝 Commits (1)

  • 4c54b80 d3d12: skip named compute programs on request (RT-SKIP-COMPUTE-DIAGNOSTIC)

📊 Changes

3 files changed (+322 additions, -0 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+9 -0)
📝 runtime/CMakeLists.txt (+12 -0)
➕ runtime/test/d3d12_skip_compute_test.cpp (+301 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1341 **Author:** [@Moriz82](https://github.com/Moriz82) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `split/rt-skip-compute-diagnostic` --- ### 📝 Commits (1) - [`4c54b80`](https://github.com/ubiquitarianism/leonida/commit/4c54b8044697302eec0addbaa7a24a4374a78e70) d3d12: skip named compute programs on request (RT-SKIP-COMPUTE-DIAGNOSTIC) ### 📊 Changes **3 files changed** (+322 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+9 -0) 📝 `runtime/CMakeLists.txt` (+12 -0) ➕ `runtime/test/d3d12_skip_compute_test.cpp` (+301 -0) </details> ### 📄 Description Claimed in the coordination issue as: RT-SKIP-COMPUTE-DIAGNOSTIC ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145723794)). 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:21:01 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1372
No description provided.