Skip to main content

TransferManager

Struct TransferManager 

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

Public entry point for layout and transfer management.

TransferManager combines layout registration/metadata management with transfer execution capabilities, providing a unified API for:

  • Registering local layouts and obtaining handles
  • Exporting/importing layout metadata for remote workers
  • Executing transfers between layouts using handles
  • Managing CUDA, NIXL, and other execution resources

Implementations§

Source§

impl TransferManager

Source

pub fn builder() -> TransferConfigBuilder

Create a new TransferManager builder.

The builder configures the worker ID, NIXL agent, CUDA device, and other execution parameters before creating the manager.

§Example
let manager = TransferManager::builder()
    .worker_id(0)  // NIXL agent name defaults to "worker-0"
    .nixl_backend("ucx")  // Optional: defaults to UCX from env
    .cuda_device_id(0)
    .build()?;

// Or with custom agent name:
let manager = TransferManager::builder()
    .worker_id(0)
    .nixl_agent_name("custom-agent")
    .build()?;
Source

pub fn register_layout(&self, layout: PhysicalLayout) -> Result<LayoutHandle>

Register a local physical layout and return a unique handle.

This registers the layout with the embedded memory manager, assigning it a unique handle that can be used for handle-based transfers.

§Arguments
  • layout - Physical layout to register
§Returns

Unique handle for the registered layout

§Errors

Returns an error if layout IDs are exhausted (u16::MAX reached)

Source

pub fn export_metadata(&self) -> Result<SerializedLayout>

Export layout metadata for transmission to remote workers.

This exports all registered local layouts along with NIXL metadata needed for remote memory registration.

§Returns

Packed metadata ready for transmission to remote workers

Source

pub fn import_metadata( &self, metadata: SerializedLayout, ) -> Result<Vec<LayoutHandle>>

Import remote layout metadata.

This loads NIXL metadata and reconstructs physical layouts from a remote worker’s exported metadata.

§Arguments
  • metadata - Packed metadata from remote worker
§Returns

Vector of handles for the imported remote layouts

§Errors

Returns an error if the remote worker was already loaded or if metadata loading/reconstruction fails

Source

pub fn build_logical_descriptor( &self, handle: LayoutHandle, logical_type: LogicalLayoutHandle, ) -> Result<LogicalLayoutDescriptor>

Build a logical layout descriptor for a specific handle.

This creates a descriptor that includes the logical layout type (G1, G2, G3, G4) for use in RDMA metadata exchange. The caller must provide the logical type mapping since only the caller (e.g., DirectWorker) knows which handle corresponds to which logical tier.

§Arguments
  • handle - Handle to the local layout
  • logical_type - The logical tier (G1, G2, G3, G4) this handle represents
§Returns

A LogicalLayoutDescriptor ready for serialization

§Errors

Returns an error if the handle is not found or serialization fails

Source

pub fn get_nixl_metadata(&self) -> Result<Vec<u8>>

Get the NIXL metadata for this worker.

Returns the raw NIXL metadata bytes needed for remote registration.

Source

pub fn worker_address(&self) -> WorkerAddress

Get the worker address for this manager.

Source

pub fn nixl_agent(&self) -> &NixlAgent

Get a reference to the NIXL agent.

This is useful for building layouts that need to register memory with the same agent that the TransferManager uses.

Source

pub fn get_layout_config(&self, handle: LayoutHandle) -> Result<LayoutConfig>

Get the layout configuration for a registered layout.

Returns a clone of the layout’s configuration, which includes dimensions like num_blocks, num_layers, page_size, etc.

§Arguments
  • handle - Handle to a registered layout (local or remote)
§Returns

A clone of the layout’s configuration

§Errors

Returns an error if the handle is not found

Source

pub fn execute_transfer( &self, src_handle: LayoutHandle, src_blocks: &[BlockId], dst_handle: LayoutHandle, dst_blocks: &[BlockId], options: TransferOptions, ) -> Result<TransferCompleteNotification>

Transfer complete blocks between layouts using handles.

This function copies entire blocks (all layers and outer dimensions) between the source and destination layouts identified by their handles. The transfer strategy (memcpy, CUDA, NIXL) is automatically selected based on storage locations.

The lock on the registry is held only briefly during layout lookup, then released before executing the actual transfer.

§Arguments
  • src_handle - Handle to source layout
  • src_blocks - Source block IDs to transfer
  • dst_handle - Handle to destination layout
  • dst_blocks - Destination block IDs to transfer
§Returns

A notification handle that can be awaited for transfer completion

§Errors

Returns an error if:

  • Either handle is invalid
  • Block IDs are out of bounds
  • Transfer execution fails
Source

pub fn execute_g4_offload( _src_handle: LayoutHandle, _src_blocks: &[BlockId], _dst_object: &[SequenceHash], _options: TransferOptions, ) -> Result<TransferCompleteNotification>

Execute a G4 offload.

Takes a LayoutHandle and a vector of block IDs for the source blocks and a list of SequenceHashes for the destination blocks.

use an extension on TransferOptions to pass in the “rank/part” of the the object in a multi-worker/multi-tp scenario.

Source

pub fn execute_g4_onboard()

Source

pub fn worker_id(&self) -> u64

Get the worker ID for this manager.

Source

pub fn get_local_handles(&self) -> Vec<LayoutHandle>

Get handles for all locally registered layouts.

Source

pub fn get_remote_handles(&self) -> Vec<LayoutHandle>

Get handles for all imported remote layouts.

Source

pub fn get_physical_layout( &self, handle: LayoutHandle, ) -> Option<PhysicalLayout>

Get a clone of the physical layout for a given handle.

§Arguments
  • handle - Handle to a registered layout (local or remote)
§Returns

A clone of the physical layout, or None if the handle is not found.

Trait Implementations§

Source§

impl Clone for TransferManager

Source§

fn clone(&self) -> TransferManager

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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