rdna2spirv: do not cache a missing stage index #2194

Closed
leonida/mandy
whoalin1 wants to merge 0 commits from shader-stage-cache-missing-index into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

whoalin1 commented 2026-11-26 04:46:58 +00:00

Depends on: #2154
Claimed in the coordination issue as SHADER-STAGE-CACHE-MISSING-INDEX (comment 7182872123).

What

qhukz13's #2154 review noted a remaining edge case: even with the stage cache keyed by carve root, a missing index.json is cached as that root's empty table for the rest of the process. If the index is created later, stage_of() keeps using the fallback stage until _STAGES is reset.

This follow-up caches only successful index reads. A missing file is probed again on the next lookup; a root whose index did load is still cached exactly as #2154 intends.

Test

Adds a synthetic missing-then-created regression case to tests/test_rdna2spirv_stage_cache.py.

  • python -I tests/test_rdna2spirv_stage_cache.py — 3 tests OK
  • python -I tests/test_bvh_shaders_stage.py — 13 tests OK
  • python -I tests/test_exe_shaders_stage.py — 11 tests OK
  • python -I tests/test_shader_library.py — 22 run, 21 passed + 1 skipped
  • python -m compileall -q tools/rdna2spirv.py tests/test_rdna2spirv_stage_cache.py — PASS

No game data.

AI-assisted.

Depends on: #2154 Claimed in the coordination issue as `SHADER-STAGE-CACHE-MISSING-INDEX` (comment 7182872123). ## What qhukz13's #2154 review noted a remaining edge case: even with the stage cache keyed by carve root, a missing `index.json` is cached as that root's empty table for the rest of the process. If the index is created later, `stage_of()` keeps using the fallback stage until `_STAGES` is reset. This follow-up caches only successful index reads. A missing file is probed again on the next lookup; a root whose index did load is still cached exactly as #2154 intends. ## Test Adds a synthetic missing-then-created regression case to `tests/test_rdna2spirv_stage_cache.py`. - `python -I tests/test_rdna2spirv_stage_cache.py` — 3 tests OK - `python -I tests/test_bvh_shaders_stage.py` — 13 tests OK - `python -I tests/test_exe_shaders_stage.py` — 11 tests OK - `python -I tests/test_shader_library.py` — 22 run, 21 passed + 1 skipped - `python -m compileall -q tools/rdna2spirv.py tests/test_rdna2spirv_stage_cache.py` — PASS No game data. AI-assisted.
whoalin1 commented 2026-11-26 04:50:19 +00:00

Additional focused verification on the stacked head c5c367a2a: tests/test_rdna2spirv_stage_cache.py 3/3 OK; tests/test_bvh_shaders_stage.py 13/13 OK; tests/test_exe_shaders_stage.py 11/11 OK; tests/test_shader_library.py 22 run, 21 passed + 1 skipped. compileall PASS. No game data.

Additional focused verification on the stacked head c5c367a2a: tests/test_rdna2spirv_stage_cache.py 3/3 OK; tests/test_bvh_shaders_stage.py 13/13 OK; tests/test_exe_shaders_stage.py 11/11 OK; tests/test_shader_library.py 22 run, 21 passed + 1 skipped. compileall PASS. No game data.
real-rusher commented 2026-11-26 10:06:35 +00:00

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_rdna2spirv_stage_cache.py: 3 tests OK. The same test file against main's tools/rdna2spirv.py: 2 failures, so it fails on main and passes with the fix. compileall clean.

AI-assisted: yes (Claude Code)

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_rdna2spirv_stage_cache.py: 3 tests OK. The same test file against main's tools/rdna2spirv.py: 2 failures, so it fails on main and passes with the fix. compileall clean. AI-assisted: yes (Claude Code)
Tauwni commented 2026-11-26 12:50:32 +00:00

Tested c5c367a2a on macOS 26.5.1 (Apple M3, Python 3.15). CPU only, synthetic fixtures.

  • tests/test_rdna2spirv_stage_cache.py: 3/3 pass, test_bvh_shaders_stage.py 13/13, test_exe_shaders_stage.py 11/11, and test_shader_library.py 22/22.
  • Control: with this PR's one-line change to tools/rdna2spirv.py reverted (back to #2154's head), test_a_missing_index_is_not_cached fails. With it, the test passes. So the new case does catch the cached miss.
  • The branch merges cleanly with main a73a57e13.

AI-assisted (Claude Code). No game data.

Tested `c5c367a2a` on macOS 26.5.1 (Apple M3, Python 3.15). CPU only, synthetic fixtures. - `tests/test_rdna2spirv_stage_cache.py`: 3/3 pass, `test_bvh_shaders_stage.py` 13/13, `test_exe_shaders_stage.py` 11/11, and `test_shader_library.py` 22/22. - Control: with this PR's one-line change to `tools/rdna2spirv.py` reverted (back to #2154's head), `test_a_missing_index_is_not_cached` fails. With it, the test passes. So the new case does catch the cached miss. - The branch merges cleanly with `main` `a73a57e13`. AI-assisted (Claude Code). No game data.
whoalin1 commented 2026-11-26 13:23:11 +00:00

Consolidated into #2154 without rewriting: #2154 was fast-forwarded to this PR's exact head c5c367a2a, so the missing-index fix and regression test are preserved there. Closing this stacked follow-up to reduce review noise.

Consolidated into #2154 without rewriting: #2154 was fast-forwarded to this PR's exact head `c5c367a2a`, so the missing-index fix and regression test are preserved there. Closing this stacked follow-up to reduce review noise.
Sign in to join this conversation.
No description provided.