Shader cache serves translations from older builds: TRANSLATOR_VERSION was never bumped after translator changes #215

Open
opened 2026-11-26 11:59:04 +00:00 by github-bot · 0 comments
Owner

@⁠kekonn on GitHub · 2026-11-26 11:54 UTC · original

What goes wrong

crates/victory-shader/src/lib.rs:29: pub const TRANSLATOR_VERSION: u32 = 1;

By default the shader cache key is build() in crates/victory-gpu/src/shader_cache.rs (~86-150). It is made of TRANSLATOR_VERSION, FORMAT, a list of named switches and host_settings(), plus the container bytes.

The two build-script fingerprints are not part of the default key:

  • victory-gpu/build.rs → VICTORY_TRANSLATOR. It joins the key only with VICTORY_SHADER_KEY=source. Otherwise it only drives the "stale" count.
  • victory-shader/build.rs → VICTORY_SHADER_SOURCE_HASH. Its only reader, emit::translation_fingerprint(), has no callers.

git log -G 'pub const TRANSLATOR_VERSION' shows only 1162d38, which introduced the constant. Since then, merges have brought about 9 commits that change what the translator emits (368293e, 4fd34fd, 06fe22a, 7348b80, ad0f9dd, 431cab5, abbbd6b, 7bf91de and 9b7dc77, in lower.rs/ir.rs), with no bump. On a cache hit, cached_by (~239-255) sees made_by != SOURCE, logs once and serves the old DXIL as it is.

When

Default runs whose cache was made by an earlier build. Translator fixes never reach shaders that are already cached unless VICTORY_SHADER_FRESH=1 is set or victory shaders is run.

Proposed fix

Set TRANSLATOR_VERSION to 2. That matches #184 (and #142), so those merge cleanly. #152 sets 4 and conflicts on this one line.

Longer term, the manual bump is easy to forget. A test or xtask check could compare the source fingerprint against a recorded value, or a fingerprint of the translator's output on fixed inputs.

Upstream: #184, #152 and #142 bump the constant as a side effect. None changes the policy of serving stale entries.
Status: the bump is being prepared in kekonn/VIctory-7900XTX on branch claude/gifted-clarke-uxuqw8.


Generated by Claude Code

**@⁠kekonn** on GitHub · 2026-11-26 11:54 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/215) ### What goes wrong `crates/victory-shader/src/lib.rs:29`: `pub const TRANSLATOR_VERSION: u32 = 1;` By default the shader cache key is `build()` in `crates/victory-gpu/src/shader_cache.rs` (~86-150). It is made of `TRANSLATOR_VERSION`, `FORMAT`, a list of named switches and `host_settings()`, plus the container bytes. The two build-script fingerprints are **not** part of the default key: - `victory-gpu/build.rs` → `VICTORY_TRANSLATOR`. It joins the key only with `VICTORY_SHADER_KEY=source`. Otherwise it only drives the "stale" count. - `victory-shader/build.rs` → `VICTORY_SHADER_SOURCE_HASH`. Its only reader, `emit::translation_fingerprint()`, has no callers. `git log -G 'pub const TRANSLATOR_VERSION'` shows only 1162d38, which introduced the constant. Since then, merges have brought about 9 commits that change what the translator emits (368293e, 4fd34fd, 06fe22a, 7348b80, ad0f9dd, 431cab5, abbbd6b, 7bf91de and 9b7dc77, in `lower.rs`/`ir.rs`), with no bump. On a cache hit, `cached_by` (~239-255) sees `made_by != SOURCE`, logs once and serves the old DXIL as it is. ### When Default runs whose cache was made by an earlier build. Translator fixes never reach shaders that are already cached unless `VICTORY_SHADER_FRESH=1` is set or `victory shaders` is run. ### Proposed fix Set `TRANSLATOR_VERSION` to `2`. That matches #184 (and #142), so those merge cleanly. #152 sets `4` and conflicts on this one line. Longer term, the manual bump is easy to forget. A test or xtask check could compare the source fingerprint against a recorded value, or a fingerprint of the translator's output on fixed inputs. **Upstream:** #184, #152 and #142 bump the constant as a side effect. None changes the policy of serving stale entries. **Status:** the bump is being prepared in kekonn/VIctory-7900XTX on branch `claude/gifted-clarke-uxuqw8`. --- _Generated by [Claude Code](https://claude.ai/code)_
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:59:04 +00:00
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/avatarmanz--VIctory-7900XTX#215
No description provided.