Shaders: cache refused shaders and DXC failures by capability (#1412) #1472
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!1472
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1472/head"
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?
@KarolKurzyna on GitHub · 2026-11-24 16:37 UTC · original
KarolKurzyna:shaders/negative-cache-capability-markers→main· +626 −16 · 2 files · 2 commits · closed without mergingFixes #1412.
What is in it
dxc: ...) in<key>.failmarkers alongside<key>.dxil(crates/xcl/src/gpu/recomp/dxc.rs), storing the formatted failure text and a capability digest (XCLFAIL1, package version,XCL_TRANSLATOR_SOURCE_ID, andtoolchain_identity()).CacheCounters::cached_failure(CacheStats::cached_failures) without incrementingcompilationsorcompilation_failuresor triggeringCACHED_ONLYdeferrals.Compile: ...,DXC: ..., missing DLL, invalid container) are never negative-cached.<stem>.fail(XCLTRNF1+ident, capability digest overident/stage/sampler_base/windows/split, blob size andhash2) insidetranslated(crates/xcl/src/gpu/recomp/pso.rs), short-circuiting before re-lowering on subsequent runs while skippingcached_onlydeferrals (has_missed()) and transient DXC errors..failfile on disk whenever capability-changing or debug env overrides are active (XCL_SAFE_BARRIER,XCL_SPLIT_WAVE64,XCL_WAVE64_SPIN,XCL_NEGATIVE_CACHE,XCL_RECOMP_*,XCL_DEBUG_*), and deletes stale or mismatched markers when a capability digest drifts or a shader later succeeds.main(1a0bbe3, PR #1426 Direct DXIL + PR #1693):translated::identity()stays wired throughidentity_with(..., Backend::current(), crate::gpu::dxil::kernel::TRANSLATOR_VERSION), isolating Direct DXIL refusal markers from HLSL ones and invalidating them onTRANSLATOR_VERSIONbumps.Tested
1.100.0; DXC1.9.2602.17.cargo build --release -p xcl: passed. Two existingAtomic::fetch_updatedeprecation warnings are in untouched files/lines.translated_refusals_are_cached_and_invalidated_by_capability_digest: passed on head9e1a79e47915.cargo test --workspace -- --test-threads=4on head9e1a79e47915: xcl library had 1186 passed, 1 failed, 26 ignored. The failure isgpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(DXIL not compiled yet); it reproduces on base1a0bbe3a2ba9as well.Regression run
Fresh main baseline (warm cache):
This PR head (warm cache):
Not tested
AI use
Original implementation and initial evidence were prepared with Google Antigravity (Gemini 4 Neon). Codex (GPT-6) rebased/reviewed the branch, corrected the test's synthetic marker byte index, and ran the current build, tests, and smoke checks.
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@pickles976 on GitHub · 2026-11-24 16:42 UTC · original
Reviewed the diff — this implements #1412's acceptance faithfully, and two choices go beyond the letter of it in the right direction: the master kill switch inside the override list (
XCL_NEGATIVE_CACHEpresence ⇒ markers off, so the feature is testable in both directions without a rebuild) and the determinism gate (dxc:-prefixed failures only — correctly excludes driver-side rejections, which are capability-dependent and would poison exactly like the class we were trying to avoid).XCLFAIL1/XCLTRNF1magic + reason-length bound + digest-in-header with miss-then-overwrite recovery is the right file shape; reason replay keeps log-tail comparability.One edge worth a documented limitation (or a follow-up line in the digest), because negative entries poison asymmetrically where positive entries merely serve a stale variant: the capability digest folds translator-source-id + toolchain + extra flags, but not the device-derived wave decision —
split_wave64comes from the device wave range at PSO time, and laptops with iGPU+dGPU (or users swapping adapters) share one cache directory. Run on the wave64-capable adapter ⇒ a shader refusals-free… precisely: a shader whose refusal depends on the non-split path gets a marker; the same cache on the 32-lane adapter, where the split lowering would translate it fine, is now permanently refused — wrong-in-a-way-the-positive-cache never was (positive staleness costs perf, negative staleness costs content). The positive cache's single-device assumption is pre-existing, so this is not a merge blocker — but either fold a device-capability bit (split-vs-native wave64 is enough; full LUID would overfit to docks/eGPU churn) into both digests, or state the single-adapter-per-cache assumption in the module docs and in the #1412 close note so the next iGPU-laptop "why is everything magenta-refused" report is a grep instead of a mystery.@KarolKurzyna on GitHub · 2026-11-24 16:50 UTC · original
@pickles976 Thanks for the quick review!
One helpful detail already in the diff: in
pso.rs,translated::fail_fileandtranslated::capability_digestalready includesplit(split_wave64) alongsideident,stage,sampler_base, andwindows(both in the filename..._{split as u8}.failand in theXCLTRNF1capability digest), so a wave64-native adapter and a split-wave64 adapter sharing one cache directory will not poison each other's translator refusal markers.In
dxc.rs,<key>.failis keyed on the full emitted HLSLsrc(plusentry,profile,toolchain_identity(), andXCL_TRANSLATOR_SOURCE_ID), so wave-dependent lowering differences already produce different HLSL and separate<key>.failentries; I agree the single-adapter-per-cache assumption still applies if two adapters somehow produce identical HLSL or share graphics wave knobs, and I am happy to add a short module doc note (or fold a wave-mode bit intodxc.rsas well) if you want that before merge.@nnonno91 on GitHub · 2026-11-24 16:54 UTC · original
Independent Windows/AMD test of
a56a7c7aeb694ff9645d2f923430c731ded3da7ffor #1412.Tested
x86_64-pc-windows-msvc, debug builds. The workspace suite used DXC 1.8.2502.11.cargo build --workspace --lockedpassed.cargo test --locked -p xcl --lib cache_tests -- --test-threads=4passed all 27 tests.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputhad 776 passed, 0 failed, 41 ignored, and noSKIPPEDmessages. The bundled test title passed.dxc::compile_cachedwithfloat4 main() : SV_Target { return xcl_undefined_value; }(main,ps_6_6). Each invocation ofcargo test --locked -p xcl --test dxc_refusal_probe -- --exact real_dxc_refusal_probe --nocapture --test-threads=1started a fresh process. All five passed using a single initially emptyXCL_DXIL_CACHEdirectory..failfiles after runXCL_NEGATIVE_CACHE=0The cold and warm 1.8 runs returned identical error text. The override removed the 1.8 marker, and the next run with the override unset recreated it.
Not tested
Retail-title smoke runs, startup performance, and cross-process replay of translator refusals. The five-process probe exercised the DXC path.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) wrote and ran the temporary probe and drafted this report.
@DavidM1911 on GitHub · 2026-11-24 18:53 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. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@KarolKurzyna on GitHub · 2026-11-24 19:52 UTC · original
Rebased onto
main(9039900, #1426 Direct DXIL + #1693) — new head ise96f516.@DavidM1911 Thank you for verifying on RTX 3060 Ti!
Direct DXIL interop on
e96f516translated::identity_with(..., Backend::current(), crate::gpu::dxil::kernel::TRANSLATOR_VERSION)insidetranslated::identity()(crates/xcl/src/gpu/recomp/pso.rs), soXCL_DIRECT_DXILrefusal markers stay isolated from HLSL entries and invalidate wheneverTRANSLATOR_VERSIONbumps.Backend/TRANSLATOR_VERSIONisolation assertions totranslated_refusals_are_cached_and_invalidated_by_capability_digest.Re-verified on
e96f516(RTX 3070 Ti, DXC 1.9.2602.17).\scripts\test.ps1: 864 passed, 0 failed, 42 ignored across 20 runs (unittests src\lib.rs:815 passed, 0 failed, 22 ignored;GPU tests skipped on this adapter: 2 (no wave64), 1 (no heap windows)).cargo build --release -p xcl) + 60 sscripts/smoke.ps1:exit: 0x0,1630frames (PresentX 1630),60 60 60,0device removals/crashes,14522 MBpeak commit.@speed-y on GitHub · 2026-11-24 20:33 UTC · original
Independent Windows/NVIDIA verification of head
e96f516(A18 / #1412).Tested
dxc_deterministic_failures_are_cached_and_replayed,dxc_negative_marker_invalidates_on_capability_change_and_env_override,dxc_transient_failures_are_not_negative_cached,translated_refusals_are_cached_and_invalidated_by_capability_digest,translated_negative_markers_skip_and_delete_under_env_overrides,translated_deferred_and_transient_errors_are_not_negative_cached,direct_dxil_identity_never_collides_with_hlsl,direct_and_hlsl_disk_entries_are_separate)..\scripts\test.ps1: 864 passed, 0 failed, 42 ignored; SKIPPED GPU: 2 (no wave64), 1 (no heap windows).Regression run (warm not required; single 60 s smoke of this head)
Not tested
AI use
@raylitebull on GitHub · 2026-11-25 18:24 UTC · original
Superseded for #1412 by #1474 (just merged with the DXIL cache lock-error / Internal Compiler error: E_OUTOFMEMORY fixes and dual-vendor verification on exact head).
@DavidM1911 on GitHub · 2026-11-26 05:27 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.Pull request closed