Shader cache: six translator switches the key left out are in it, and a test checks every switch #807
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/807"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T06:31:41Z.
Found while choosing the tests to ask for in #739, the water light's tile-sized blocks under water.
Rebuilt on main (
923e38c). Its new test found three more switches missing from the key, added by today's merges, so six are keyed now. Main's own two new names (VICTORY_WATER_VOLUME_PORTALS,VICTORY_LDS_BOUNDS_EXEMPT) are inKEYEDtoo.What happens
These switches change how a program is translated, and none of them is in the shader cache's key:
VICTORY_LOOPS_WAVE64d4931VICTORY_LDS_FIRST_INITVICTORY_LDS_INIT_HOISTlds_init_hoist_oninlower.rs)759f05cVICTORY_HDR_CLAMP=0turns it off)2e855b0VICTORY_SAMPLED_MARKS=1; off by default)a410fd0VICTORY_DEFRAGCS_DefragHeap_ComputeRelocationsis translated (=0leaves it untranslated, for comparisons)d4d7193The comment in
pipeline/make.rscredits the first two for the water light's open-water fix.A run that changes one of them is served the translations an earlier run cached without the change, so the switch looks as if it did nothing. For example,
VICTORY_SAMPLED_MARKS=1gets programs that mark no slot, andVICTORY_DEFRAG=0still runs the defragmentation from the cache. The comment above the list already describes the same trap forVICTORY_WAVE_WIDE.The change
Cache key: the list of switches keyed by name is now a const,
KEYED, with the six names added.Translator:
victory_shader::emit::SWITCHESgives the list ofVICTORY_*switches that the translator'sbuild.rsalready gathers from its sources (VICTORY_SHADER_SWITCHES).translation_fingerprint()now reads the same const.Test: a new test checks every switch on that list. Each one must be either:
KEYED;VICTORY_RDNA_FLOATthroughhost_rdna);VICTORY_REQUIRE_HW_GPU).A new switch that is none of these fails the test. So does a listed name the translator no longer reads.
The key changes, so every translation is made again once after the update, as after any translator change.
Why not
translation_fingerprint()Main already has
victory_shader::emit::translation_fingerprint()(847a0af). It keys every switch the translator names, but nothing calls it: the cache's key is stillbuild()inshader_cache.rs.Keying on it would also key the switches that change no translation, such as
VICTORY_WAVE_WHY,VICTORY_EMIT_DUMPorVICTORY_ADAPTER. A run with one of those set would then translate everything again. So this PR keeps the cache's own list, and the test keeps that list complete.#550 adds
VICTORY_CODE_TABLE_AFTERto the same list. Whichever of the two lands second needs to add one line.Tests
shader_cache::tests::every_switch_of_the_translator_is_in_the_key. It passes. It fails without the names it found:32ecacf, with["VICTORY_LDS_FIRST_INIT", "VICTORY_LDS_INIT_HOIST", "VICTORY_LOOPS_WAVE"];923e38c, with["VICTORY_DEFRAG", "VICTORY_HDR_CLAMP", "VICTORY_SAMPLED_MARKS"].cargo test -p victory-gpu --lib --locked: 551 passed, 43 ignored.--all-targets, default and--all-features): nothing in the changed lines. Main923e38chas findings of its own: 13 in the default build and 11 with--all-features. Among them: an unusedcolourand amanual_checked_opsinlower.rs, dead code insend.rs,pool.rsandresource.rs, too many arguments, and adropof a reference inhost.rs.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T07:09:21Z.
Review: APPROVED
Tested locally merged onto
main(63b902f).cargo xtask policypassed (294 files ok).cargo test -p victory-gpu --lib shader_cache::passed (3 passed; 0 failed, including the newevery_switch_of_the_translator_is_in_the_keyregression test).cargo test -p victory-shader --lib emit::tests::passed (22 passed; 0 failed; 1 ignored).Good cache-correctness fix preventing stale cached DXIL across
VICTORY_LOOPS_WAVE/VICTORY_LDS_FIRST_INITtoggles. LGTM.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).