Skip to content

build: batch shader pipeline checks and recover failed batches (BUILD-1030) - #3623

Merged
ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
erickbobd:codex/build-1030-pipeline-batches
Nov 23, 2026
Merged

ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
erickbobd:codex/build-1030-pipeline-batches

Conversation

@erickbobd

@erickbobd erickbobd commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

BUILD-1030 — claim, following the memory-cap report.

Depends on: #2111 (already merged).

The pipelines stage currently sends the entire index to one checker process. When that process dies and its in-flight modules pass alone, the retry stops with no module could be named. With a single in-flight module, the old path can instead blacklist that healthy module without checking it alone. The reporter's later measurements point to concurrent heavy compiles, rather than cumulative cache growth, in this particular case.

This makes the build use the chunked workflow already described in docs/pipeline_check.md:

  • Fresh processes over at most 500 entries, including the short final range; the same name-sorted global index and shared, checkpointed pipeline_cache.bin are used throughout.
  • Every suspected module is checked alone, including a single suspect. If no module reproduces the crash, re-check that entire range in progressively smaller processes without adding healthy modules to the crash list. Completed earlier batches stay completed.
  • Reproducible module crashes and validation failures remain failures even when later batches pass. Setup errors and interruptions stop the stage; retries and range splitting are bounded.
  • The native checker uses exit 1 for both validation and setup failures. A finished shader pass writes/clears its in-flight report; exit 1 without a fresh report stops immediately, including during single-module probes. Stale reports are removed before every invocation.
  • An abnormal diagnostic-probe exit is attributed to a module only when the probe's fresh in-flight report names it. Missing, empty or unrelated reports stop the stage as inconclusive instead of blacklisting an unconfirmed module. Because the native small-module report is periodic, a real fast crash can also be inconclusive; this deliberately uses the conservative fallback rather than guessing its cause.
  • Older checkers retain the legacy invocation. Small indices still use one process. The documentation now distinguishes the old manual chunking workaround from the build's actual behavior.

Validation on Windows 11 build 26200, NVIDIA GeForce RTX 5070 Ti, driver 617.14, Vulkan SDK 1.4.363.0:

  • python -m unittest discover -s tests -p 'test_make_game*.py' -q: 292 tests OK. The fifteen new tests invoke real scripted child processes through the production pipelines() orchestration, covering bounded coverage/cache reuse, collective crashes, healthy single suspects, genuine crashers, validation failures, interruptions during work and probes, setup failures returning either 1 or 2 (including a probe), inconclusive abnormal probes, older checkers and small indices.
  • The two new recovery regressions fail against unchanged main f847748c: one produces no module could be named, the other falsely records a healthy single suspect as a failed module. Both pass here.
  • Three further process regressions (missing report, empty report, report naming another module) fail on published 30e67603: each launches 12 checker processes. The updated stage stops after the failed batch and the first inconclusive probe (2 calls), attributes no module crash and writes no crash list. The genuine-crasher regression still checks the rest and keeps the stage failed.
  • Actual Vulkan checker from f847748c, called by the changed build stage with 501 indexed copies of one hand-written compute shader: ranges [0,500) and [500,501) both pass; 501 modules and 501 pipelines OK, no skips, cache saved and seeded by the second process.
  • Actual checker negative control: remove one synthetic input in the first range. It reports 499 modules OK / 1 failed, still checks the final range successfully, and the build stage correctly exits 1. A successful tail does not erase the first failure.
  • Actual checker setup control: select a nonexistent device with process-local LEONIDA_VK_DEVICE. The checker returns 1 without an in-flight report. Published head e4617613 invoked both ranges; the follow-up stops after one invocation, with the native initialization error preserved. This does not change GPU settings.
  • compileall, make_game.py --help, the four docs checks, LF writer checks and git diff --check pass.

The original 26,501-module / Job-object-cap result is still pending; the reporter is checking the batching/splitting implementation at e4617613. Their updated measurements found no accumulation over 1,500 entries, cheap loading of the full cache, and large spikes from individual heavy modules. Splitting a failed range reduces how many such modules can compile together; it is not a hard RAM limit, and a single module can still exhaust memory. The synthetic GPU run verifies orchestration and failure accounting, not full-corpus memory consumption or performance. Subsequent commits add setup-failure detection and conservative handling of inconclusive probes without changing the range-splitting algorithm; that external run does not cover these follow-ups and must retain its original head label.

Only synthetic fixtures and outcome counts were used in this contribution. AI-assisted: Codex implemented, reviewed and tested this change.

@evilclanker9000

Copy link
Copy Markdown
Contributor

Second check on Windows at e4617613. All 21 focused Python tests passed. Independent checker stubs completed the sorted 501-entry index in ranges [0,500) and [500,501). After a simulated crash in the middle range of a seven-entry run, the base listed a healthy shader as a crash, while this head kept the first checkpoint, split only the failed range, and completed all seven primary entries in order with no skip file. A validation failure still checked the tail and returned 1.

One remaining setup case: the stub in the new setup test exits 2, while the current native checker returns 1 when it cannot find a Vulkan physical device (runtime/test/vk_pipeline_check.cpp:843), among other initialization failures. My stub reproduced the exact message and exit 1 without writing an in-flight file. The base made one call, but this head launched all three ranges, despite the documented stop-on-setup behavior. A test that models the real setup result would cover the distinction from validation failure.

These runs used scripted checker processes. The native checker and GPU results are from the author's run.

AI-assisted.

@mrp1no

mrp1no commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@erickbobd, thanks. I claimed BUILD-1030 a few seconds before you, but your PR is already up and tested, so I won't write a competing one. I'm running the check you said is still missing: your head e461761 on my full 26,501-module work folder, under the same 26 GB per-process Job-object cap (RTX 3060, driver 610.88, 8 threads, empty pipeline_cache.bin). I'll post the counts when it finishes, in about 2 hours.

Meanwhile, measurements that bear on the design. They correct my finding's hypothesis that memory grows with the cache:

  • No accumulation over a range. Modules [0, 1500), 8 threads, empty cache: commit swings between 1.5 and 4.6 GB without trending up. The resulting cache is 236 MB. With no VkPipelineCache at all (a local experiment build) the swings are about the same.
  • Loading the full cache is cheap. A fresh process seeded with the whole 1.59 GB pipeline_cache.bin, checking 40 modules: peak 4.1 GB. Every batch of yours starting from the saved cache should begin around there.
  • The spikes are single heavy modules. One compute module that Pipelines stage: a module that takes vk_pipeline_check down is skipped and the rest is still checked #2111 re-checked alone (2.2 MB of SPIR-V, so under the 4 MiB --large-module-bytes isolation) took 704 s and about 11 GB on its own. The .spv size doesn't predict it: about 1,200 modules are larger. Near the first crash point, 16 of 60 neighbouring modules are over 2 MB.

So the original deaths look like several heavy modules compiling at once on 8 threads, not a process that has run too long. Restarting the process alone won't stop that. Your split-on-crash recovery should, since a small enough range ends up with the heavy modules alone. The full run will show how often that path is taken.

Counts only. AI-assisted (Claude Code).

@erickbobd

Copy link
Copy Markdown
Contributor Author

Updated in 30e67603 to distinguish the native setup exit 1 from a completed validation pass.

  • A finished native shader pass writes/clears its in-flight report, including when a module fails validation. Exit 1 without a fresh report now stops immediately. Each invocation removes stale reports first.
  • Single-module diagnostic probes now use the same report and setup-failure distinction, so a probe's initialization failure cannot trigger smaller retries or be counted as successful recovery.
  • Added two regressions for native-style setup exit 1, at batch startup and during a probe. Both fail on e4617613 and pass here. All 23 focused tests and the full 289-test build suite pass.
  • Also reproduced this with the actual Windows checker by selecting a nonexistent device through process-local LEONIDA_VK_DEVICE. e4617613 invoked both ranges of a 501-entry run; this head stops after one call, preserving the native initialization error. The actual 501-entry success and early-validation-failure/tail-success controls still behave correctly.

The PR and docs now incorporate the reporter's corrected memory measurements: the observed spikes came from heavy concurrent compiles, not demonstrated cumulative cache growth. The range-splitting algorithm in the in-progress full-corpus test at e4617613 is unchanged; this follow-up adds setup-failure handling and corrects the explanation. The pending full run should remain labelled with its exact tested head.

AI-assisted (Codex); only synthetic inputs and outcome counts used here.

@daemosofchaos

Copy link
Copy Markdown
Contributor

Independent synthetic Windows/Python check of 30e67603: the PR's 12 batch-recovery tests passed. I found a remaining attribution edge case in the diagnostic path.

Using the PR's scripted checker fixture, I made a three-entry batch exit abnormally after reporting two in-flight names, then made each single-entry probe exit 70 before doing any work or writing its in-flight report. crashes_alone() treated each probe exit as proof that the selected entry crashed the driver. Across the seven synthetic entries, the stage eventually failed, but wrote four innocent names to pipeline_crashes.txt and logged that they took the checker down; it launched 12 checker processes rather than stopping at the first inconclusive probe.

The pre-existing crashes_alone() logic also treated an abnormal probe exit as a shader crash, so this is not newly introduced by the PR. Could a probe establish that it reached the selected module before attributing the crash, and otherwise stop as inconclusive without blacklisting it? The checker's ordinary in-flight report can also be absent for a fast crash on a small module, so simply requiring an existing report would need a corresponding reliable start marker or another conservative fallback.

This is a scripted process simulation, not a reproduced Vulkan driver crash or a claim about the full-corpus run. No GPU or game files were used.

— LocalFirst-AI

@erickbobd

Copy link
Copy Markdown
Contributor Author

@daemosofchaos addressed in b27f2404 using the conservative fallback you described.

  • An abnormal single-entry probe counts as a module crash only when its own fresh in-flight report names that module. Missing, empty or unrelated reports stop immediately as inconclusive, without attributing the exit or adding that candidate to the crash list. Stale reports are still removed before each invocation.
  • The docs explicitly acknowledge that the native small-module report is periodic: a real fast crash can also lack evidence. This follow-up stops rather than guessing; it does not claim a reliable synchronous start marker was added.
  • Added three regressions using real scripted child processes: no report, an empty report, and a report naming a different module. All three fail at 30e67603 (12 calls each). They now stop after the failed batch and first probe (2 calls), with no crash-list file or module-crash claim. The confirmed-crasher control still checks the remaining modules and keeps the overall stage failed.
  • All 292 build tests, including the 15 child-process batching tests, pass. The real Windows/Vulkan 501-entry positive control, early-validation-failure/successful-tail control and nonexistent-device setup control were rerun successfully with the updated orchestration. Documentation and LF checks pass too.

The pending 26,501-module external run remains labelled e4617613; it does not validate this follow-up. Synthetic inputs only here. AI-assisted (Codex).

@daemosofchaos

Copy link
Copy Markdown
Contributor

Thanks @erickbobd. Retested b27f2404 on Windows/Python 3.12 with the original synthetic early-probe-failure case: it now stops after 2 checker starts, reports the result as inconclusive, and leaves no crash list. The current batch-recovery suite passed 15/15, and the pipeline orchestration suite passed 11/11.

This is a scripted-process check; I did not reproduce a real GPU crash or retest the full corpus. The documented trade-off for fast crashes without a fresh report is important. No game files were used.

— LocalFirst-AI

@mrp1no

mrp1no commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Partial result for the pipelines stage of this PR on the whole corpus (my own 1.0.2.1 copy, counts only). Setup: RTX 3060 / NVIDIA 610.88, Windows 11, make_game.py --stages pipelines under a 26 GB memory cap, batches of 500 shaders, each in a fresh process.

  • Batches 1–18,500 of 26,501 finished: ms 7,683 ok, ps 8,165, vs 1,659, cs 806, gs 195. That is 18,508 pipelines ok, 0 failed, 0 skipped.
  • Not finished: the run stopped during batch 18,501–19,000, after ~12 hours. It was ended from outside, because my machine ran low on memory with other work running beside it. That was not this PR's batching, and nothing failed before it.
  • Batch time: 2 to 60 minutes per batch, the long ones being the batches with the large compute modules.

I won't restart it right away. If someone has a finished full run, it supersedes this. AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit da3556f into ItsNotRexed:main Nov 23, 2026
2 of 7 checks passed
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.

5 participants