From bfaf8c8b8dcd7959179625fa27b8da4e3cbdc2ab Mon Sep 17 00:00:00 2001 From: Thierry Date: Tue, 24 Nov 2026 12:43:11 -0300 Subject: [PATCH 1/2] Shaders: XCL_SAFE_BARRIER turns the translation caches off (#1409) XCL_SAFE_BARRIER=0 changes the HLSL emitted for s_barrier in multi-wave compute programs (emit.rs), but the variable was neither in cache_allowed's list nor in the cache key. A run with it stored those programs' DXIL with the plain group barrier, and later runs without it loaded that DXIL. In the other order, the variable had no effect on programs already cached. It is now in cache_allowed's list, like the other variables that change the emitted code. As for those, its presence alone turns the caches off. shader_cache_bypasses_debug_overrides checks it. Co-Authored-By: Claude Opus 5.5 --- crates/xcl/src/gpu/recomp/pso.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs index 3fa375577..0de708ada 100644 --- a/crates/xcl/src/gpu/recomp/pso.rs +++ b/crates/xcl/src/gpu/recomp/pso.rs @@ -446,7 +446,7 @@ fn cached_shader( } fn cache_allowed(stage: Stage, present: impl Fn(&str) -> bool) -> bool { - !["XCL_RECOMP_NO_STRUCTURED", "XCL_RECOMP_WHY", "XCL_X64_ALL_MASKS", "XCL_WAVE64_SPIN"] + !["XCL_RECOMP_NO_STRUCTURED", "XCL_RECOMP_WHY", "XCL_X64_ALL_MASKS", "XCL_WAVE64_SPIN", "XCL_SAFE_BARRIER"] .iter() .any(|name| present(name)) && (stage != Stage::Pixel @@ -905,7 +905,7 @@ mod shader_cache_tests { #[test] fn shader_cache_bypasses_debug_overrides() { - for name in ["XCL_RECOMP_NO_STRUCTURED", "XCL_RECOMP_WHY", "XCL_X64_ALL_MASKS", "XCL_WAVE64_SPIN"] { + for name in ["XCL_RECOMP_NO_STRUCTURED", "XCL_RECOMP_WHY", "XCL_X64_ALL_MASKS", "XCL_WAVE64_SPIN", "XCL_SAFE_BARRIER"] { assert!(!cache_allowed(Stage::Compute, |v| v == name)); assert!(!cache_allowed(Stage::Vertex, |v| v == name)); assert!(!cache_allowed(Stage::Pixel, |v| v == name)); From 190c97e2c357e47879e5bfde8ac34a4de80c0622 Mon Sep 17 00:00:00 2001 From: Thierry Date: Tue, 24 Nov 2026 16:48:08 -0300 Subject: [PATCH 2/2] Shaders: retire translation cache entries written before the XCL_SAFE_BARRIER bypass Entries a run with XCL_SAFE_BARRIER=0 or =1 stored under the default key stay readable after the bypass, since pso.rs is outside the source hash. Bumping TRANSLATION_GLUE_REVISION gives every build a new key. Co-Authored-By: Claude Opus 5.5 --- crates/xcl/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/xcl/build.rs b/crates/xcl/build.rs index caf2ef4c7..c45f3fd97 100644 --- a/crates/xcl/build.rs +++ b/crates/xcl/build.rs @@ -3,7 +3,7 @@ use std::path::Path; // `pso.rs` also contains cache storage and pipeline setup. Keep it out of the source hash so // those changes do not discard translations; bump this only when its container parsing, // translation options, profiles, or post-translation HLSL changes. -const TRANSLATION_GLUE_REVISION: &str = "pso-glue-v1"; +const TRANSLATION_GLUE_REVISION: &str = "pso-glue-v2"; const TRANSLATOR_SOURCES: &[&str] = &[ "src/gpu/dxbc.rs",