Shaders: XCL_SAFE_BARRIER turns the translation caches off (#1409) #1413
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1413
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1413"
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?
@tiagonogueiraa-bit on GitHub · 2026-11-24 15:43 UTC · original
tiagonogueiraa-bit:safe-barrier-cache→main· +3 −3 · 2 files · 2 commits · openXCL_SAFE_BARRIER=0changes the HLSL emitted fors_barrierin multi-wave compute programs (emit.rs:553), but the variable was neither incache_allowed's list nor in the cache key. So 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. Fixes #1409.What is in it
crates/xcl/src/gpu/recomp/pso.rs:cache_allowed:XCL_SAFE_BARRIERjoins the list of variables that change the emitted code. As for those, its presence alone turns the caches off.shader_cache_bypasses_debug_overrideschecks it, for every stage.crates/xcl/build.rs:TRANSLATION_GLUE_REVISIONgoes topso-glue-v2. Entries that a run with the variable set stored under the default key would otherwise stay readable, sincepso.rsis outside the source hash; the new revision gives every build a new key (review by @pvfreis).Tested
cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc, no errors (C code stubbed, nothing linked).main:cache_allowed(Stage::Compute, |v| v == "XCL_SAFE_BARRIER")returnstruethere, as #1409 shows.b7aa9f3:cargo test --workspace --locked --no-fail-fast -- --test-threads=4gives 769 passed, 1 failed, 41 ignored, the same asmainb7aa9f3.shader_cache_bypasses_debug_overridespasses. The one failure is the e2e test's swap chain in a non-interactive session, on both. (report)Regression run
Not run. I have no Windows machine here.
Not tested
c160d86showed the stale entry being reused; the revision bump (190c97e) has not been run on Windows.Overlaps
#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. Whichever merges later rebases over a one-line conflict.AI use
🤖 Generated with Claude Code
@pvfreis on GitHub · 2026-11-24 16:34 UTC · original
Test report for
bfaf8c8b8d(this PR's head) merged onto mainb7aa9f3bd2(clean merge).shader_cache_bypasses_debug_overridespasses withXCL_SAFE_BARRIERadded; no regression elsewhere. I opened #1409, and this is the fix it suggested.Tested
cargo build --workspace --locked --offline, thencargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4:b7aa9f3: 769 passed, 1 failed, 41 ignoredb7aa9f3: 769 passed, 1 failed, 41 ignored (the PR extends an existing test,shader_cache_bypasses_debug_overrides, which passes)gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)test_title_runs_and_game_folder_is_untouched(e2e,presents0), because these runs are in an isolated non-interactive session whereCreateSwapChainForHwndreturns 0x887A0022.Not tested
XCL_SAFE_BARRIER=0set and unset across two runsTested and written with Claude Code (Claude Opus 5.5); the runs are real, on the hardware above.
@DavidM1911 on GitHub · 2026-11-24 17:08 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
@tiagonogueiraa-bit on GitHub · 2026-11-24 19:23 UTC · original
Thank you, @pvfreis, and @DavidM1911! The run is in Tested, and the PR is ready for review.
Written with Claude Code (Claude Opus 5.5).
@pvfreis on GitHub · 2026-11-24 19:46 UTC · original
The bypass for runs with
XCL_SAFE_BARRIERset looks right. One upgrade case remains.On stock
c160d86, a synthetics_barriershader wrote different translated entries under the same cache key with the flag unset and set to0. I copied just the=0entry into an empty cache and ran again with the flag unset. XCL reused that entry without writing a lower-level DXIL cache entry.At
bfaf8c8, this patch leavesTRANSLATION_GLUE_REVISIONunchanged.build.rsexcludespso.rsfrom the source hash, so a default run can still read a legacy entry when the hashed sources, DXC and shader settings match. Bumping the translation glue revision would retire those entries. The upgrade path was checked in the code.Codex (GPT-6.2 Sol) ran the stock probe. Codex (GPT-6.2 Astra) independently checked the evidence and upgrade path.
@tiagonogueiraa-bit on GitHub · 2026-11-24 19:48 UTC · original
Thanks @pvfreis, you're right: with
pso.rsoutside the source hash, an entry stored by a run with the variable set stays valid for default runs after this change.190c97ebumpsTRANSLATION_GLUE_REVISIONtopso-glue-v2, so every build gets a new key and those entries are retired. Description updated.@Mischief8713 on GitHub · 2026-11-24 20:36 UTC · original
GPU run of
190c97eon Windows (NVIDIA GTX 1660 Ti, Turing): 707 passed, 0 failed, 21 ignoredTested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4; build exit 0, test exit 0gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64)main(9039900). It was run as it is.bfaf8c8, then190c97e); the head, notbfaf8c8, was run. The diff touchesbuild.rsandpso.rs, and the suite has no new test name for it, so this shows that nothing else broke.Not tested
scripts/smoke.ps1run, so no regression runXCL_SAFE_BARRIERset, since that needs a titleAI use
@DavidM1911 on GitHub · 2026-11-26 05:13 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.