Cache deterministic shader translation refusals across runs #230
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!230
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-230"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@feanorsun on GitHub · 2026-11-26 06:09 UTC · original
feanorsun:fix/cache-deterministic-shader-refusals→rx9070xt· +432 −74 · 5 files · 2 commits · openRefs #218 (item 1)
Store the reason from a final
ShaderError::Unsupportedunder the same disk key as a successful translation. Reopening the cache returns that reason as an error and skips the translator. The record uses the pipeline cache's atomic write path. Existing success records still decode, and damaged records are retried.An empty
VICTORY_STRICT_JOINSorVICTORY_MESH_OUTPUT_STRICTenables strict mode. The key now distinguishes an empty switch from an unset one so a strict-mode refusal cannot carry over when the switch is removed.Verification
On Windows,
cargo test --offline --locked -j 1 -p victory-gpu --lib shader_cache::tests:: -- --listlisted 6 tests. Running the same filter with--test-threads=1passed all 6 (359 filtered out). The tests used only the CPU, temporary directories, fixed build fingerprints and synthetic inputs.Malformederror containing “unsupported” succeeded on retry, as did a cache write after removing a file that blocked the cache directory.@adrianmjim on GitHub · 2026-11-26 22:42 UTC · original
Checked by reading the code on a-publier
cd8dfc0(headb524804, change 81ebb7b..b524804); I did not build or run it.Rebase: 81ebb7b..b524804 conflicts in
crates/victory-gpu/src/shader_cache.rsoncd8dfc0.cd8dfc0still does not store refusals (test "Failures are not stored",shader_cache.rs:520). Two things change on the new base:1. Refusals and version keying
cd8dfc0the key isTRANSLATOR_VERSION(shader_cache.rs:99-103,crates/victory-shader/src/lib.rs:29= 1), not the translator's source hash as on81ebb7b.crates/victory-shader/src/lib.rs:21-28says the version is left as it is for "shaders that did not translate before". The module doc says the same (shader_cache.rs:4-6: the store grows by the shaders a change made translate).4eb6cfd, where #324 bumped the version to 2 (lib.rs:29) for an output change inemit/bitcode/opt.rs. That is the kind of unrelated bump the stale refusals would wait for.shader_cache.rsis unchanged there, so the point still stands.cd8dfc0already handles this for translations: entries carry the build that made them (encode,shader_cache.rs:316-320),cached_byspots entries from another build (:239-241), andprecompileandVICTORY_SHADER_FRESH=1translate them again (:166,:178). A VSR1 record with no build stamp cannot take part in that.oldincached_by(:234,:256-260) is aHostShader. If a stale refusal now translates, do not count it inCHANGED. Percrates/victory-shader/src/lib.rs:25-28that is not a reason to bump the version.2.
append_switchchanges every keycd8dfc0.lower.rs:5210andlower.rs:13294testvar_os(..).is_some(), and the key writesNAME=\0for both cases (shader_cache.rs:127-132).append_switch(headshader_cache.rs:97) also changes the bytes for every unset switch, fromNAME=\0toNAME\0. So every existing key changes.81ebb7bthat did not matter, because each rebuild changed the key anyway. Oncd8dfc0keys are kept stable on purpose (:4-7, andVICTORY_PORT_CBVis appended only when on,:136-141). This change would make the next run translate the whole set again and orphan the old entries. If it goes in together with a version bump, that cost is paid anyway. If it goes in on its own, it is not.Not checked: whether
cd8dfc0hasShaderError::Unsupportedrefusals that depend on anything outsidebuild()andhost_settings()(lower.rs:1517).View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.