Shaders: translations made with XCL_SAFE_BARRIER=0 are cached and reused by later runs #1399
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 pvfreis on 2026-11-24T15:41:58Z.
On
main(930e8b4),XCL_SAFE_BARRIER=0(0c02b87) changes the HLSL the recompiler emits fors_barrierin multi-wave compute programs (emit.rs:553), but it is not incache_allowed's list of variables that turn the translation caches off (pso.rs:448-451), and the cache key (ShaderKey, and the file name and header intranslated) does not include it. So a run, orxcl shaders --precompile, withXCL_SAFE_BARRIER=0stores those programs' DXIL with the plain group barrier, and later runs without the variable load it before any translation, so the early-exit-safe barrier of0c02b87is silently missing for them. In the other order,XCL_SAFE_BARRIER=0has no effect on programs already in the cache. Either way it lasts as long as those cache files are used (same translator sources and DXC).Run on
main(local tests, not for upstream; no GPU needed): translating a 128-thread compute program withS_BARRIERgives HLSL withxcl_s_barrier();with the variable unset and without it withXCL_SAFE_BARRIER=0, and the assertion!cache_allowed(Stage::Compute, |n| n == "XCL_SAFE_BARRIER")fails. The cache round trip itself was read, not run.Suggested fix: add
"XCL_SAFE_BARRIER"to the list incache_allowedand toshader_cache_bypasses_debug_overrides(pso.rs:907). #1284 (XCL_LOOP_BUDGET), #245 (XCL_CS_PAD_ALL,XCL_NO_CS_PAD) and #613 (XCL_DXC_ARGS) add names to the same list and test, so a fix touches the same lines.Found by reading the code and confirmed with local tests on
mainby Claude Code (Claude Opus 5.5 found it, Claude Sonnet 5.5 ran the tests, Claude Fable 5.2 re-checked it); checked by a person before posting.Imported from ivall/xcl. Originally posted by tiagonogueiraa-bit on 2026-11-24T15:42:45Z.
claiming:
XCL_SAFE_BARRIERgoes intocache_allowed's list, andshader_cache_bypasses_debug_overridesgets an assertion for it that fails on main. PR shortly.Written with Claude Code (Claude Opus 5.5).
upstream-sync referenced this issue2026-11-25 07:04:28 +00:00
Imported from ivall/xcl. Originally posted by pvfreis on 2026-12-03T01:04:59Z.
Fixed on main by
0d0a45213("Recompiler: no translated disk cache while XCL_SAFE_BARRIER is set"):XCL_SAFE_BARRIERis now incache_allowed's list (gpu/recomp/pso.rs), so a run with it set neither reads nor writes the translated disk cache. Closing.