make_game.py: add --max-compile-time to the pipelines stage (PIPELINE-TIMEOUT) #640

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

@⁠Natakout on GitHub · 2026-11-24 10:42 UTC · original
fix/pipeline-compile-timeout → main · +106 −10 · 3 files · 1 commits · closed without merging

make_game.py: add --max-compile-time to the pipelines stage (PIPELINE-TIMEOUT)

Claimed in the coordination issue as: PIPELINE-TIMEOUT

What and why

The pipelines stage runs vk_pipeline_check on every translated SPIR-V
module. Some modules -- the ScreenProbes family (15-24 MB under
--wave64-emulate) and the RaytracingResolve family (~6.5 MB, ~996
modules) -- cause the NVIDIA driver's shader compiler to run for hours,
blocking the entire build indefinitely (#584).

This change adds a --max-compile-time flag (default 300 seconds) to
make_game.py. When a vk_pipeline_check batch exceeds the time limit,
the process is killed and the modules that were in flight (read from
--inflight-file) are added to the skip list. The build continues with
the remaining shaders. Timed-out modules are reported as skipped, not
as failures, so they do not cause the build to fail.

The implementation runs the existing run() call in a worker thread and
joins with a timeout. On expiry, it kills the checker process (taskkill
on Windows, pkill on Linux) and reads the inflight file. This preserves
compatibility with the test suite that mocks make_game.run().

No changes to vk_pipeline_check itself; only standard-library Python.

What was tested

  • All 434 make_game tests pass on Windows 11 (Python 3.13.3).
  • compileall clean.
  • make_game.py --help shows the new flag.
  • Verified on RTX 3060 (Windows 11): the two ScreenProbes modules
    (Jindirect_diffuse_lighting_CS_ScreenProbes_ActivateProbes_9083c094
    and Hindirect_diffuse_lighting_CS_ScreenProbes_ActivateRays_d60186e6)
    that blocked the build for 7+ hours are now skipped after 300s, and
    the pipelines stage completes the remaining ~26,500 modules.
**@⁠Natakout** on GitHub · 2026-11-24 10:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/640) `fix/pipeline-compile-timeout` → `main` · +106 −10 · 3 files · 1 commits · closed without merging make_game.py: add --max-compile-time to the pipelines stage (PIPELINE-TIMEOUT) Claimed in the coordination issue as: PIPELINE-TIMEOUT What and why The pipelines stage runs vk_pipeline_check on every translated SPIR-V module. Some modules -- the ScreenProbes family (15-24 MB under --wave64-emulate) and the RaytracingResolve family (~6.5 MB, ~996 modules) -- cause the NVIDIA driver's shader compiler to run for hours, blocking the entire build indefinitely (#584). This change adds a --max-compile-time flag (default 300 seconds) to make_game.py. When a vk_pipeline_check batch exceeds the time limit, the process is killed and the modules that were in flight (read from --inflight-file) are added to the skip list. The build continues with the remaining shaders. Timed-out modules are reported as skipped, not as failures, so they do not cause the build to fail. The implementation runs the existing run() call in a worker thread and joins with a timeout. On expiry, it kills the checker process (taskkill on Windows, pkill on Linux) and reads the inflight file. This preserves compatibility with the test suite that mocks make_game.run(). No changes to vk_pipeline_check itself; only standard-library Python. What was tested - All 434 make_game tests pass on Windows 11 (Python 3.13.3). - compileall clean. - make_game.py --help shows the new flag. - Verified on RTX 3060 (Windows 11): the two ScreenProbes modules (Jindirect_diffuse_lighting_CS_ScreenProbes_ActivateProbes_9083c094 and Hindirect_diffuse_lighting_CS_ScreenProbes_ActivateRays_d60186e6) that blocked the build for 7+ hours are now skipped after 300s, and the pipelines stage completes the remaining ~26,500 modules.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:13:21 +00:00
github-bot closed this pull request 2026-11-26 09:13:21 +00:00
Author
Owner

@⁠kirigayakazima on GitHub · 2026-11-24 11:40 UTC · original

Tested and audited PR #640 on Windows 11 x64 (Python 3.14.7) at commit 8e89bc4bee (synthetic fixtures only, zero game data).

Existing checks (all pass on Windows 11, clean merge on main 21625bca)

  • tests/test_make_game_argparse.py — 38/38 OK
  • tests/test_make_game_dry_run.py — 24/24 OK
  • tests/test_make_game_pipelines.py — 18/18 OK
  • tests/test_make_game_pipeline_batches.py — 15/15 OK
  • tests/test_make_game_pipeline_preflight.py — 20 ran, OK (1 skipped)
  • tests/test_ci_registration.py (15/15), tests/test_text_write_line_endings.py (3/3), all 11 tests/test_docs_*.py suites, and scripts/check_no_game_data.py — all OK

Concrete issues found in make_game.py & tests

  1. Timed-out batches silently skip all remaining unchecked modules in that batch (make_game.py:2559, 2634-2635)

    • When _run_with_timeout expires, it records the currently in-flight module(s) from pipeline_inflight.txt into pipeline_crashes.txt ( imed_out_modules) and returns ␀.
    • check_range immediately returns on if code in (0, 1, 2) or interrupted(code): return code without re-running the batch with --skip-file.
    • Verified with a synthetic 3-module batch (mod_a, mod_slow, mod_c under --start 0 --count 3, stub k_pipeline_check.exe writing mod_slow to pipeline_inflight.txt): pipelines() invoked the checker only once, added mod_slow to pipeline_crashes.txt, and logged pipelines: done — leaving mod_c (or up to 499 modules per PIPELINE_BATCH_SIZE=500 batch, or the entire remaining corpus when --start/--count isn't supported) unchecked and uncached.
    • Instead, returning a sentinel/retrying the batch (with --skip-file updated, and using a separate timeout budget rather than PIPELINE_CRASH_RETRIES=5 since #584 reports ~996 slow modules) would finish the rest of the batch while actually skipping only the timed-out module(s).
  2. Empty/missing --inflight-file on timeout silently reports pipelines: done (make_game.py:2581-2589)

    • Also verified synthetically: if k_pipeline_check hangs before writing pipeline_inflight.txt,
      ead_names(inflight) returns [], _collect_timed_out adds nothing, and _run_with_timeout still returns ␀, marking the batch complete with 0 shaders checked and no error or skip recorded.
  3. _kill_checker_processes kills processes system-wide by executable basename (make_game.py:2565-2573)

    • askkill /f /im vk_pipeline_check.exe on Windows (and pkill -f vk_pipeline_check on POSIX) terminates every matching process on the machine rather than only the spawned child process (and pkill -f can match unrelated processes whose arguments contain that name). Tracking the spawned Popen process (or passing imeout to a Popen.wait /
      un helper) isolates termination to that single child.
  4. Negative / NaN --max-compile-time values and missing unit tests (make_game.py:2967)

    • ype=float without validation silently treats --max-compile-time -5 or
      an as disabled (max_compile_time > 0 is False).
    • Note that all existing tests pass only because the test diff adds max_compile_time=mock.ANY to 2 existing mock assertions; there are currently 0 unit tests exercising _run_with_timeout, timeout expiry, pipeline_crashes.txt skipping, or --max-compile-time CLI parsing.

AI-assisted: yes

**@⁠kirigayakazima** on GitHub · 2026-11-24 11:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/640#issuecomment-7130396360) Tested and audited PR #640 on **Windows 11 x64** (Python 3.14.7) at commit 8e89bc4bee622172b7a37e0c578cb21a9e97b93a (synthetic fixtures only, zero game data). ### Existing checks (all pass on Windows 11, clean merge on main 21625bca) - `tests/test_make_game_argparse.py` — 38/38 OK - `tests/test_make_game_dry_run.py` — 24/24 OK - `tests/test_make_game_pipelines.py` — 18/18 OK - `tests/test_make_game_pipeline_batches.py` — 15/15 OK - `tests/test_make_game_pipeline_preflight.py` — 20 ran, OK (1 skipped) - `tests/test_ci_registration.py` (15/15), `tests/test_text_write_line_endings.py` (3/3), all 11 `tests/test_docs_*.py` suites, and `scripts/check_no_game_data.py` — all OK --- ### Concrete issues found in make_game.py & tests 1. **Timed-out batches silently skip all remaining unchecked modules in that batch (make_game.py:2559, 2634-2635)** - When _run_with_timeout expires, it records the currently in-flight module(s) from pipeline_inflight.txt into pipeline_crashes.txt ( imed_out_modules) and returns **␀**. - check_range immediately returns on if code in (0, 1, 2) or interrupted(code): return code without re-running the batch with --skip-file. - **Verified with a synthetic 3-module batch** (mod_a, mod_slow, mod_c under --start 0 --count 3, stub k_pipeline_check.exe writing mod_slow to pipeline_inflight.txt): pipelines() invoked the checker only **once**, added mod_slow to pipeline_crashes.txt, and logged pipelines: done — leaving mod_c (or up to 499 modules per PIPELINE_BATCH_SIZE=500 batch, or the entire remaining corpus when --start/--count isn't supported) unchecked and uncached. - Instead, returning a sentinel/retrying the batch (with --skip-file updated, and using a separate timeout budget rather than PIPELINE_CRASH_RETRIES=5 since #584 reports ~996 slow modules) would finish the rest of the batch while actually skipping only the timed-out module(s). 2. **Empty/missing --inflight-file on timeout silently reports pipelines: done (make_game.py:2581-2589)** - Also verified synthetically: if k_pipeline_check hangs before writing pipeline_inflight.txt, ead_names(inflight) returns [], _collect_timed_out adds nothing, and _run_with_timeout still returns ␀, marking the batch complete with 0 shaders checked and no error or skip recorded. 3. **_kill_checker_processes kills processes system-wide by executable basename (make_game.py:2565-2573)** - askkill /f /im vk_pipeline_check.exe on Windows (and pkill -f vk_pipeline_check on POSIX) terminates **every** matching process on the machine rather than only the spawned child process (and pkill -f can match unrelated processes whose arguments contain that name). Tracking the spawned Popen process (or passing imeout to a Popen.wait / un helper) isolates termination to that single child. 4. **Negative / NaN --max-compile-time values and missing unit tests (make_game.py:2967)** - ype=float without validation silently treats --max-compile-time -5 or an as disabled (max_compile_time > 0 is False). - Note that all existing tests pass only because the test diff adds max_compile_time=mock.ANY to 2 existing mock assertions; there are currently **0** unit tests exercising _run_with_timeout, timeout expiry, pipeline_crashes.txt skipping, or --max-compile-time CLI parsing. AI-assisted: yes
Author
Owner

@⁠Natakout on GitHub · 2026-11-24 21:25 UTC · original

Closing: I am no longer working on Leonida. Thanks for the reviews.

**@⁠Natakout** on GitHub · 2026-11-24 21:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/640#issuecomment-7144906768) Closing: I am no longer working on Leonida. Thanks for the reviews.

Pull request closed

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