make_game: rebuild empty compute shader modules on resume #1235

Open
github-bot wants to merge 1 commit from github-bot/gh-1235 into main AGit
Owner

@⁠titoreinaldo on GitHub · 2026-11-24 20:40 UTC · original
titoreinaldo:contrib/r2-cache → main · +32 −13 · 3 files · 1 commits · open

Claimed in the coordination issue as: BUILD-EMPTY-SPV-CACHE
Claim in #14

What and why

Both the FSPX and pipeline-library stages accepted a zero-byte .spv if its filename, index and settings marker were still present. Rerunning the shaders step skipped the rebuild and left an unusable module for the runtime. The shared cache check now requires every indexed module to be a nonempty regular file. It uses one stat per entry.

Tested

  • Before the change the two stage regressions both failed for an empty module. After the change both rebuild it, check the restored bytes, and reuse the repaired cache on the next run.
  • python -m pytest -q tests/test_fspx_shaders_stage.py tests/test_library_shaders_stage.py — 41 passed, plus 21 subtests passed.
  • Repeated the failure with each stage’s synthetic input builder and the real LLVM disassembler, translator and SPIR-V tools. Truncating the FSPX module (4,040 bytes) and pipeline-library module (4,192 bytes) regenerated the exact original bytes. Both passed spirv-val --target-env vulkan1.2, and the third invocation preserved each module’s modification time.
  • python -I make_game.py --help and python -m compileall -q make_game.py tools tests passed. The shared base 58be9cdf ran 6,168 translator tests in 470 files with zero failing files. Verified a clean merge with main at 705ea091.

GPUs tested: CPU-only build and recovery on Windows 11 Pro 26H2 build 26300.9974, Python 3.12.14.

AI-assisted: yes, OpenAI Codex. All inputs were synthetic.

**@⁠titoreinaldo** on GitHub · 2026-11-24 20:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1235) `titoreinaldo:contrib/r2-cache` → `main` · +32 −13 · 3 files · 1 commits · open Claimed in the coordination issue as: BUILD-EMPTY-SPV-CACHE [Claim in #14](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Both the FSPX and pipeline-library stages accepted a zero-byte `.spv` if its filename, index and settings marker were still present. Rerunning the shaders step skipped the rebuild and left an unusable module for the runtime. The shared cache check now requires every indexed module to be a nonempty regular file. It uses one stat per entry. ### Tested - Before the change the two stage regressions both failed for an empty module. After the change both rebuild it, check the restored bytes, and reuse the repaired cache on the next run. - `python -m pytest -q tests/test_fspx_shaders_stage.py tests/test_library_shaders_stage.py` — 41 passed, plus 21 subtests passed. - Repeated the failure with each stage’s synthetic input builder and the real LLVM disassembler, translator and SPIR-V tools. Truncating the FSPX module (4,040 bytes) and pipeline-library module (4,192 bytes) regenerated the exact original bytes. Both passed `spirv-val --target-env vulkan1.2`, and the third invocation preserved each module’s modification time. - `python -I make_game.py --help` and `python -m compileall -q make_game.py tools tests` passed. The shared base `58be9cdf` ran 6,168 translator tests in 470 files with zero failing files. Verified a clean merge with `main` at `705ea091`. GPUs tested: CPU-only build and recovery on Windows 11 Pro 26H2 build 26300.9974, Python 3.12.14. AI-assisted: yes, OpenAI Codex. All inputs were synthetic.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:57 +00:00
Author
Owner

@⁠xel1uz on GitHub · 2026-11-24 20:48 UTC · original · approved these changes

Reviewed the shared cache check and both callers. I ran the PR tests against upstream 66d4f5aa first: truncating the cached module to zero bytes made both stages reuse the empty file. On a clean trial merge of bb68bb93 into that same base, both stages rebuilt the module, restored the expected bytes, and reused it on the next run.

On Ubuntu 26.04.1, python3 -I -B tests/test_fspx_shaders_stage.py -v passed 24/24 and python3 -I -B tests/test_library_shaders_stage.py -v passed 17/17, including the real SPIR-V tools case. The changed-file game-data check passed. Synthetic inputs, CPU only. AI-assisted review.

**@⁠xel1uz** on GitHub · 2026-11-24 20:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1235#pullrequestreview-6047148857) · **approved these changes** Reviewed the shared cache check and both callers. I ran the PR tests against upstream `66d4f5aa` first: truncating the cached module to zero bytes made both stages reuse the empty file. On a clean trial merge of `bb68bb93` into that same base, both stages rebuilt the module, restored the expected bytes, and reused it on the next run. On Ubuntu 26.04.1, `python3 -I -B tests/test_fspx_shaders_stage.py -v` passed 24/24 and `python3 -I -B tests/test_library_shaders_stage.py -v` passed 17/17, including the real SPIR-V tools case. The changed-file game-data check passed. Synthetic inputs, CPU only. AI-assisted review.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1235/head:github-bot/gh-1235'
git switch 'github-bot/gh-1235'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1235'
git switch 'github-bot/gh-1235'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1235'
git switch 'github-bot/gh-1235'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1235'
git switch 'main'
git merge --squash 'github-bot/gh-1235'
git switch 'main'
git merge --ff-only 'github-bot/gh-1235'
git switch 'main'
git merge 'github-bot/gh-1235'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.