Translator: --shader-list to translate only a subset of shaders (SHADER-SUBSET) #1529

Closed
x2Tweek wants to merge 5 commits from upstream-pr/1529 into main
x2Tweek commented 2026-11-25 03:36:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-11-25T03:36:22Z.


Claimed in the coordination issue as: SHADER-SUBSET (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125745299)

What and why

Translator: --shader-list to translate only a subset of shaders. Replaces closed PR #565 whose head conflicted with upstream/main. Rebased on upstream main at 0bc810504.

  • tools/rdna2spirv.py --shader-list FILE and make_game.py --shader-list FILE: subset writes to <spirv>/subset/, never touches the full spirv/index.json, skips fingerprint checks and verify_translation_completeness.
  • The shard plan beside the subset output now includes a SHA-256 of the shader list file's contents, so overwriting the same list file with a different selection drops old parts and re-translates only missing shards (fixes the stale-subset-cache bug reported by sodove on #565).
  • 3 new SubsetListIdentityTest cases in tests/test_shader_stage_resume.py cover same-list reuse, changed-list re-translate, and same-path overwrite re-translate.

Tested

  • tests/test_shader_stage_resume.py: 50 passed (3 new SubsetListIdentityTest cases)
  • tests/test_rdna2spirv_index_write.py: 8 passed, 1 skipped (9 total)
  • tests/test_make_game_empty_translation.py: 16 passed
  • tests/test_rdna2spirv_cli.py: 37 passed
  • python -m compileall -q make_game.py tools tests: clean
  • python -I make_game.py --help: clean
  • All synthetic inputs, no game data, no GPU needed. Tested locally on Windows, Python stdlib only.

GPUs tested: n/a

AI-assisted: yes (Claude Code)

Checklist:

  • No game data, keys or decryption
  • Translator rule in the contract table in docs/design.md (N/A — no new translator rule)
  • Tested on local Windows machine (Python 3.15.2, stdlib only)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5484674166 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1529). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-11-25T03:36:22Z. --- Claimed in the coordination issue as: SHADER-SUBSET (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7125745299) ### What and why Translator: `--shader-list` to translate only a subset of shaders. Replaces closed PR #565 whose head conflicted with upstream/main. Rebased on upstream main at 0bc810504. - `tools/rdna2spirv.py --shader-list FILE` and `make_game.py --shader-list FILE`: subset writes to `<spirv>/subset/`, never touches the full `spirv/index.json`, skips fingerprint checks and `verify_translation_completeness`. - The shard plan beside the subset output now includes a SHA-256 of the shader list file's contents, so overwriting the same list file with a different selection drops old parts and re-translates only missing shards (fixes the stale-subset-cache bug reported by sodove on #565). - 3 new `SubsetListIdentityTest` cases in `tests/test_shader_stage_resume.py` cover same-list reuse, changed-list re-translate, and same-path overwrite re-translate. ### Tested - `tests/test_shader_stage_resume.py`: 50 passed (3 new SubsetListIdentityTest cases) - `tests/test_rdna2spirv_index_write.py`: 8 passed, 1 skipped (9 total) - `tests/test_make_game_empty_translation.py`: 16 passed - `tests/test_rdna2spirv_cli.py`: 37 passed - `python -m compileall -q make_game.py tools tests`: clean - `python -I make_game.py --help`: clean - All synthetic inputs, no game data, no GPU needed. Tested locally on Windows, Python stdlib only. GPUs tested: n/a AI-assisted: yes (Claude Code) Checklist: - [x] No game data, keys or decryption - [x] Translator rule in the contract table in docs/design.md (N/A — no new translator rule) - [x] Tested on local Windows machine (Python 3.15.2, stdlib only)
GeorgiyDemo commented 2026-11-25 03:51:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T03:51:01Z.


Tested c3d151561 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 5129be10d (translator / make_game.py CLI; no GPU):

  • pytest 9.2.0 (from tests/requirements.txt) on tests/test_rdna2spirv_cli.py tests/test_make_game_empty_translation.py tests/test_shader_stage_resume.py: 101 passed, 1 skipped, 38 subtests passed at this head.
  • The same three files on main: 5 failed, 96 passed, 1 skipped, 38 subtests — test_shader_list_filters_translated_shaders, test_subset_translates_to_subset_dir_and_full_index_survives, and the three SubsetListIdentityTest resume/identity tests. So the subset behaviour is genuinely new coverage.
  • Not run: a real corpus translation with --shader-list (needs game data); only the synthetic tests.

AI-assisted; synthetic fixtures only, no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152298314 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1529#issuecomment-7152298314). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T03:51:01Z. --- Tested `c3d151561` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `5129be10d` (translator / `make_game.py` CLI; no GPU): - pytest 9.2.0 (from `tests/requirements.txt`) on `tests/test_rdna2spirv_cli.py tests/test_make_game_empty_translation.py tests/test_shader_stage_resume.py`: **101 passed, 1 skipped, 38 subtests passed** at this head. - The same three files on `main`: **5 failed**, 96 passed, 1 skipped, 38 subtests — `test_shader_list_filters_translated_shaders`, `test_subset_translates_to_subset_dir_and_full_index_survives`, and the three `SubsetListIdentityTest` resume/identity tests. So the subset behaviour is genuinely new coverage. - Not run: a real corpus translation with `--shader-list` (needs game data); only the synthetic tests. AI-assisted; synthetic fixtures only, no game data.
sodove commented 2026-11-25 04:35:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-25T04:35:29Z.


Confirmed the stale subset cache I reported in #565 is fixed at c3d151561 on native Windows 11, Python 3.12.10. I reran the original case through make_game.shaders with two translator subprocesses and the real index merger, using four hand-written synthetic inputs.

Run Requested entries in published index Unrequested entries Finished shards reused
A, fresh output 2/2 0 0/2
A again, same output 2/2 0 2/2
Overwrite the same list file with disjoint B, same output 2/2 0 0/2
B, fresh output (control) 2/2 0 0/2
B under a different filename, same contents and output 2/2 0 2/2

On the old head the overwrite row returned 0/2 requested and retained both A entries. The full index stayed byte-identical in all five runs with a stale full-index translator fingerprint. The three SubsetListIdentityTest cases also passed.

CPU only. Synthetic inputs only. AI-assisted verification (OpenAI Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152983346 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1529#issuecomment-7152983346). Originally posted by [sodove](https://github.com/sodove) on 2026-11-25T04:35:29Z. --- Confirmed the stale subset cache I reported in #565 is fixed at `c3d151561` on native Windows 11, Python 3.12.10. I reran the original case through `make_game.shaders` with two translator subprocesses and the real index merger, using four hand-written synthetic inputs. | Run | Requested entries in published index | Unrequested entries | Finished shards reused | | --- | ---: | ---: | ---: | | A, fresh output | 2/2 | 0 | 0/2 | | A again, same output | 2/2 | 0 | 2/2 | | Overwrite the same list file with disjoint B, same output | 2/2 | 0 | 0/2 | | B, fresh output (control) | 2/2 | 0 | 0/2 | | B under a different filename, same contents and output | 2/2 | 0 | 2/2 | On the old head the overwrite row returned 0/2 requested and retained both A entries. The full index stayed byte-identical in all five runs with a stale full-index translator fingerprint. The three `SubsetListIdentityTest` cases also passed. CPU only. Synthetic inputs only. AI-assisted verification (OpenAI Codex).
tiguan26 commented 2026-11-25 05:52:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T05:52:48Z.

Review: APPROVED


Approving. Merged into current main (42537e7) with no conflicts, Linux, Python 3.13. test_make_game_empty_translation.py, test_rdna2spirv_cli.py (37 tests) and test_shader_stage_resume.py pass, and the full translator suite gives 487 files / 6,279 tests with only test_int32_to_f64 failing, the same spirv-opt crash as on main here. --shader-list filters by stem and its content is part of the shard plan identity, so a subset run cannot resume another list's plan.

AI-assisted (Claude).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6052516890 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1529#pullrequestreview-6052516890). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-25T05:52:48Z. **Review:** APPROVED --- Approving. Merged into current main (42537e7) with no conflicts, Linux, Python 3.13. `test_make_game_empty_translation.py`, `test_rdna2spirv_cli.py` (37 tests) and `test_shader_stage_resume.py` pass, and the full translator suite gives 487 files / 6,279 tests with only `test_int32_to_f64` failing, the same spirv-opt crash as on main here. `--shader-list` filters by stem and its content is part of the shard plan identity, so a subset run cannot resume another list's plan. AI-assisted (Claude).
x2Tweek commented 2026-11-25 08:50:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-11-25T08:50:09Z.


The rebase dropped the full build's early spirv-opt check for --compact-spirv. The follow-up restores it and adds a regression test that fails on the published head. The four targeted suites passed locally on Windows (111 passed, one skipped). AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157530695 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1529#issuecomment-7157530695). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-11-25T08:50:09Z. --- The rebase dropped the full build's early spirv-opt check for --compact-spirv. The follow-up restores it and adds a regression test that fails on the published head. The four targeted suites passed locally on Windows (111 passed, one skipped). AI-assisted: yes.
tiguan26 commented 2026-11-25 18:47:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T18:47:37Z.

Review: APPROVED


Rechecked e89c291 and approving again. Merged into current main (b9320a1) with no conflicts. tests/test_make_game_empty_translation.py, tests/test_rdna2spirv_cli.py and tests/test_shader_stage_resume.py pass (102 passed, 1 skipped), and the full translator suite gives 490 files / 6,292 tests with only test_int32_to_f64 failing, the same baseline failure as main here (Linux, Python 3.13).

The restored need("spirv-opt") sits before the full translation starts, next to the spirv-as/spirv-val checks, so a missing spirv-opt under --compact-spirv stops the run before any index is written. The new test checks exactly that.

AI-assisted (Claude).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6063154963 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1529#pullrequestreview-6063154963). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-25T18:47:37Z. **Review:** APPROVED --- Rechecked e89c291 and approving again. Merged into current main (b9320a1) with no conflicts. `tests/test_make_game_empty_translation.py`, `tests/test_rdna2spirv_cli.py` and `tests/test_shader_stage_resume.py` pass (102 passed, 1 skipped), and the full translator suite gives 490 files / 6,292 tests with only `test_int32_to_f64` failing, the same baseline failure as main here (Linux, Python 3.13). The restored `need("spirv-opt")` sits before the full translation starts, next to the spirv-as/spirv-val checks, so a missing spirv-opt under `--compact-spirv` stops the run before any index is written. The new test checks exactly that. AI-assisted (Claude).
DadaCap commented 2026-11-28 07:21:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T07:21:02Z.


Thanks for this! A --shader-list subset run is a handy way to check a fix on a few shaders without a full translation.

During maintainer testing (local, 2026-11-28) (head e89c29128, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found:

  • tests/test_make_game_argparse.py fails with this PR alone on main: JobsHandlingTest::test_custom_jobs_forwarded_to_shaders and StageValidationAndSequencingTest::test_independent_stages_all_run_when_listed_out_of_order.
  • The PR's own ShadersStageSubsetTest also failed (SystemExit 1) when combined with other ready PRs.

To get this merged:

  • Update test_make_game_argparse for the new shader_list argument and fix the subset test.
  • When carve or disassembly reruns, --shader-list should also drop the full index and shard plan (review note).

AI-assisted (Claude Code), posted for DadaCap (maintainer).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7235877078 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1529#issuecomment-7235877078). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T07:21:02Z. --- Thanks for this! A `--shader-list` subset run is a handy way to check a fix on a few shaders without a full translation. During maintainer testing (local, 2026-11-28) (head e89c29128, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found: - `tests/test_make_game_argparse.py` fails with this PR alone on main: `JobsHandlingTest::test_custom_jobs_forwarded_to_shaders` and `StageValidationAndSequencingTest::test_independent_stages_all_run_when_listed_out_of_order`. - The PR's own `ShadersStageSubsetTest` also failed (SystemExit 1) when combined with other ready PRs. To get this merged: - Update `test_make_game_argparse` for the new `shader_list` argument and fix the subset test. - When carve or disassembly reruns, `--shader-list` should also drop the full index and shard plan (review note). _AI-assisted (Claude Code), posted for DadaCap (maintainer)._

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1529
No description provided.