Fail offline shader commands when a translation is not cached #352

Closed
github-bot wants to merge 1 commit from github-bot/gh-352 into main AGit
Owner

@⁠zmelumian972 on GitHub · 2026-11-27 19:16 UTC · original
zmelumian972:fix/offline-shader-cache-failures → main · +88 −33 · 4 files · 1 commits · closed without merging

Fixes #185.

victory shaders and victory translate --warm counted a shader as cached and exited 0 even when its cache entry could not be written, so the next run translated it again.

Change

  • shader_cache::cached_by records, in a thread-local, why its translation stayed off disk (write failed, or the entry never read back). The work runs synchronously on each worker thread, so the per-thread value is per call.
  • precompile returns Precompiled::{Cached, Translated, NotCached(why)} instead of bool. If no cache could be opened, every shader is NotCached.
  • Both offline commands count NotCached on its own (… N could not be cached) and exit nonzero with the first reason. Shaders that don't translate are still reported as before.
  • Runs keep the in-memory translation (#29). No cache format or translator version change.
  • d3d12x::warm_shader is removed: it only re-mapped precompile.

This is a smaller version of the patch proposed in the issue (+88/−33). It doesn't change cached's return type or the wording of the existing tests.

Validation

Linux, GE-Proton11-14 (Wine), RTX 5090, diag build, using the issue's synthetic compute fixture with the published entry replaced by a directory:

stock 10675b5 this branch
shaders, normal 1 shaders in the cache, exit 0 same + 0 could not be cached, exit 0
shaders, entry blocked 1 shaders in the cache, exit 0 0 shaders in the cache, 1 do not translate, 1 could not be cached, could not cache 1 shaders (the first: Access denied. (os error 5)), exit 1
translate --warm all, entry blocked 1 translated now, exit 0 0 translated now, 0 in the cache already, 1 do not translate, 1 could not be cached, exit 1

Tests under Wine:

  • victory-gpu shader_cache tests pass (4/4). a_failed_cache_write_keeps_the_translation now also checks that the failure is reported.
  • The victory app tests pass.
  • Two victory-hle tests (only_loopback_is_reachable, a_kept_blob_past_the_link_limit_is_copied) fail the same way on stock under the no-network sandbox and Wine, so they're unrelated.
  • I didn't run the full victory-gpu suite to completion under Wine (it hangs there), so Windows CI covers the rest.

This is a correctness fix for prewarming, not an FPS claim.

🤖 Generated with Claude Code

**@⁠zmelumian972** on GitHub · 2026-11-27 19:16 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/352) `zmelumian972:fix/offline-shader-cache-failures` → `main` · +88 −33 · 4 files · 1 commits · closed without merging Fixes #185. `victory shaders` and `victory translate --warm` counted a shader as cached and exited 0 even when its cache entry could not be written, so the next run translated it again. ### Change - `shader_cache::cached_by` records, in a thread-local, why its translation stayed off disk (write failed, or the entry never read back). The work runs synchronously on each worker thread, so the per-thread value is per call. - `precompile` returns `Precompiled::{Cached, Translated, NotCached(why)}` instead of `bool`. If no cache could be opened, every shader is `NotCached`. - Both offline commands count `NotCached` on its own (`… N could not be cached`) and exit nonzero with the first reason. Shaders that don't translate are still reported as before. - Runs keep the in-memory translation (#29). No cache format or translator version change. - `d3d12x::warm_shader` is removed: it only re-mapped `precompile`. This is a smaller version of the patch proposed in the issue (+88/−33). It doesn't change `cached`'s return type or the wording of the existing tests. ### Validation Linux, GE-Proton11-14 (Wine), RTX 5090, `diag` build, using the issue's synthetic compute fixture with the published entry replaced by a directory: | | stock `10675b5` | this branch | |---|---|---| | `shaders`, normal | `1 shaders in the cache`, exit 0 | same + `0 could not be cached`, exit 0 | | `shaders`, entry blocked | `1 shaders in the cache`, **exit 0** | `0 shaders in the cache, 1 do not translate, 1 could not be cached`, `could not cache 1 shaders (the first: Access denied. (os error 5))`, **exit 1** | | `translate --warm all`, entry blocked | `1 translated now`, **exit 0** | `0 translated now, 0 in the cache already, 1 do not translate, 1 could not be cached`, **exit 1** | Tests under Wine: - `victory-gpu` `shader_cache` tests pass (4/4). `a_failed_cache_write_keeps_the_translation` now also checks that the failure is reported. - The `victory` app tests pass. - Two `victory-hle` tests (`only_loopback_is_reachable`, `a_kept_blob_past_the_link_limit_is_copied`) fail the same way on stock under the no-network sandbox and Wine, so they're unrelated. - I didn't run the full `victory-gpu` suite to completion under Wine (it hangs there), so Windows CI covers the rest. This is a correctness fix for prewarming, not an FPS claim. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`victory shaders` and `victory translate --warm` counted a shader as cached
and exited 0 even when its cache entry could not be written, so the next run
translated it again. `cached_by` now records, per thread, why its translation
stayed off disk; `precompile` returns Cached, Translated or NotCached, and both
commands count NotCached separately and exit nonzero. Runs keep the in-memory
translation as before. No cache format or translator version change.

Fixes #185

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013YhYvcC3LWS732gZjBTkvp
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 19:22:10 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 19:36 UTC · original

@⁠zmelumian972 I built on this in #356. The cache lookup now returns its own outcome, so a miss on one worker can’t count as a write on another. It also leaves the precompile marker pending when any translation stays off disk. Your work is credited on the commit, and Windows CI is running there.

**@⁠TaynanGT** on GitHub · 2026-11-27 19:36 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/352#issuecomment-7226702623) @⁠zmelumian972 I built on this in #356. The cache lookup now returns its own outcome, so a miss on one worker can’t count as a write on another. It also leaves the precompile marker pending when any translation stays off disk. Your work is credited on the commit, and Windows CI is running there.
github-bot closed this pull request 2026-11-27 19:50:40 +00:00

Pull request closed

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