Skip to main content

DeviceMsg

Enum DeviceMsg 

Source
pub enum DeviceMsg {
Show 30 variants Alloc(Box<dyn AllocDispatch>), CopyToHost(Box<dyn CopyToHostDispatch>), CopyFromHost(Box<dyn CopyFromHostDispatch>), Allocate { len: usize, reply: Sender<Result<GpuRef<f32>, GpuError>>, }, AllocateF32 { len: usize, reply: Sender<Result<GpuRef<f32>, GpuError>>, }, AllocateF64 { len: usize, reply: Sender<Result<GpuRef<f64>, GpuError>>, }, AllocateI8 { len: usize, reply: Sender<Result<GpuRef<i8>, GpuError>>, }, AllocateI32 { len: usize, reply: Sender<Result<GpuRef<i32>, GpuError>>, }, AllocateI64 { len: usize, reply: Sender<Result<GpuRef<i64>, GpuError>>, }, AllocateU8 { len: usize, reply: Sender<Result<GpuRef<u8>, GpuError>>, }, AllocateU32 { len: usize, reply: Sender<Result<GpuRef<u32>, GpuError>>, }, AllocateU64 { len: usize, reply: Sender<Result<GpuRef<u64>, GpuError>>, }, CopyToHostF32 { src: GpuRef<f32>, dst: HostBuf<f32>, reply: Sender<Result<HostBuf<f32>, GpuError>>, }, CopyFromHostF32 { src: HostBuf<f32>, dst: GpuRef<f32>, reply: Sender<Result<HostBuf<f32>, GpuError>>, }, CopyToHostF64 { src: GpuRef<f64>, dst: HostBuf<f64>, reply: Sender<Result<HostBuf<f64>, GpuError>>, }, CopyFromHostF64 { src: HostBuf<f64>, dst: GpuRef<f64>, reply: Sender<Result<HostBuf<f64>, GpuError>>, }, CopyToHostI32 { src: GpuRef<i32>, dst: HostBuf<i32>, reply: Sender<Result<HostBuf<i32>, GpuError>>, }, CopyFromHostI32 { src: HostBuf<i32>, dst: GpuRef<i32>, reply: Sender<Result<HostBuf<i32>, GpuError>>, }, CopyToHostU32 { src: GpuRef<u32>, dst: HostBuf<u32>, reply: Sender<Result<HostBuf<u32>, GpuError>>, }, CopyFromHostU32 { src: HostBuf<u32>, dst: GpuRef<u32>, reply: Sender<Result<HostBuf<u32>, GpuError>>, }, CopyToHostU8 { src: GpuRef<u8>, dst: HostBuf<u8>, reply: Sender<Result<HostBuf<u8>, GpuError>>, }, CopyFromHostU8 { src: HostBuf<u8>, dst: GpuRef<u8>, reply: Sender<Result<HostBuf<u8>, GpuError>>, }, Sgemm(Box<SgemmRequest>), SnapshotContext { reply: Sender<Option<Arc<CudaContext>>>, }, SnapshotStream { reply: Sender<Option<Arc<CudaStream>>>, }, SnapshotChildren { reply: Sender<Option<KernelChildren>>, }, WatchGeneration { reply: Sender<Receiver<u64>>, }, Stats { reply: Sender<DeviceLoad>, }, ContextReady { children: KernelChildren, }, ContextLost,
}
Expand description

Public messages sent to a DeviceActor.

Phase 0.4 — the formerly-21 dtype-enumerated Allocate* / CopyToHost* / CopyFromHost* variants collapse into 3 boxed dispatchers:

Each carries a Box<dyn …Dispatch> whose concrete payload is an AllocReq<T> / CopyToHostReq<T> / CopyFromHostReq<T> for some T: CudaDtype. GpuRef<T> keeps its static dtype on both ends — the box is purely a uniform mailbox surface.

The legacy Allocate* / CopyToHost* / CopyFromHost* variants remain as #[deprecated] aliases. Existing call sites compile and run unchanged; the handler arm constructs the equivalent Box<dyn …Dispatch> and forwards through the new path.

Variants§

§

Alloc(Box<dyn AllocDispatch>)

Phase 0.4 generic alloc. Construct via DeviceMsg::alloc::<T> or Box::new(AllocReq::<T> { … }) directly.

§

CopyToHost(Box<dyn CopyToHostDispatch>)

Phase 0.4 generic D2H copy.

§

CopyFromHost(Box<dyn CopyFromHostDispatch>)

Phase 0.4 generic H2D copy.

§

Allocate

👎Deprecated: use DeviceMsg::alloc::<f32>(len, reply)

Deprecated alias for DeviceMsg::AllocateF32. F1 callers wrote Allocate { len, reply } — kept for back-compat.

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<f32>(len, reply)
§reply: Sender<Result<GpuRef<f32>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<f32>(len, reply)
§

AllocateF32

👎Deprecated: use DeviceMsg::alloc::<f32>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<f32>(len, reply)
§reply: Sender<Result<GpuRef<f32>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<f32>(len, reply)
§

AllocateF64

👎Deprecated: use DeviceMsg::alloc::<f64>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<f64>(len, reply)
§reply: Sender<Result<GpuRef<f64>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<f64>(len, reply)
§

AllocateI8

👎Deprecated: use DeviceMsg::alloc::<i8>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<i8>(len, reply)
§reply: Sender<Result<GpuRef<i8>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<i8>(len, reply)
§

AllocateI32

👎Deprecated: use DeviceMsg::alloc::<i32>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<i32>(len, reply)
§reply: Sender<Result<GpuRef<i32>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<i32>(len, reply)
§

AllocateI64

👎Deprecated: use DeviceMsg::alloc::<i64>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<i64>(len, reply)
§reply: Sender<Result<GpuRef<i64>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<i64>(len, reply)
§

AllocateU8

👎Deprecated: use DeviceMsg::alloc::<u8>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<u8>(len, reply)
§reply: Sender<Result<GpuRef<u8>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<u8>(len, reply)
§

AllocateU32

👎Deprecated: use DeviceMsg::alloc::<u32>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<u32>(len, reply)
§reply: Sender<Result<GpuRef<u32>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<u32>(len, reply)
§

AllocateU64

👎Deprecated: use DeviceMsg::alloc::<u64>(len, reply)

Fields

§len: usize
👎Deprecated: use DeviceMsg::alloc::<u64>(len, reply)
§reply: Sender<Result<GpuRef<u64>, GpuError>>
👎Deprecated: use DeviceMsg::alloc::<u64>(len, reply)
§

CopyToHostF32

👎Deprecated: use DeviceMsg::copy_to_host::<f32>(src, dst, reply)

D2H async copy — buffer round-trips back via the reply so a pinned buffer can return to its pool.

Fields

§src: GpuRef<f32>
👎Deprecated: use DeviceMsg::copy_to_host::<f32>(src, dst, reply)
§dst: HostBuf<f32>
👎Deprecated: use DeviceMsg::copy_to_host::<f32>(src, dst, reply)
§reply: Sender<Result<HostBuf<f32>, GpuError>>
👎Deprecated: use DeviceMsg::copy_to_host::<f32>(src, dst, reply)
§

CopyFromHostF32

👎Deprecated: use DeviceMsg::copy_from_host::<f32>(src, dst, reply)

Fields

§src: HostBuf<f32>
👎Deprecated: use DeviceMsg::copy_from_host::<f32>(src, dst, reply)
§dst: GpuRef<f32>
👎Deprecated: use DeviceMsg::copy_from_host::<f32>(src, dst, reply)
§reply: Sender<Result<HostBuf<f32>, GpuError>>
👎Deprecated: use DeviceMsg::copy_from_host::<f32>(src, dst, reply)
§

CopyToHostF64

👎Deprecated: use DeviceMsg::copy_to_host::<f64>(src, dst, reply)

Fields

§src: GpuRef<f64>
👎Deprecated: use DeviceMsg::copy_to_host::<f64>(src, dst, reply)
§dst: HostBuf<f64>
👎Deprecated: use DeviceMsg::copy_to_host::<f64>(src, dst, reply)
§reply: Sender<Result<HostBuf<f64>, GpuError>>
👎Deprecated: use DeviceMsg::copy_to_host::<f64>(src, dst, reply)
§

CopyFromHostF64

👎Deprecated: use DeviceMsg::copy_from_host::<f64>(src, dst, reply)

Fields

§src: HostBuf<f64>
👎Deprecated: use DeviceMsg::copy_from_host::<f64>(src, dst, reply)
§dst: GpuRef<f64>
👎Deprecated: use DeviceMsg::copy_from_host::<f64>(src, dst, reply)
§reply: Sender<Result<HostBuf<f64>, GpuError>>
👎Deprecated: use DeviceMsg::copy_from_host::<f64>(src, dst, reply)
§

CopyToHostI32

👎Deprecated: use DeviceMsg::copy_to_host::<i32>(src, dst, reply)

Fields

§src: GpuRef<i32>
👎Deprecated: use DeviceMsg::copy_to_host::<i32>(src, dst, reply)
§dst: HostBuf<i32>
👎Deprecated: use DeviceMsg::copy_to_host::<i32>(src, dst, reply)
§reply: Sender<Result<HostBuf<i32>, GpuError>>
👎Deprecated: use DeviceMsg::copy_to_host::<i32>(src, dst, reply)
§

CopyFromHostI32

👎Deprecated: use DeviceMsg::copy_from_host::<i32>(src, dst, reply)

Fields

§src: HostBuf<i32>
👎Deprecated: use DeviceMsg::copy_from_host::<i32>(src, dst, reply)
§dst: GpuRef<i32>
👎Deprecated: use DeviceMsg::copy_from_host::<i32>(src, dst, reply)
§reply: Sender<Result<HostBuf<i32>, GpuError>>
👎Deprecated: use DeviceMsg::copy_from_host::<i32>(src, dst, reply)
§

CopyToHostU32

👎Deprecated: use DeviceMsg::copy_to_host::<u32>(src, dst, reply)

Fields

§src: GpuRef<u32>
👎Deprecated: use DeviceMsg::copy_to_host::<u32>(src, dst, reply)
§dst: HostBuf<u32>
👎Deprecated: use DeviceMsg::copy_to_host::<u32>(src, dst, reply)
§reply: Sender<Result<HostBuf<u32>, GpuError>>
👎Deprecated: use DeviceMsg::copy_to_host::<u32>(src, dst, reply)
§

CopyFromHostU32

👎Deprecated: use DeviceMsg::copy_from_host::<u32>(src, dst, reply)

Fields

§src: HostBuf<u32>
👎Deprecated: use DeviceMsg::copy_from_host::<u32>(src, dst, reply)
§dst: GpuRef<u32>
👎Deprecated: use DeviceMsg::copy_from_host::<u32>(src, dst, reply)
§reply: Sender<Result<HostBuf<u32>, GpuError>>
👎Deprecated: use DeviceMsg::copy_from_host::<u32>(src, dst, reply)
§

CopyToHostU8

👎Deprecated: use DeviceMsg::copy_to_host::<u8>(src, dst, reply)

Fields

§src: GpuRef<u8>
👎Deprecated: use DeviceMsg::copy_to_host::<u8>(src, dst, reply)
§dst: HostBuf<u8>
👎Deprecated: use DeviceMsg::copy_to_host::<u8>(src, dst, reply)
§reply: Sender<Result<HostBuf<u8>, GpuError>>
👎Deprecated: use DeviceMsg::copy_to_host::<u8>(src, dst, reply)
§

CopyFromHostU8

👎Deprecated: use DeviceMsg::copy_from_host::<u8>(src, dst, reply)

Fields

§src: HostBuf<u8>
👎Deprecated: use DeviceMsg::copy_from_host::<u8>(src, dst, reply)
§dst: GpuRef<u8>
👎Deprecated: use DeviceMsg::copy_from_host::<u8>(src, dst, reply)
§reply: Sender<Result<HostBuf<u8>, GpuError>>
👎Deprecated: use DeviceMsg::copy_from_host::<u8>(src, dst, reply)
§

Sgemm(Box<SgemmRequest>)

Fire an SGEMM through the context’s BlasActor.

§

SnapshotContext

F4: Snapshot the underlying Arc<CudaContext> so a top-level observer (P2pTopology, NcclWorldActor) can build cross-device machinery. Replies None if the context isn’t ready.

Fields

§reply: Sender<Option<Arc<CudaContext>>>
§

SnapshotStream

Phase 4.5++ — Snapshot the device’s primary Arc<CudaStream> (the stream owned by ContextActor). Returned to downstream raw-pointer FFI users (TensorRT enqueueV3, custom kernel launchers) that need to share a single CUDA execution timeline with the rest of the device’s library actors.

Replies None if the context isn’t ready (e.g. mock mode, or before ContextReady). On real hardware the returned stream is the same one that BLAS / cuDNN / cuFFT child actors were minted off.

Fields

§reply: Sender<Option<Arc<CudaStream>>>
§

SnapshotChildren

F7: Snapshot the current KernelChildren so application code can talk to library actors directly (e.g. RngActor, CudnnActor). Replies None until ContextActor::Init completes.

Fields

§reply: Sender<Option<KernelChildren>>
§

WatchGeneration

F9: Subscribe to the device’s DeviceState::generation_watch. The receiver fires every time the underlying CudaContext rebuilds. Used by NcclWorldActor and P2pTopology to react to context loss.

Fields

§reply: Sender<Receiver<u64>>
§

Stats

F5: Per-device load snapshot for placement scheduling.

Fields

§reply: Sender<DeviceLoad>
§

ContextReady

Internal: ContextActor has finished initialising and the kernel actors are live.

Fields

§

ContextLost

Internal: ContextActor notifies that the context was torn down (e.g. on poisoning); pending work should be re-stashed until a new ContextReady arrives.

Implementations§

Source§

impl DeviceMsg

Source

pub fn alloc<T: CudaDtype>( len: usize, reply: Sender<Result<GpuRef<T>, GpuError>>, ) -> Self

Phase 0.4: typed-allocation constructor. Boxes an AllocReq<T> into the generic DeviceMsg::Alloc variant.

Source

pub fn copy_to_host<T: CudaDtype>( src: GpuRef<T>, dst: HostBuf<T>, reply: Sender<Result<HostBuf<T>, GpuError>>, ) -> Self

Phase 0.4: typed D2H copy constructor.

Source

pub fn copy_from_host<T: CudaDtype>( src: HostBuf<T>, dst: GpuRef<T>, reply: Sender<Result<HostBuf<T>, GpuError>>, ) -> Self

Phase 0.4: typed H2D copy constructor.

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