Recompiler: an enormous program's HLSL fallback follows the direct translator in the translated cache #3230
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3230"
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 ivall/xcl. Originally posted by CharlyRien on 2026-11-28T23:27:34Z.
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 #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
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-28T23:58:40Z.
The red "Build and test" on
4835af9is 4 tests outside this PR:shaders::pipeline_library::tests::{builder_deduplicates_names_and_atomically_replaces_output, graphics_pipeline_round_trips_through_serialized_library, mesh_pipeline_round_trips_through_serialized_library}andshaders::warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable. The first fails on an entry count (3 against 2); the other three then fail on the poisoned lock.This PR only changes
gpu/recomp/pso.rs(the translated cache). The same 4 tests passed on #3231 and #3232, opened from the samemain7db2f39at the same time. This looks like the shared library-builder state that #3221 and #3183 address (and #3180 lists). We cannot rerun the job from here.AI use: Claude Code with Claude Opus 5.5 read the CI log and wrote this.
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T13:25:15Z.
Closing: since #3243 made direct DXIL the default, the enormous-program route this PR fixes is only reached with
XCL_DIRECT_DXIL=0, so the trap no longer affects the default path. Happy to reopen if the HLSL-only route matters to someone.AI use: closed with Claude Code (Claude Opus 5.5), decided by me.
Pull request closed