Skip to content

nvcc: server deterministically stops responding (deadlock/crash) while compiling ONNX Runtime's generated MoE GEMM launchers (Windows, CUDA 13.3, MSVC host) #2808

Closed

Description

@Kataglyphis

Building ONNX Runtime v1.28.0's CUDA provider on Windows with sccache as CMAKE_CUDA_COMPILER_LAUNCHER, the sccache server deterministically stops responding partway through the compile — every concurrent client then fails with:

sccache: error: failed to execute compile
sccache: caused by: error reading compile response from server
sccache: caused by: Failed to read response header
sccache: caused by: An existing connection was forcibly closed by the remote host. (os error 10054)

Two independent full builds died at 4909.2 s and 4911.5 s (±2 s!) on the same TU family: onnxruntime/contrib_ops/cuda/llm/moe_gemm/launchers/fused_moe_gemm_sm80_{f16,bf16}.generated.cu (cutlass-generated launchers in the onnxruntime_providers_cuda_llm OBJECT library). The determinism across runs rules out a random race trigger.

We also observed the same failure shape earlier in the build (different TU region, no determinism verified) as a pure hang: sccache server + 9 clients all at 0 % CPU, zero backend connections while the WebDAV endpoint answered HTTP 200 externally — a full-fleet flatline for 40+ minutes until the processes were killed manually. In the two deterministic cases above, a watchdog killed the server ~3 minutes after CPU flatlined, which is what surfaced the 10054s — so the underlying event may be a server-side deadlock in the nvcc decomposition under concurrency rather than a crash; we cannot distinguish from client-side evidence alone.

Environment

Component Version
sccache built from source at e9b15a35f7240a7edd1b9644583edb388c6cb5f9 (includes the #2722 CUDA 13.3 dryrun fix; no nvcc-relevant commits on main since)
Host compiler MSVC 14.51 (VS 18 BuildTools), nvcc -ccbin=cl.exe
CUDA 13.3.33
OS Windows Server Core ltsc2025 container (process isolation), Win 11 25H2 host
Backend WebDAV (dufs) with SCCACHE_MULTILEVEL_CHAIN=disk,webdav, SCCACHE_DIR=C:\sccache, SCCACHE_CACHE_SIZE=15G
Parallelism ninja -j9, ~1900 CUDA TUs total

Repro

Heavy, but deterministic: build onnxruntime v1.28.0 (--use_cuda, sm80+, USE_FLASH_ATTENTION=1) on Windows with CMAKE_CUDA_COMPILER_LAUNCHER=sccache from a current-main build. The failure lands when ninja reaches the onnxruntime_providers_cuda_llm target's fused_moe_gemm_*.generated.cu launchers (~80 min in at -j9 on a 9950X).

Workaround we ship: clear CUDA_COMPILER_LAUNCHER on that one target — everything else compiles fine through sccache:

set_property(TARGET onnxruntime_providers_cuda_llm PROPERTY CUDA_COMPILER_LAUNCHER "")

Second, more serious failure class: silent miscompilation of arch-guarded instantiations

After scoping the crashing target to bare nvcc (CMake CUDA_COMPILER_LAUNCHER "" on that one OBJECT library), two further full builds got past the crash point — and both failed the final DLL link identically with undefined template instantiations:

lld-link: error: undefined symbol: ... QkvToContext<__half, __nv_fp8_e4m3>(...)
lld-link: error: undefined symbol: ... QkvToContext<__nv_bfloat16, __nv_fp8_e4m3>(...)
lld-link: error: undefined symbol: ... BiasSoftmaxImpl<double>(...)

Controls run so far:

  • (a) a bare-nvcc build of the identical source tree (same patches, same flags, only CMAKE_CUDA_COMPILER_LAUNCHER removed) links green end-to-end — twice;
  • (b) the second wrapped build ran on a fresh local disk cache and failed byte-identically;
  • (c) cache poisoning is effectively excluded: our WebDAV L2 turned out to contain only 9 probe-written entries (the chain's write-through had silently never fed it), so the failing wrapped builds were performing REAL compilations through the decomposition, not consuming stale hits;
  • (d) minimal-repro attempts do NOT reproduce it: two tiny TUs with explicit instantiations guarded by a -D define and by __CUDA_ARCH__ >= 800 respectively, compiled wrapped-vs-bare on a fresh disk-only cache — plain short command line, ORT-ish command line (4× -gencode, -t2, --expt-relaxed-constexpr --extended-lambda, -Xcompiler host flags), and --options-file <rsp> — all emit identical symbol sets (llvm-nm diff clean).

So the loss needs something the real onnxruntime invocation has that our minimal shapes lack (candidates we haven't replayed yet: -MD -MT -MF dependency generation, -forward-unknown-to-host-compiler, quoted -D values inside the response file, high client concurrency against one server). Our next step is to replay the exact generated command line of one affected TU (bias_softmax_impl.cu) wrapped-vs-bare; we will attach that result. We report the correlation now because it is deterministic across two full builds and the consequence is silent wrong code — which is also why we disabled the CUDA launcher entirely rather than just scoping out the crashing TUs. Possibly related prior art: #2299 (host preprocessor invocations seeing injected -D__CUDA_ARCH__, reported by NVIDIA/cccl), #1098/#1186 (the 10054 crash family above).

Offer

The affected setup is available for instrumented runs: we can re-enable the launcher on that target with SCCACHE_LOG=debug / SCCACHE_ERROR_LOG persisted outside the container and attach the server-side log/panic from the deterministic failure point — tell us which traces help most (server log, --dist-status-style dumps, a nvcc --dryrun capture of the failing TU, etc.).

Activity

  1. Kataglyphis commented on Aug 14, 2026

    @Kataglyphis
    ContributorAuthor

    Update: the miscompilation did not reproduce on a fresh full build — plus two corrections to the report above

    We owe you an update before anyone spends time on this. Summary: the deadlock report stands, but the second half of the report (the silent miscompilation) did not reproduce today, and two statements in the original text need correcting.

    1. Correction: we did not disable the CUDA launcher entirely

    The report says "which is also why we disabled the CUDA launcher entirely rather than just scoping out the crashing TUs". That overstates what we ship. Our build only pins bare nvcc onto the onnxruntime_providers_cuda_llm target; CMAKE_CUDA_COMPILER_LAUNCHER stays active for every other CUDA target, so sccache still wraps the large majority of the ~1900 CUDA TUs. Apologies — that sentence described an intermediate state of our tree, not the shipped one.

    This matters because it means the two builds that produced the undefined-symbol failures ran in exactly the configuration we still ship today.

    2. The miscompilation did not reproduce

    A full clean chain built today in that same configuration (launcher on everywhere except onnxruntime_providers_cuda_llm) linked green:

    • ONNX Runtime v1.28.0 CUDA provider compiled and linked with no lld-link: error: undefined symbol
    • no QkvToContext<...> / BiasSoftmaxImpl<double> losses
    • sccache stats for that stage: Cache hits 10 / Cache misses 1488 / Cache write errors 0

    So the ~1488 TUs were real compilations through the decomposition, and the symbol set came out complete. We cannot currently reproduce the failure we reported.

    Two things changed on our side since those runs, either of which may be relevant:

    • Our WebDAV L2 backend was silently rejecting every write. At the time of the report the cache was effectively write-only-in-name: our own measurement across 49 builds shows Cache misses == Cache write errors for every single stat block (189,861 of each, 0 hits, ever). The cause was on our end — the dufs server was tied to a user session and died mid-build. It now writes correctly (the write errors 0 above). We flag this because the original report's control (c) leaned on "our L2 only ever had 9 probe entries" to exclude cache poisoning; that observation was correct for those runs, but the setup that produced it no longer exists, so a reproduction attempt on our side is no longer environmentally identical.
    • Build parallelism went from ninja -j9 to -j19 (unrelated memory-budget fix on our side). If the loss were concurrency-sensitive, this changes the exposure — though in the direction of more concurrency, not less.

    3. Status of the deadlock (the actual subject of this issue)

    Unchanged and still worked around: we continue to pin bare nvcc on onnxruntime_providers_cuda_llm, so today's build never reached the failure point. We have therefore not re-tested the ~4909 s deadlock, and we are not claiming it is gone. The determinism we reported (two runs, 4909.2 s and 4911.5 s, same TU family) stands as evidence.

    4. The promised replay

    We said we would replay the exact generated command line of bias_softmax_impl.cu wrapped-vs-bare and attach the result. That is still outstanding. Given the non-reproduction above we would rather not send you a replay of a symptom we can no longer trigger — if it would still be useful, say so and we will run it; otherwise we will re-enable the launcher on the cuda_llm target under SCCACHE_LOG=debug to try to capture the deadlock server-side, which is the finding we still consider solid.

    Happy to be told this should be split into two issues, or that the miscompilation half should simply be struck.

  2. AJIOB commented on Aug 17, 2026

    @AJIOB
    Contributor

    Hi @Kataglyphis ,

    Try to set SCCACHE_IDLE_TIMEOUT=0 env variable before sccache server startup. The server is started automatically with first compiler call or via sccache --start-server command.

    This one helps me with the strange disconnections from sccache server.

  3. Kataglyphis commented on Aug 17, 2026

    @Kataglyphis
    ContributorAuthor

    Hi @AJIOB ,

    thanks for the quick answer!
    I will try this one and come back after including this solution to my setup :)

  4. Kataglyphis commented on Aug 18, 2026

    @Kataglyphis
    ContributorAuthor

    Hi @AJIOB ,
    I
    Buildkits cache is currently buggy when using disk cache. This also explains the deadlock for webdav only resolves the issue.
    Both documented deadlocks (4909.2 s / 4911.5 s, os error 10054 on every client) occurred while sccache's local disk tier sat on a defective BuildKit WCOW cache mount that rejected 100% of writes with os error 3 — so the server was operating under a sustained error-handling storm, not on its regular compile path. After removing that tier from the write path (WebDAV-only), the same build — same sccache revision, same TU family, same host — compiled all 1,891 CUDA objects, including every fused_moe launcher the original wedges died on, without a stall. Under a healthy storage configuration the deadlock is therefore no longer reproducible; the evidence points to it having been a downstream casualty of the mount defect. The formal counter-proof (re-testing against a deliberately broken L0 tier) has not been run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions