Repository navigation
Recompiler: an enormous program's HLSL fallback follows the direct translator in the translated cache - #3230
CharlyRien wants to merge 1 commit into
Conversation
…anslator in the translated cache A compute program whose HLSL DXC would compile unoptimised (`pso::enormous`) goes to the direct DXIL translator, and what that translator makes is kept on disk under `rerouted_identity`, which follows the translator's version and sources. When the direct translator fails on such a program, its HLSL fallback was kept under the HLSL path's identity, which does not. `translated::cached_rerouted` looks under that identity first, so every later build, with a direct translator that can now translate the program, was served the old fallback and never tried again. compile_console_shader now says that fallback follows the direct translator too: it is kept under `rerouted_identity`, and a new direct translator version misses it and translates the program again. Programs the HLSL path takes for other reasons, and everything with XCL_DIRECT_DXIL (whose identity already has the direct translator's version), are kept where they were. Entries a build without this stored stay under the HLSL path's identity and are still served: such a fallback goes only when its file is removed or the cache is new. Test: an_enormous_programs_fallback_is_retried_by_a_new_direct_translator (the fallback is a hit for the same direct translator, missed by a new one, which keeps its own DXIL; an old entry under the HLSL path's identity is still served). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The red "Build and test" on This PR only changes AI use: Claude Code with Claude Opus 5.5 read the CI log and wrote this. |
|
Closing: since #3243 made direct DXIL the default, the enormous-program route this PR fixes is only reached with AI use: closed with Claude Code (Claude Opus 5.5), decided by me. |
Update: #3243 (merged on
mainafter this PR's base7db2f39) makes direct DXIL the default. With it, the enormous-program route is skipped and the cache identity already follows the direct translator, so the trap described here remains only withXCL_DIRECT_DXIL=0. This PR has not been rebased onto it yet; it still merges without conflict.A compute program whose HLSL DXC would compile unoptimised (
pso::enormous, over 8 MiB of HLSL) goes to the direct DXIL translator, even withoutXCL_DIRECT_DXIL. What that translator makes is kept in the translated cache underrerouted_identity, which follows the direct translator's version and sources. When the direct translator fails on such a program, its HLSL fallback was kept under the HLSL path's identity instead, and that identity does not follow the direct translator.translated::cached_reroutedlooks under the HLSL path's identity first. So once a build has stored such a fallback, every later build is served that fallback, even one whose direct translator can now translate the program. The program is never tried again.This PR keeps that fallback under
rerouted_identitytoo. A new direct translator version then misses it and translates the program again.What is in it
crates/xcl/src/gpu/recomp/pso.rs:compile_console_shader: when the enormous-program route's direct translation fails, the HLSL result it falls back to is marked as following the direct translator (theboolthat already sends the direct translator's own output torerouted_identity).compile_console_shaderandtranslated::cachedsay so; the cache-hit note reads "direct DXIL (its HLSL is enormous), or its HLSL fallback".XCL_DIRECT_DXIL(whose identity already carries the direct translator's version).shader_cache_tests::an_enormous_programs_fallback_is_retried_by_a_new_direct_translator:pso.rsis one ofPREPARATION_LAYOUT_SOURCES, soXCL_PIPELINE_LAYOUT_IDchanges, as with any edit ofpso.rs. The translator identity (XCL_TRANSLATOR_SOURCE_ID) does not change.Why (what we hit)
maine429936cthe direct translator failed on it, andmainstored its 9,370,880-byte HLSL fallback. A build of Recompiler: preserve compute prologue dominance in direct DXIL #3154 translates that program directly (1,214,602 bytes). Its first run, on a copy of the cache from themainrun, was servedmain's fallback, unchanged.cached_reroutedthe HLSL path's identity is looked up first, thenrerouted_identity. Only the direct translator's own output was stored underrerouted_identity.rerouted_identity, which misses, and the lookup then still finds the old fallback under the HLSL path's identity. The fallback itself has to follow the direct translator.Tested
main7db2f39(it merges withmain227d2cbwithout conflict; not tested there). RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631, Rust 1.100.0, release tests (cargo test --release -p xcl --lib),XCL_REQUIRE_GPU=mesh.gpu::recomp::pso::shader_cache_tests::: 31 passed, 0 failed, the new test and the two existing rerouted-cache tests (rerouted_disk_entries_follow_the_direct_translator,..._follow_compact_nesting_policy) among them.main7db2f39(no new one).Regression run
Not run yet: no
scripts/smoke.ps1pair (main and this head) has been made for this PR, so there is noxcl-smokeblock. That is why it stays a draft. The change only decides under which identity a fallback is stored, for enormous compute programs whose direct translation fails.Not tested
cached_reroutedwith the flagcompile_console_shadernow sets).TRANSLATION_GLUE_REVISIONwould clear them, but also every other translation, so this PR does not.cached_rerouted(container validation); the two should merge without overlap, not checked.AI use
🤖 Generated with Claude Code