pub enum TensorMemory {
Dma,
Shm,
Mem,
Pbo,
}Variants§
Dma
Platform-native zero-copy GPU buffer.
On Linux this is a DMA-BUF (DmaTensor in crates/tensor/src/dma.rs)
allocated via the DRM/dma-heap subsystem. On macOS this is an
IOSurface (IoSurfaceTensor in crates/tensor/src/iosurface.rs).
Both fit into the same TensorStorage::Dma slot at the trait
level — the public C API discriminant (HalTensorMemory::Dma=1)
works on both platforms with no ABI break.
Allows hardware-accelerated paths (OpenGL backend on Linux via
EGL_EXT_image_dma_buf_import; macOS via
EGL_ANGLE_iosurface_client_buffer). CPU access via map()
incurs cache-coherency overhead on Linux DMA-BUF and is similar
in cost on IOSurface; SHM/Mem are cheaper for CPU-only workloads.
Shm
POSIX Shared Memory allocation. Suitable for inter-process communication, but not suitable for hardware acceleration.
Mem
Regular system memory allocation
Pbo
OpenGL Pixel Buffer Object memory. Created by ImageProcessor when DMA-buf is unavailable but OpenGL is present.
Trait Implementations§
Source§impl Clone for TensorMemory
impl Clone for TensorMemory
Source§fn clone(&self) -> TensorMemory
fn clone(&self) -> TensorMemory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TensorMemory
impl Debug for TensorMemory
Source§impl From<TensorMemory> for String
impl From<TensorMemory> for String
Source§fn from(memory: TensorMemory) -> Self
fn from(memory: TensorMemory) -> Self
Source§impl PartialEq for TensorMemory
impl PartialEq for TensorMemory
Source§fn eq(&self, other: &TensorMemory) -> bool
fn eq(&self, other: &TensorMemory) -> bool
self and other values to be equal, and is used by ==.Source§impl TryFrom<&str> for TensorMemory
impl TryFrom<&str> for TensorMemory
impl Copy for TensorMemory
impl Eq for TensorMemory
impl StructuralPartialEq for TensorMemory
Auto Trait Implementations§
impl Freeze for TensorMemory
impl RefUnwindSafe for TensorMemory
impl Send for TensorMemory
impl Sync for TensorMemory
impl Unpin for TensorMemory
impl UnsafeUnpin for TensorMemory
impl UnwindSafe for TensorMemory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more