Shaders: restore cached-only state after panics #2368
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2378"
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 mokkamokacaffe on 2026-11-25T17:27:15Z.
A panic inside
dxc::cached_only()previously bypassed its thread-local cleanup. If an outer caller caught that panic, later shader requests on the same thread remained in cache-only mode and could silently fail as deferred cache misses.This addresses only the unclaimed TLS-state item from #1896. The mesh/geometry deferral and
xcl shaders --directworker handling are covered separately.Part of #1896.
What is in it
crates/xcl/src/gpu/recomp/dxc.rs: restore the previousCACHED_ONLYandMISSEDstate through an RAII guard during normal returns and panic unwinding.Tested
cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc: passed.git diff --check: passed.Regression run
xcl-smokeruns on currentmainand this PR’s exact head commit.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T19:12:03Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1 real failure, deterministic (also fails--test-threads=1, 1219/1):The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge.
— Devin
Imported from ivall/xcl. Originally posted by pablogonz12 on 2026-11-25T19:56:05Z.
Test report from Linux + Wine on AMD, since "Not tested" says the Windows test binary was not executed. This is the first execution of it that I can see: it runs under Wine here, on AMD RADV hardware. Prepared with AI assistance: DeepSeek V4.1 Flash in OpenCode; the commands were run by it and the output is pasted verbatim.
Setup
RADV GFX1201), AMD Radeon RX 9070 XT 16 GB (native wave64), Ryzen 9 9900X.WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b",VKD3D_CONFIG=ignore_shared_fence,WINEDEBUG=-all, DXC 1.9.2609.5 (01b62ad4).RUSTFLAGS="-C target-feature=+crt-static" cargo xwin test --workspace --release --target x86_64-pc-windows-msvc --no-run; runwine <xcl lib exe> --test-threads=1 <filter>.main2898511with this PR merged on top (clean merge, only this PR differs), head = 86c12ba.Result
2898511dxcgpu::recompThe new test passes:
The three
gpu::recompfailures are main's own on this box and are byte-identical before and after the PR (they are not related todxc.rs):Excluded from the counts
gpu::recomp::tests::jumps_to_outer_loop_heads_are_structuredaborts the test binary on Wine + RADV (exit status 5, #1246) on both trees; skipped on both sides and not counted.Not tested
dxcandgpu::recompwere run, because further chapters abort on this Wine lane as described above).AI use
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:06:45Z.
Review: COMMENTED
No code-level defect found. The TLS RAII guard restores cached-only/miss state through unwind and nesting; focused tests cover panic restoration and miss propagation. Please provide a clean current Windows rerun: PR comments report a deterministic lower-DXIL failure on a rebased branch, apparently outside dxc.rs but needing independent attribution/reproduction. A nested-panic-after-outer-miss case would further pin combined TLS state.
Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:44:00Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Pull request closed