Skip to content

xcl run: a panic on any thread is written to xcl.log - #2005

Open
Royalflamejlh wants to merge 2 commits into
xcl-dev:mainfrom
Royalflamejlh:arch/log-panics
Open

Royalflamejlh wants to merge 2 commits into
xcl-dev:mainfrom
Royalflamejlh:arch/log-panics

Conversation

@Royalflamejlh

@Royalflamejlh Royalflamejlh commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

A panic on any thread of the host is now written to xcl.log as an ERROR line, as well as to stderr. Until now it went to stderr only, so the file a report carries had nothing of it. One of XCL's own threads that panics is gone for the rest of the run, and the run then reads like any other stall.

Seen in a retail title run of ours (Linux through Wine and vkd3d-proton, RTX 4060 Ti 16 GB, a local tree at c3af1d7): stderr had thread 'xcl-sync-watchdog' (2032) panicked at crates/xcl/src/hle/d3d12x/list_x.rs:1374:55: called Option::unwrap() on a None value at the first bridged GPU wait (97.6 s), and xcl.log had no line of it. The log has 8 bridged waits after that and no released on CPU to prevent GPU hang line, and the title's own watchdog ended the run at 149.5 s; the run does not show that a release would have changed that end. That panic is the start-up race #1926 fixes; this change does not touch it. It is 1 of the 142 title runs of ours under Wine on 23 and 24 November that bridged a wait (the 134 of 24 November are the ones counted in our comment on #1926); we only found it because the harness keeps stderr.

Related to #1452 and #505 (the waits that thread releases); it fixes neither. It is a diagnostic: the next thread that dies shows in the log.

What is in it

  • crates/xcl/src/log.rs: log_panics installs a panic hook that writes thread '<name>' panicked at <file>:<line>:<col>: <message> at ERROR level (flushed at once, like every ERROR line), then calls the hook that was installed before, so stderr and RUST_BACKTRACE behave as before. A thread without a name is written as thread ''. A panic that XCL catches (a DXC worker's, DirectStorage's parallel decoding) is logged the same way. With log_to_stderr on, the line is on stderr twice (XCL's echo and Rust's own).
  • crates/xcl/src/host.rs: the host calls it right after log::init. The xcl shaders, inspect and other commands are not changed.
  • a unit test, log::tests::a_panic_is_in_the_log: a named thread panics and the log file has its name, the place and the message.

Tested

  • Native Windows: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26300, rustc 1.99.1. cargo build --release -p xcl of 0eccc4e (on main 8e87fc7): builds, with 2 warnings, as main 8e87fc7 has there.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug) on 0eccc4e: 987 passed, 4 failed, 45 ignored; the new test passed. The head ecda938 differs from 0eccc4e in comments only (−4 +1 lines). The four failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0 to _3; the same four failed on main 689f2db on this machine earlier the same day (971 passed, 4 failed, 45 ignored). main 8e87fc7 itself was not run.
  • 24 SKIPPED lines: 19 no wave64, 3 wave32 per-lane forms refused, 1 no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record (the driver cache cannot be turned off without Windows Developer Mode).
  • On the head ecda938 itself: cargo test --workspace -- a_panic_is_in_the_log --test-threads=1 (debug), 1 passed, 0 failed (1 run).

Regression run

scripts/smoke.ps1, unchanged, 60 s on the same machine, 1 run each. The main block is aa9ab8a, the newest main built there; the head is based on 8e87fc7.

main:

xcl-smoke v1
commit: aa9ab8a3e7b738ec48899e37805f6a7d2d22da53
gpu: NVIDIA GeForce RTX 5070 Ti
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1599 (PresentX 1599)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16057 MB

PR:

xcl-smoke v1
commit: ecda9387592078f32ee5e5d02a917ee86d73d29f
gpu: NVIDIA GeForce RTX 5070 Ti
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17638 MB

Not tested

  • The whole suite on the head commit itself and on main 8e87fc7.
  • AMD and Intel GPUs.
  • A panic in a thread of the title's inside one of XCL's extern "system" functions: Rust runs the hook and then aborts the process, so the line should be the last one in the log. No run showed that case.
  • A real panic in a title run with this change: the watchdog's did not repeat here.

AI use

  • Claude Code (Claude Fable 5.2) found the panic in a run's stderr, wrote the change, the test and this text, and built and tested it on the Windows machine through a script.

Royalflamejlh and others added 2 commits November 24, 2026 17:00
A panic was printed to stderr only. One of XCL's own threads that
panics is gone for the rest of the run, and `xcl.log`, the file a
report carries, had no line of it: in a retail title's run under Wine
(RTX 4060 Ti) `xcl-sync-watchdog` panicked as it started (the race
xcl-dev#1926 fixes) and the log reads like any other stall.

The host installs a panic hook that writes the thread's name, the place
and the message as an ERROR line, then calls the hook that was there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@raylitebull

Copy link
Copy Markdown
Member

Code review on ecda938:

  • crates/xcl/src/log.rs::log_panics (invoked from crates/xcl/src/host.rs) cleanly preserves the previous panic hook via std::panic::take_hook(), writes thread panic details into xcl.log at Level::Error, and a_panic_is_in_the_log verifies off-thread panic logging end-to-end.
  • Diff audited and CI workflow approved (currently running).

Remaining before merge:

  1. Fix the failing PR description check.
  2. Confirm Build and test (Windows, no GPU) finishes green.
  3. Independent AMD + NVIDIA verification on ecda938.

@Royalflamejlh
Royalflamejlh marked this pull request as ready for review November 25, 2026 01:57
@JoaoPauluu

Copy link
Copy Markdown

A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with main (1367 here, 1357 and 1365 on the two main runs). No thread panicked in this run, so the new panic logging is not reached; this is a regression run only.

Tested

Regression run

main (first run):

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1357 (PresentX 1357)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: ecda9387592078f32ee5e5d02a917ee86d73d29f
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1367 (PresentX 1367)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The second main run: 1365 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head, a run with a panic, native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

@JJAutoCompare

Copy link
Copy Markdown

Empirical verification — PR #2005 (ecda9387592078f32ee5e5d02a917ee86d73d29f)

Tested clean detached PR head ecda9387592078f32ee5e5d02a917ee86d73d29f on STOR-WINLAB.

Environment

  • Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175, wave sizes 8–32, DoublePrecisionFloatShaderOps=0, d3d12SDKLayers.dll absent).
  • rustc 1.100.0 (0ef1bc386 2026-11-09) (CARGO_INCREMENTAL=0, debug info 0); DXC/DXIL 1.9.2609.5 on PATH.

Tested

  • cargo build --workspace and cargo test --workspace --no-run exited 0 outside the GPU lock.
  • cargo test -p xcl --lib log::tests::a_panic_is_in_the_log -- --exact --nocapture: 1 passed, 0 failed, 0 ignored, 0 skipped (966 filtered out; verified worker thread xcl-dies panic wrote thread name and message to temp log while preserving stderr output; also passed in full suite).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (under Invoke-ArcTest.ps1, exited 101): 965 passed, 26 failed, 45 ignored across 20 test targets, with 23 SKIPPED lines (excluded from coverage; 18 wave64, 3 refused wave32 f16 lowerings, 1 driver-cache disable 0x887A002D, 1 heap-window fallback).
    • Failures (26): 25 in xcl --lib GPU DXIL/recompiler tests (21 CreateComputePipelineState 0x80070057 + 4 shader result assertions) and 1 in e2e (test_title_runs_and_game_folder_is_untouched, RSSetDepthBiasX Split wave64: masks read only lane by lane stay in their half #94 blue vs green). All unrelated to the panic hook (no matched main baseline).

Not tested

  • Retail Xbox title runs, scripts/smoke.ps1 main-vs-PR run, XCL_SAMPLE_* (unset), D3D12 debug layer, and inducing an end-to-end panic inside a live xcl run host process.

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 against pr2005-suite.log and published this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants