cudarc fork: PR #585 is alive and blocked on us — answer the maintainer's thread-safety question #260
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Correction (2026-08-15): the original version of this issue claimed
no upstream PR had ever been filed. That was wrong. I searched
coreylowman/cudarc, which has been renamed tochelsea0x3b/cudarc;gh pr listdoes not follow the rename redirect and returned[]. TheCargo.tomlcomment saying "pending upstream review" was accurate allalong. Everything below is the corrected picture.
The fork (verified 2026-08-15)
Pin:
grenade/cudarc @ 6904cf2e651a0384eac318f003ce6417f47f5d94,branched from v0.19.8. Three commits, all 2026-06-08, all in
src/nccl/safe.rs:d34b54aComm::abort,get_async_error, raw comm accessor2ece895Comm::dropwhen abort returns non-success6904cf2CommSend+Sync and abort exactly onceNeeded for #17 Stage 2 TP hang-recovery: aborting a wedged collective
and rebuilding the comm.
Upstream: chelsea0x3b/cudarc#585
Not ignored — actively reviewed, and the exchange has already improved
the patch:
ncclCommAbortfrees thecommunicator, so
abort()+Dropwould abort twice) and thatCommwas
!Send + !Syncso a cross-thread abort was unusable anyway. Fixedin
63327a2with anAtomicBoolswapped exactly once, makingabort()idempotent.cu_comm()naming consistency(done) and, more importantly, for sources on
ncclComm_tthreadsafety.
the accurate contract: a comm may be used from multiple threads only
one at a time, and safe abort requires the comm created nonblocking
with no thread inside an NCCL op when
ncclCommAbortis called.What is blocking it — an unanswered question, 4 days old
2026-08-11, chelsea0x3b:
The maintainer is pushing on the
unsafe impl Send + Sync for Comm, andthe question is a fair one. NCCL's own threadsafety page says primitives
are "generally not thread-safe, however … reentrant", and that operations
must not be issued to a single communicator in parallel from multiple
threads.
The distinction that needs making in the reply:
Send— moving aCommbetween threads, used by one at a time,is consistent with the quoted contract.
Syncis the contested half: it permits&Commsharedconcurrently, which is exactly what the abort use case wants (one
thread inside a collective, another calling abort). Justifying it
rests on the Fault Tolerance docs rather than the thread-safety page —
ncclCommAbortexists precisely to be called out-of-band — and on thenonblocking-comm requirement we already conceded on 2026-06-24.
Possible outcomes worth weighing before replying:
nonblocking + no-thread-inside-an-op contract, keeping Send+Sync.
Sendonly, and reach abort through a separately-heldraw
ncclComm_trather than a shared&Comm. Weaker claim, likelyeasier to land, and possibly sufficient for our device-worker design
where the comm already lives on one owning thread.
genuinely about what invariant the crate wants to promise.
Option 2 deserves a hard look: our TP layer already pins each comm to a
context-owning thread, so we may not need
Syncat all.Also true
Rebasing now is nearly free.
Cargo.tomlcomment is accurate and needs no correction.Sibling: #261 (candle fork — different story; that PR really has had zero
engagement).
return the cudarc fork upstream — 3 commits, 82 lines, and a PR that was never actually filedto cudarc fork: PR #585 is alive and blocked on us — answer the maintainer's thread-safety question