SingleGpuBackend

Struct SingleGpuBackend 

Source
pub struct SingleGpuBackend;
Expand description

2026-09-26: One rank: every collective and point-to-point operation returns Ok without doing anything, rank is 0 and world_size is 1.

Trait Implementations§

Source§

impl CommBackend for SingleGpuBackend

Source§

fn all_reduce(&self, _ptr: u64, _bytes: usize) -> Result<()>

2026-09-26: Sum bytes at ptr across all ranks, in place; every rank gets the result. NcclBackend reduces BF16 elements.
Source§

fn all_gather( &self, _send_ptr: u64, _recv_ptr: u64, _bytes: usize, ) -> Result<()>

2026-09-26: Each rank contributes bytes from send_ptr; every rank receives all contributions, in rank order, at recv_ptr.
Source§

fn reduce_scatter( &self, _send_ptr: u64, _recv_ptr: u64, _bytes: usize, ) -> Result<()>

2026-09-26: Sum across ranks and give each rank its bytes-sized share at recv_ptr. NcclBackend sums u8 elements.
Source§

fn broadcast(&self, _ptr: u64, _bytes: usize, _root: usize) -> Result<()>

2026-09-26: Copy bytes at ptr from rank root to every rank, in place.
Source§

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

2026-09-26: A barrier across ranks. NcclBackend enqueues a zero-count all-reduce on its stream and returns without waiting for it.
Source§

fn send_to( &self, _ptr: u64, _bytes: usize, _dest_rank: usize, _stream: u64, ) -> Result<()>

2026-09-26: Send bytes at ptr to dest_rank, enqueued on stream. Pairs with a recv_from of the same size on dest_rank.
Source§

fn recv_from( &self, _ptr: u64, _bytes: usize, _src_rank: usize, _stream: u64, ) -> Result<()>

2026-09-26: Receive bytes into ptr from src_rank, enqueued on stream. Pairs with a send_to of the same size on src_rank.
Source§

fn rank(&self) -> usize

2026-09-26: This rank’s index, from 0.
Source§

fn world_size(&self) -> usize

2026-09-26: Number of ranks.
Source§

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

2026-09-26: On a non-root rank, receive the first u32 of the next worker command from root, the receive side of a 4-byte broadcast. Unlike broadcast, it may wait without a deadline, so an implementation must keep checking for transport errors while it waits. The command’s later words use broadcast. The default refuses root and otherwise calls broadcast(ptr, 4, root).
Source§

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

2026-09-26: All-reduce ordered against compute_stream on the device: the reduce starts after the work already queued there and later work there waits for it. The host does not wait. The default ignores compute_stream and calls all_reduce.
Source§

fn register_buffer(&self, _ptr: u64, _bytes: usize) -> Result<u64>

2026-09-26: Register a device buffer with the backend and return an opaque handle (ncclCommRegister in NcclBackend). The default registers nothing and returns 0.
Source§

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

2026-09-26: Deregister a handle from register_buffer.
Source§

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

2026-09-26: Allocate bytes of device memory from the backend’s allocator (ncclMemAlloc in NcclBackend) and return the pointer. The default returns Err.
Source§

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

2026-09-26: Free a pointer from symmetric_alloc. The default returns Err.
Source§

fn set_add_kernel(&self, _handle: u64)

2026-09-26: Hand the backend the bf16_add_inplace kernel handle. The model engine looks it up and passes it after registering its buffers. NcclBackend takes its 2-rank send/recv all-reduce path only once it is set.
Source§

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

2026-09-26: Open a group: NcclBackend calls ncclGroupStart, so the operations up to group_end are submitted together. The default does nothing.
Source§

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

2026-09-26: Close the group opened by group_start.
Source§

fn is_healthy(&self) -> bool

2026-09-26: false after the backend has seen a transport error or a completion timeout, until a successful attempt_reconnect. NcclBackend also queries ncclCommGetAsyncError. The default returns true.
Source§

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

2026-09-26: Replace a failed communicator. NcclBackend aborts it and repeats the TCP bootstrap, so every rank must call this at the same time. The default does nothing.

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