Repository navigation
fix: exit promptly on fatal GPU inference errors - #1685
NorthCedar wants to merge 6 commits into
Conversation
ReadyDog
left a comment
There was a problem hiding this comment.
Reviewed fatal exit ordering and reran all 52 targeted tests successfully. One remaining ordering gap is described inline; the existing tests do not cover failures from the RNG context itself.
— Codex review
|
Updated the fatal whitelist using installed MUSA 5.2.0 driver_types.h restart contracts and actual musaGetErrorString results, including AXI codes 796/797/798. Verified torch_musa 2.9.1.post1+musa5.2.0 native and generated CUDA-compatible prefixes; all 30 confirmed fatal codes now match both. Removed unverified XID category names. Added real-exit subprocess cases and negative tests for OOM, ECC 214, old XID names, near matches, embedded text and non-RuntimeError exceptions. All 57 targeted tests passed, plus Ruff lint/format, Python compilation and diff checks. No real hardware fault injection or watchdog was introduced. |
4b3fbfa to
7689bdc
Compare
Add per-rank CPU monitor processes, nested stage and request deadlines, and state-based health responses. Preserve fatal-device handling from PR ModelTC#1685 and leave idle keepalive out of scope. Validation: 15 watchdog tests, 22 inference-error tests, and 40 fatal-error regression tests passed. Ruff, Python compilation, and diff checks passed. No target GPU runtime deployment or hardware fault validation performed.
Fixes #1686 (fatal-error handling; the underlying GPU fault and supervisor restart/retry policy are separate).
Problem
Some CUDA/MUSA runtime errors leave the device context unusable and explicitly require terminating and relaunching the process. Treating these as ordinary request failures can reuse the failed context or block shutdown before a supervisor can recover the worker.
Checking only the outer inference worker is too late: runner exception branches may offload or fall back, profiler exits may synchronize or query device memory, and graph/stream/RNG contexts may run device cleanup while unwinding. An exception from a background copy or VAE thread may remain in a Future until another thread polls it. These paths can perform more device work before the original fatal error reaches the worker.
Change
Add a shared fatal-device-error classifier and termination helper in
lightx2v/utils/inference_errors.py:RuntimeError, including chained causes/contexts. OOM, generic ECC/unknown errors, broad NCCL wrappers, and near-matching text do not trigger termination unless an underlying exception matches.This applies to the touched inference/runner paths for both CUDA and MUSA. The message matching is deliberately conservative and text-based; an unrecognized error keeps its existing behavior. MUSA 5.2.0 runtime strings and explicit restart contracts were checked against the installed runtime/header, and torch_musa 2.9.1.post1+musa5.2.0 native and CUDA-compatible formatting was inspected: all 30 documented fatal MUSA codes match both prefixes, including AXI errors 796–798. OOM and ECC error 214 remain excluded.
A supervisor must restart the runtime after termination. No watchdog, inference timeout, or cancellation deadline is added. Calls that never raise remain outside this fix, and hardware faults may still require device/host recovery.
Testing
62 targeted CPU unittest tests passed, together with Ruff lint/format checks, Python compilation, and
git diff --check.A targeted integration overlaid only the shared helper and worker boundary on an existing four-rank MUSA runtime:
RuntimeError("MUSA error: device-side assert triggered")ValueErrorthrough the same request pathNo real GPU hardware fault was injected, and the complete upstream patch was not deployed in that integration. It does not validate upstream-specific runner paths or end-to-end Job Manager retries. The CPU tests validate control flow and process termination, not recovery from a physical device fault.