Shaders: restore cached-only state after panic #1960
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!1960
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1960/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?
@mokkamokacaffe on GitHub · 2026-11-24 23:52 UTC · original
mokkamokacaffe:shaders/cached-only-panic-safe→main· +52 −4 · 1 files · 1 commits · closed without mergingAddresses #1896 item 1 without overlapping the mesh deferral or timeout-worker work.
What is in it
CACHED_ONLYtoggling with an RAII guard that restores thread-local state during normal return and stack unwinding.false, so nested cached-only probes remain inside their outer scope.Tested
git diff --check: passed.Build and test: passed.main; both new tests passed.gpu::recomp::dxc::cache_testscompleted with 12 passed, 0 failed, 0 ignored;cargo build --locked --workspace -j 2passed.cargo test -p xcl --libcompleted with 1038 passed and one known parallel flake tracked in #1978; its single-threaded rerun completed with 1039 passed, 0 failed.cached_onlywas restored tomain's implementation while retaining the tests.Regression run
Paired 60-second runs from
scripts/smoke.ps1, using the same title and duration. Themainand PR worktrees were clean when run.main:
PR:
The PR run produced 104% of
main's frames and 102% of its peak commit, with no crash or device removal in either run.Not tested
AI use
main, open issues, and newly opened PRs; isolated the unclaimed panic-safety part of #1896; implemented the RAII restoration and nesting tests; and performed source-level and diff validation.@futurepro62 on GitHub · 2026-11-25 00:23 UTC · original · edited 2026-11-25 00:40 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
f48d2ff(on its base62265d3).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 978 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.cached_only_restores_tls_after_a_panic,nested_cached_only_propagates_a_miss_and_restores_the_outer_scope.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 987 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main80f4819too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@Royalflamejlh on GitHub · 2026-11-25 01:50 UTC · original
Linux (Wine) test of
f48d2ffmerged onmain80f4819with #684: its two tests pass, and both fail whencached_onlyis put back tomain's body with the tests kept. A 60 s regression pair of a retail title showed no crash and no device removal with or without it.Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b, RTX 4070 12 GB (driver 615.71.09), Ryzen 9 9950X3D, 62 GB RAM. Release, cross-compiled to
x86_64-pc-windows-gnu(rustc 1.98.0).Tested
cargo test -j 8 --release -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=4 cached_only: 2 passed, 0 failed.cached_only(dxc.rs:899) put back tomain's: 2 failed, atdxc.rs:964(assertion failed: in_cached_only()) anddxc.rs:951(assertion failed: !in_cached_only()). So each test is red without the fix.scripts/smoke.ps1, unchanged, 60 s on the start screen, one run of each tree:main80f4819+ #684f48d2ffThe tree with the change ran first. The steady rate is the same in both, and I read the 75-frame difference in the totals as start-up time (a guess; one run each). The exit code is the same in both; my reading is the kill that ends a run under Wine (137).
Read
dxc.rs:874to:905: when the guard drops it puts back the earlierCACHED_ONLYandMISSEDand hands an inner miss to an outer cached-only scope, as the description says.real.rs:3413(attempt), used atreal.rs:4539,:4584and:5197(lines atf48d2ff) in the pipeline-creation handlers. I found nocatch_unwindbetween those entry points andcached_only, the entry points areextern "system"(I read that as: a panic leaving one ends the process), and none of the three closures reachesattemptagain. If that is right, a title run today never reads the left-over state, and the change guards tests and later callers. Is that your reading too?Not tested: Windows; AMD and Intel; the title past the start screen.
AI use: Claude Code (Claude Fable 5.2) read the diff, built the tree, ran the tests and the regression pair, and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
@JJAutoCompare on GitHub · 2026-11-25 02:55 UTC · original
PR #1960 — Shaders: restore cached-only state after panic
Tested detached commit
f48d2ff8688604364df799dd76998fd1583367cbon STOR-WINLAB. The worktree was clean.Environment
Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB, driver 32.0.101.9175. Wave range 8–32,
DoublePrecisionFloatShaderOps=0, D3D12 debug layer unavailable. Rust 1.100.0 (0ef1bc386 2026-11-09), DXC/DXIL 1.9.2609.5, unoptimized dev/test profiles with debug info disabled.Tested
cargo build --workspaceandcargo test --workspace --no-runsucceeded outside the GPU lock.cargo test -p xcl gpu::recomp::dxc::cache_tests -- --nocapturereported 12 passed, 0 failed, 0 ignored. Both PR tests passed here and in the workspace suite. One catches a synthetic panic and checks that cached-only mode is cleared and deferral is off. The other checks that an inner miss reaches the outer scope and cached-only mode is restored at both scope boundaries.cargo test --workspace --no-fail-fast -- --test-threads=4ran once under the shared Arc A770 lock. Across 20 libtest summaries, including doctests, the totals were 963 passed, 25 failed, 45 ignored. Cargo exited 101.CreateComputePipelineStaterejection (0x80070057), including FP64 cases. Four reported output mismatches in fused FMA overflow, implicit-LOD sampling, f16 high-half preservation, and pixel-shader wave reduction. One test-title e2e failed its dynamic depth-bias check (blue pixel where green was expected).SKIPPEDlines: 17 for unavailable wave64, three for refused per-lane wave32 forms, one for driver cache disabling unavailable, and one for unavailable heap windows. These include partial skips and provide no coverage for the skipped paths.Not tested
Retail-title smoke runs, a
mainbaseline, other GPUs, and D3D12 debug-layer paths.XCL_SAMPLE_*was unset, so sample-dependent cases provide no retail coverage. Failure attribution to this PR remains unverified without a baseline.AI use
T3 Code / Codex (
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1960-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 03:00 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
@luckyteagirl on GitHub · 2026-11-25 03:39 UTC · original
Tested
f48d2ff8688604364df799dd76998fd1583367cbon Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5. The focused cache tests did not exercise the RX 6800M GPU.cargo test --locked -p xcl --lib -j 2 gpu::recomp::dxc::cache_tests -- --test-threads=1 --show-output: 12 passed, 0 failed, 0 ignored, no explicit skips. The two new tests passed: a caught synthetic panic restored cached-only TLS state, and a nested probe propagated its cache miss while restoring the outer scope. The panic printed by the first test is expected and caught.cargo build --locked --workspace -j 2: passed.Not tested
AI use
OpenAI Codex (GPT-6, exact variant not exposed in this session) reviewed the exact diff, ran the focused suite and workspace build, checked the logs, and drafted this report.
@Toons29 on GitHub · 2026-11-25 10:28 UTC · original
Regression run of
f48d2ff8on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 102 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@raylitebull on GitHub · 2026-11-25 10:46 UTC · original
Code review on
f48d2ff(CachedOnlyGuardRAII restoration indxc.rs+ tests) looks clean,Build and testis green, and both NVIDIA (@futurepro62,@DavidM1911) and AMD (@futurepro62,@Toons29) coverage is posted.To unblock merge, please fold
@Toons29's pairedxcl-smoke v1blocks (568e7db7vsf48d2ff8) into the PR description's Regression run section (and recheck thePR descriptionstatus check, which is currently failing on thePendingplaceholder), plus confirm@Royalflamejlh's question aboutattemptcallers inreal.rs.@mokkamokacaffe on GitHub · 2026-11-25 11:45 UTC · original
Confirmed. The only non-test caller of cached_only is attempt in real.rs, reached from the three pipeline-creation handlers. There is currently no catch_unwind between those handlers and cached_only; a panic escaping an extern "system" entry point terminates the process, and those closures do not re-enter attempt. Therefore, today’s retail path would not observe the stale TLS after such an escaping panic. The guard still fixes caught-panic safety for tests and future/internal callers, and correctly preserves nested cached-only state and miss propagation.
@mokkamokacaffe on GitHub · 2026-11-25 12:02 UTC · original
Done.
Pull request closed