[PR #2392] make_game: the pipelines stage fills the runtime's own journal with gta6rt --precompile-pipelines (MAKE-GAME-PIPELINES-VIA-RUNTIME) #2394

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2392
Author: @qhukz13
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: cont/pipelines-via-runtime


📝 Commits (2)

  • 5d469d8 make_game: the pipelines stage fills the runtime's own journal with gta6rt --precompile-pipelines
  • f445e3f precompile: a module that kills the run is skipped on the next one, and reported

📊 Changes

20 files changed (+1100 additions, -1170 deletions)

View changed files

📝 README.md (+7 -8)
📝 docs/d3d12_vulkan.md (+3 -3)
📝 docs/linux.md (+4 -4)
📝 docs/linux_proton.md (+7 -5)
📝 docs/pipeline_check.md (+18 -36)
📝 docs/running.md (+3 -2)
📝 make_game.py (+219 -263)
📝 runtime/CMakeLists.txt (+5 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+74 -2)
➕ runtime/src/precompile_inflight.h (+114 -0)
📝 runtime/src/shader_library.h (+13 -0)
➕ runtime/test/precompile_inflight_test.cpp (+119 -0)
📝 tests/test_leonida_tui.py (+4 -6)
📝 tests/test_make_game_argparse.py (+8 -8)
📝 tests/test_make_game_dry_run.py (+18 -24)
➖ tests/test_make_game_pipeline_batches.py (+0 -247)
📝 tests/test_make_game_pipeline_preflight.py (+80 -182)
📝 tests/test_make_game_pipelines.py (+352 -326)
📝 tests/test_make_game_platform.py (+49 -52)
📝 tests/test_make_game_preflight.py (+3 -2)

📄 Description

Claimed in the coordination issue as: MAKE-GAME-PIPELINES-VIA-RUNTIME (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198052250, corrected in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198532316)

Touches the code this replaces in: #2113, #1407, #846, #285, #1319 and #2042 (all on the vk_pipeline_check side of the stage). Built on top of RT-PRECOMPILE-SKIP-LIST-EXPLICIT (@aslan2142, now in main): this keeps its entry selection and its summary wording (check_precompile_skip_list.cmake passes).

What and why

make_game.py --stages pipelines ran vk_pipeline_check over the translated shaders and wrote one pipeline_cache.bin. The runtime never hits that cache, which the maintainers' status lists as "vk_pipeline_check never matches the runtime's cache keys":

  • The runtime looks a compute pipeline up in its own journal, pipeline_cache.d/cs-<key>.bin.
  • The checker creates its pipelines on a different device: no pApplicationName, its own executable name, robustness off, a different extension set, a different bindless set-0 layout, VK_SHADER_STAGE_ALL push constants for bound compute, and no decide_subgroup_size / REQUIRE_FULL_SUBGROUPS.
  • So even the driver's own cache keys differ. docs/running.md told players to skip the stage for that reason.

Closing those gaps one at a time in the checker would copy the runtime's device and layout code into a second program. gta6rt --precompile-pipelines already is that program: the same device, layouts, build_compute_pipeline and journal names as play. So the stage now runs it.

The change

make_game.py (stage pipelines):

  • It runs gta6rt.exe --precompile-pipelines --threads <jobs>, using the one in --out, else --runtime-build, else the default build folder. It runs natively on Windows and under Wine elsewhere, with WINE honoured.
  • LEONIDA_SHADERS and LEONIDA_PIPELINE_CACHE_DIR point at the run's work/shaders/spirv and --out, converted to Z:\... under Wine, unless the user set them.
  • The [precompile] i/n lines drive the stage's progress.
  • Exit codes:
    • 2 (some entries failed, or were skipped after a crash) is a warning;
    • 1 (no device or library) fails the stage;
    • anything else is a crash, and the stage reruns up to PIPELINE_CRASH_RETRIES (5).
  • Crashed entries go to <out>/pipeline_crashes.json as before, with each module's SHA-256.
  • Preflight: without the runtime stage, gta6rt.exe must exist; off Windows, Wine must exist. Off Windows without the cross-build or Wine, the default stage list drops pipelines along with runtime.
  • The vk_pipeline_check driving code goes: the exe lookup, staleness check, Linux auto-build, 500-entry batching and the BVH seeding pass. The precompile loads bvh/, fspx*/, exe/ and library/ itself. vk_pipeline_check, its tests, docs and the CI step that runs it stay: it remains the driver-acceptance checker.

gta6rt --precompile-pipelines: a module that kills the run is skipped next time. Before this, a crashed build left nothing behind: the requests/<name>.building lock is DELETE_ON_CLOSE. A rerun built the same module first again and died again.

  • New runtime/src/precompile_inflight.h: requests/inflight.txt lists <name> <key> for the entries inside the driver, rewritten before each create and after it. The key is the module file (size and last write, no read of the module) on this device and driver.
  • The next run moves what a dead run left there to requests/crashed.txt and skips an entry while its key is the one that crashed. Each gets a line, the summary adds , N crashed a run (only when N is not 0, so main's wording stands), and the exit code is 2.
  • A new translation of the module or a new driver gives a new key, so the next run tries it again by itself, and a build that returns clears it from the list. --all tries every recorded one now.
  • One precompile per journal folder (requests/precompile.lock), so a leftover list can only be a dead run's. A second one exits 3, which the stage reports as such, not as a device failure. --list touches nothing.
  • LEONIDA_PRECOMPILE_CRASH_TEST=<entry> ends the run just before that entry's create, so the crash path is tested by a real process death.

Graphics pipelines leave the stage. The runtime builds them at the title's draw from the PSO and the bound formats, and the checker's stub-paired pipelines never matched those (docs/d3d12_vulkan.md). Ordering them ahead of play is #2220 / #2260's work.

Docs updated: README.md, docs/running.md, docs/linux_proton.md, docs/linux.md, docs/pipeline_check.md, docs/d3d12_vulkan.md. Only the lines about the stage changed; the skip-list text and timings are left to RT-PRECOMPILE-SKIP-LIST-EXPLICIT.

Tested

Windows 10 Pro 19045, MSVC 14.44 RelWithDebInfo, GTX 1050 Ti (NVIDIA), on main 2d43417d4. No game files: two or three authored compute shaders (OpExecutionMode LocalSize n 1 1) written to a temporary library.

  • precompile_inflight_test (new, standard library only):

    • passes under MSVC, and under GCC 14 with -fsanitize=address,undefined and with ThreadSanitizer;
    • with the move of leftover entries into crashed.txt removed, it fails at the dead-run check.
  • gta6rt --precompile-pipelines with real process deaths (LEONIDA_PRECOMPILE_CRASH_TEST), 17 checks, all pass:

    • a crash inside an entry's create ends the run with 0xC0000005 and leaves <name> <key> in inflight.txt;
    • the next run names the entry, skips it, records it in crashed.txt, exits 2 with main's summary wording plus , 1 crashed a run, and keeps skipping it while the module file is unchanged;
    • after the module file is rewritten (a new translation), the next run builds it, exits 0 and clears the list;
    • --all builds a freshly crashed entry and clears the list;
    • a held journal folder exits 3, and --list writes nothing.
  • main's precompile_skip_list passes alongside precompile_inflight.

  • The stage end to end on the same machine, through make_game.pipelines() with that build as --runtime-build:

    • 3 journal files in <out>/pipeline_cache.d, progress 3/3;
    • with a crash planted in one entry, the first attempt dies, the retry skips it, and the stage completes with one warning that names it and says how it is retried, and pipeline_crashes.json naming it.

    make_game.py's CLI asks for a game package before any stage, so the run calls the stage function directly.

  • Python test files, on Windows (Python 3.12) and Linux (Python 3.14.8):

    • test_make_game_pipelines (rewritten around a fake gta6rt: arguments, environment, Wine paths, progress, exit codes 0/1/2/3, the retry limit, <name> <key> lines → pipeline_crashes.json, one warning);
    • test_make_game_pipeline_preflight (rewritten);
    • test_make_game_dry_run, test_make_game_platform, test_make_game_argparse, test_make_game_preflight, test_leonida_tui;
    • every other tests/test_make_game_*.py, plus test_ctest_registration, test_text_write_line_endings and test_docs_env_vars.

    test_make_game_pipeline_batches.py is removed with the batching it tested.

  • Every standalone tests/test_*.py on Linux (544 files): no new failure. The one failing file, test_calibrated_texture_extra (test_export_file_replacement_failure_cleans_temporary_file), fails the same way on main 935a2cd5b. The pytest-only files were not run here.

  • python -m compileall, make_game.py --help, scripts/check_no_game_data.py on every changed file, and git diff --check: clean.

Off Windows the stage now needs Wine and a Windows gta6rt.exe, as playing does; the shaders, assets and runtime stages do not. On a machine without them the stage says so in preflight.

Not tested: a real game library, and the stage under Wine (the Wine command line is covered by the tests, not run against a real Wine).

GPUs tested: NVIDIA GeForce GTX 1050 Ti, Windows 10.

AI-assisted: yes. Antigravity (Gemini 4 Neon) wrote the implementation plan and the make_game.py, test and docs changes. Claude Code wrote the runtime part, reviewed the rest, and ran the builds, tests and mutant.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 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/2392 **Author:** [@qhukz13](https://github.com/qhukz13) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `cont/pipelines-via-runtime` --- ### 📝 Commits (2) - [`5d469d8`](https://github.com/ubiquitarianism/leonida/commit/5d469d86c7d67f21810f1553f1b577bd3abc917c) make_game: the pipelines stage fills the runtime's own journal with gta6rt --precompile-pipelines - [`f445e3f`](https://github.com/ubiquitarianism/leonida/commit/f445e3f7d5b17ada1d8e1bee66e76dcd2a376515) precompile: a module that kills the run is skipped on the next one, and reported ### 📊 Changes **20 files changed** (+1100 additions, -1170 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+7 -8) 📝 `docs/d3d12_vulkan.md` (+3 -3) 📝 `docs/linux.md` (+4 -4) 📝 `docs/linux_proton.md` (+7 -5) 📝 `docs/pipeline_check.md` (+18 -36) 📝 `docs/running.md` (+3 -2) 📝 `make_game.py` (+219 -263) 📝 `runtime/CMakeLists.txt` (+5 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+74 -2) ➕ `runtime/src/precompile_inflight.h` (+114 -0) 📝 `runtime/src/shader_library.h` (+13 -0) ➕ `runtime/test/precompile_inflight_test.cpp` (+119 -0) 📝 `tests/test_leonida_tui.py` (+4 -6) 📝 `tests/test_make_game_argparse.py` (+8 -8) 📝 `tests/test_make_game_dry_run.py` (+18 -24) ➖ `tests/test_make_game_pipeline_batches.py` (+0 -247) 📝 `tests/test_make_game_pipeline_preflight.py` (+80 -182) 📝 `tests/test_make_game_pipelines.py` (+352 -326) 📝 `tests/test_make_game_platform.py` (+49 -52) 📝 `tests/test_make_game_preflight.py` (+3 -2) </details> ### 📄 Description Claimed in the coordination issue as: MAKE-GAME-PIPELINES-VIA-RUNTIME (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198052250, corrected in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198532316) Touches the code this replaces in: #2113, #1407, #846, #285, #1319 and #2042 (all on the `vk_pipeline_check` side of the stage). Built on top of RT-PRECOMPILE-SKIP-LIST-EXPLICIT (@aslan2142, now in main): this keeps its entry selection and its summary wording (`check_precompile_skip_list.cmake` passes). ### What and why `make_game.py --stages pipelines` ran `vk_pipeline_check` over the translated shaders and wrote one `pipeline_cache.bin`. The runtime never hits that cache, which the maintainers' status lists as "vk_pipeline_check never matches the runtime's cache keys": - The runtime looks a compute pipeline up in its own journal, `pipeline_cache.d/cs-<key>.bin`. - The checker creates its pipelines on a different device: no `pApplicationName`, its own executable name, robustness off, a different extension set, a different bindless set-0 layout, `VK_SHADER_STAGE_ALL` push constants for bound compute, and no `decide_subgroup_size` / `REQUIRE_FULL_SUBGROUPS`. - So even the driver's own cache keys differ. `docs/running.md` told players to skip the stage for that reason. Closing those gaps one at a time in the checker would copy the runtime's device and layout code into a second program. `gta6rt --precompile-pipelines` already is that program: the same device, layouts, `build_compute_pipeline` and journal names as play. So the stage now runs it. ### The change **`make_game.py` (stage `pipelines`):** - It runs `gta6rt.exe --precompile-pipelines --threads <jobs>`, using the one in `--out`, else `--runtime-build`, else the default build folder. It runs natively on Windows and under Wine elsewhere, with `WINE` honoured. - `LEONIDA_SHADERS` and `LEONIDA_PIPELINE_CACHE_DIR` point at the run's `work/shaders/spirv` and `--out`, converted to `Z:\...` under Wine, unless the user set them. - The `[precompile] i/n` lines drive the stage's progress. - Exit codes: - 2 (some entries failed, or were skipped after a crash) is a warning; - 1 (no device or library) fails the stage; - anything else is a crash, and the stage reruns up to `PIPELINE_CRASH_RETRIES` (5). - Crashed entries go to `<out>/pipeline_crashes.json` as before, with each module's SHA-256. - Preflight: without the runtime stage, `gta6rt.exe` must exist; off Windows, Wine must exist. Off Windows without the cross-build or Wine, the default stage list drops `pipelines` along with `runtime`. - The `vk_pipeline_check` driving code goes: the exe lookup, staleness check, Linux auto-build, 500-entry batching and the BVH seeding pass. The precompile loads `bvh/`, `fspx*/`, `exe/` and `library/` itself. `vk_pipeline_check`, its tests, docs and the CI step that runs it stay: it remains the driver-acceptance checker. **`gta6rt --precompile-pipelines`: a module that kills the run is skipped next time.** Before this, a crashed build left nothing behind: the `requests/<name>.building` lock is `DELETE_ON_CLOSE`. A rerun built the same module first again and died again. - New `runtime/src/precompile_inflight.h`: `requests/inflight.txt` lists `<name> <key>` for the entries inside the driver, rewritten before each create and after it. The key is the module file (size and last write, no read of the module) on this device and driver. - The next run moves what a dead run left there to `requests/crashed.txt` and skips an entry while its key is the one that crashed. Each gets a line, the summary adds `, N crashed a run` (only when N is not 0, so main's wording stands), and the exit code is 2. - A new translation of the module or a new driver gives a new key, so the next run tries it again by itself, and a build that returns clears it from the list. `--all` tries every recorded one now. - One precompile per journal folder (`requests/precompile.lock`), so a leftover list can only be a dead run's. A second one exits 3, which the stage reports as such, not as a device failure. `--list` touches nothing. - `LEONIDA_PRECOMPILE_CRASH_TEST=<entry>` ends the run just before that entry's create, so the crash path is tested by a real process death. Graphics pipelines leave the stage. The runtime builds them at the title's draw from the PSO and the bound formats, and the checker's stub-paired pipelines never matched those (docs/d3d12_vulkan.md). Ordering them ahead of play is #2220 / #2260's work. Docs updated: `README.md`, `docs/running.md`, `docs/linux_proton.md`, `docs/linux.md`, `docs/pipeline_check.md`, `docs/d3d12_vulkan.md`. Only the lines about the stage changed; the skip-list text and timings are left to RT-PRECOMPILE-SKIP-LIST-EXPLICIT. ### Tested Windows 10 Pro 19045, MSVC 14.44 RelWithDebInfo, GTX 1050 Ti (NVIDIA), on main `2d43417d4`. No game files: two or three authored compute shaders (`OpExecutionMode LocalSize n 1 1`) written to a temporary library. - **`precompile_inflight_test`** (new, standard library only): - passes under MSVC, and under GCC 14 with `-fsanitize=address,undefined` and with ThreadSanitizer; - with the move of leftover entries into `crashed.txt` removed, it fails at the dead-run check. - **`gta6rt --precompile-pipelines` with real process deaths** (`LEONIDA_PRECOMPILE_CRASH_TEST`), 17 checks, all pass: - a crash inside an entry's create ends the run with `0xC0000005` and leaves `<name> <key>` in `inflight.txt`; - the next run names the entry, skips it, records it in `crashed.txt`, exits 2 with main's summary wording plus `, 1 crashed a run`, and keeps skipping it while the module file is unchanged; - after the module file is rewritten (a new translation), the next run builds it, exits 0 and clears the list; - `--all` builds a freshly crashed entry and clears the list; - a held journal folder exits 3, and `--list` writes nothing. - **main's `precompile_skip_list`** passes alongside `precompile_inflight`. - **The stage end to end on the same machine**, through `make_game.pipelines()` with that build as `--runtime-build`: - 3 journal files in `<out>/pipeline_cache.d`, progress `3/3`; - with a crash planted in one entry, the first attempt dies, the retry skips it, and the stage completes with one warning that names it and says how it is retried, and `pipeline_crashes.json` naming it. `make_game.py`'s CLI asks for a game package before any stage, so the run calls the stage function directly. - **Python test files**, on Windows (Python 3.12) and Linux (Python 3.14.8): - `test_make_game_pipelines` (rewritten around a fake `gta6rt`: arguments, environment, Wine paths, progress, exit codes 0/1/2/3, the retry limit, `<name> <key>` lines → `pipeline_crashes.json`, one warning); - `test_make_game_pipeline_preflight` (rewritten); - `test_make_game_dry_run`, `test_make_game_platform`, `test_make_game_argparse`, `test_make_game_preflight`, `test_leonida_tui`; - every other `tests/test_make_game_*.py`, plus `test_ctest_registration`, `test_text_write_line_endings` and `test_docs_env_vars`. `test_make_game_pipeline_batches.py` is removed with the batching it tested. - Every standalone `tests/test_*.py` on Linux (544 files): no new failure. The one failing file, `test_calibrated_texture_extra` (`test_export_file_replacement_failure_cleans_temporary_file`), fails the same way on main `935a2cd5b`. The pytest-only files were not run here. - `python -m compileall`, `make_game.py --help`, `scripts/check_no_game_data.py` on every changed file, and `git diff --check`: clean. Off Windows the stage now needs Wine and a Windows `gta6rt.exe`, as playing does; the `shaders`, `assets` and `runtime` stages do not. On a machine without them the stage says so in preflight. Not tested: a real game library, and the stage under Wine (the Wine command line is covered by the tests, not run against a real Wine). GPUs tested: NVIDIA GeForce GTX 1050 Ti, Windows 10. AI-assisted: yes. Antigravity (Gemini 4 Neon) wrote the implementation plan and the `make_game.py`, test and docs changes. Claude Code wrote the runtime part, reviewed the rest, and ran the builds, tests and mutant. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 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>
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#2394
No description provided.