NcclBackend

Struct NcclBackend 

Source
pub struct NcclBackend { /* private fields */ }
Expand description

NCCL communication backend for multi-GPU / multi-node EP.

Implementations§

Source§

impl NcclBackend

Source

pub fn new( rank: usize, world_size: usize, master_addr: &str, master_port: u16, stream: u64, recv_capacity: usize, ) -> Result<Self>

Initialize NCCL with TCP bootstrap.

Rank 0 listens on master_addr:master_port, generates a unique ID, and sends it to all connecting ranks. All ranks then call ncclCommInitRank which internally synchronizes. recv_capacity is the largest all-reduce payload this backend will ever be asked to carry, in bytes — compute it with required_recv_bytes from the serve configuration. It is only consulted when world_size == 2 (the send/recv fast path); other world sizes reduce in-place via ncclAllReduce and allocate no receive buffer.

Trait Implementations§

Source§

impl CommBackend for NcclBackend

Source§

fn all_reduce(&self, ptr: u64, bytes: usize) -> Result<()>

All-reduce: sum across all ranks, result on all ranks.
Source§

fn all_reduce_async( &self, ptr: u64, bytes: usize, compute_stream: u64, ) -> Result<()>

Async all-reduce using GPU-side event synchronization. Read more
Source§

fn register_buffer(&self, ptr: u64, bytes: usize) -> Result<u64>

Pre-register a GPU buffer with the communication backend. Read more
Source§

fn deregister_buffer(&self, handle: u64) -> Result<()>

Deregister a previously registered buffer.
Source§

fn symmetric_alloc(&self, bytes: usize) -> Result<u64>

Allocate a GPU buffer in NCCL’s symmetric-memory window (NCCL ≥ 2.28 / ncclMemAlloc). Returns the device pointer as u64. Read more
Source§

fn symmetric_free(&self, ptr: u64) -> Result<()>

Free a buffer previously returned by symmetric_alloc.
Source§

fn set_add_kernel(&self, handle: u64)

Provide a kernel handle for the BF16 in-place addition kernel. Read more
Source§

fn all_gather(&self, send_ptr: u64, recv_ptr: u64, bytes: usize) -> Result<()>

All-gather: each rank contributes a chunk, all ranks get full buffer.
Source§

fn reduce_scatter( &self, send_ptr: u64, recv_ptr: u64, bytes: usize, ) -> Result<()>

Reduce-scatter: reduce + scatter (inverse of all-gather).
Source§

fn broadcast(&self, ptr: u64, bytes: usize, root: usize) -> Result<()>

Broadcast from root rank to all ranks.
Source§

fn barrier(&self) -> Result<()>

Barrier: block until all ranks reach this point.
Source§

fn send_to( &self, ptr: u64, bytes: usize, dest_rank: usize, stream: u64, ) -> Result<()>

Send tokens to a specific rank (for EP token dispatch). Read more
Source§

fn recv_from( &self, ptr: u64, bytes: usize, src_rank: usize, stream: u64, ) -> Result<()>

Receive tokens from a specific rank (for EP token combine). Read more
Source§

fn group_start(&self) -> Result<()>

Begin a group of point-to-point operations (send_to/recv_from). Read more
Source§

fn group_end(&self) -> Result<()>

End a group of point-to-point operations.
Source§

fn is_healthy(&self) -> bool

Check if the communicator is healthy (no async errors, no timeouts). Read more
Source§

fn attempt_reconnect(&self) -> Result<()>

Attempt to recover a degraded communicator. Read more
Source§

fn rank(&self) -> usize

This rank’s index (0-based).
Source§

fn world_size(&self) -> usize

Total number of ranks.
Source§

impl Drop for NcclBackend

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for NcclBackend

Source§

impl Sync for NcclBackend

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more