Expand description
Raw NCCL FFI bindings (minimal surface for EP all-reduce + broadcast).
Only the functions Atlas actually calls are bound here — no attempt
at complete coverage. Type sizes match NCCL 2.28+ on aarch64
(symmetric memory ncclMemAlloc/ncclMemFree require NCCL ≥ 2.28).
§Safety
Every unsafe block wraps a single NCCL FFI call. Invariants:
- The
NcclComm/NcclUniqueIdarguments come from priorSelfconstructors that called the matching NCCL init function. - GPU buffers are valid
DevicePtrs alive on the device that owns the comm. - Counts × dtype-size match the buffer byte count.
- The
extern "C"declarations match the NCCL header ABI for the linked library version.
Structs§
- Nccl
Config - NCCL config for ncclCommInitRankConfig. Set blocking=0 for non-blocking mode (ncclGroupEnd returns immediately).
- Nccl
Unique Id - NCCL unique ID for bootstrapping (128 bytes, passed by value in C ABI).
Enums§
- Nccl
Data Type - NCCL data types (matches nccl.h enum values).
- Nccl
RedOp - NCCL reduction operations.
- Nccl
Result - NCCL result code.
Functions§
- check_
nccl - Convert NCCL result to anyhow::Result.
- create_
event - create_
stream - destroy_
event - destroy_
stream - nccl
AllGather ⚠ - nccl
AllReduce ⚠ - nccl
Broadcast ⚠ - nccl
Comm ⚠Abort - nccl
Comm ⚠Deregister - nccl
Comm ⚠Destroy - nccl
Comm ⚠GetAsync Error - nccl
Comm ⚠Init Rank - nccl
Comm ⚠Init Rank Config - Non-blocking variant: set config.blocking=0 so ncclGroupEnd returns immediately. Poll ncclCommGetAsyncError to check completion and detect hangs with timeout.
- nccl
Comm ⚠Register - nccl
GetError ⚠String - nccl
GetUnique ⚠Id - nccl
Group ⚠End - nccl
Group ⚠Start - nccl
MemAlloc ⚠ - nccl
MemFree ⚠ - nccl
Recv ⚠ - nccl
Reduce ⚠Scatter - nccl
Send ⚠ - nccl_
mem_ ⚠alloc - Allocate GPU memory backed by a symmetric memory window across the
communicator. NCCL 2.28+ only — older NCCL returns
InvalidArgument. - nccl_
mem_ ⚠free - Free a buffer previously returned by
nccl_mem_alloc. - record_
event - stream_
wait_ event - sync_
stream
Type Aliases§
- Nccl
Comm - Opaque NCCL communicator handle.