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

Closed
zmelumian972 wants to merge 633 commits from upstream-pr/352 into main
zmelumian972 commented 2026-11-27 19:16:50 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by zmelumian972 on 2026-11-27T19:16:50Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5531919205 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/352). Originally posted by [zmelumian972](https://github.com/zmelumian972) on 2026-11-27T19:16:50Z. --- 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)
TaynanGT commented 2026-11-27 19:36:59 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T19:36:59Z.


@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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7226702623 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/352#issuecomment-7226702623). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T19:36:59Z. --- @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.

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
TaynanGT/Vice-Tay!352
No description provided.