Skip to main content

DeviceMemoryManager

Trait DeviceMemoryManager 

Source
pub trait DeviceMemoryManager: Send + Sync {
    // Required methods
    fn allocate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        size: usize,
        device: &'life1 Device,
    ) -> Pin<Box<dyn Future<Output = Result<MemoryHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn allocate_aligned<'life0, 'life1, 'async_trait>(
        &'life0 self,
        size: usize,
        alignment: usize,
        device: &'life1 Device,
    ) -> Pin<Box<dyn Future<Output = Result<MemoryHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn deallocate<'life0, 'async_trait>(
        &'life0 self,
        handle: MemoryHandle,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn copy<'life0, 'async_trait>(
        &'life0 self,
        src: MemoryHandle,
        dst: MemoryHandle,
        size: usize,
        src_offset: usize,
        dst_offset: usize,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn copy_async<'life0, 'async_trait>(
        &'life0 self,
        transfer: MemoryTransfer,
        stream: Option<StreamHandle>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn memory_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device: &'life1 Device,
    ) -> Pin<Box<dyn Future<Output = Result<MemoryInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn handle_info(&self, handle: MemoryHandle) -> Option<MemoryHandleInfo>;
    fn configure_pool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device: &'life1 Device,
        config: MemoryPoolConfig,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn defragment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        device: &'life1 Device,
    ) -> Pin<Box<dyn Future<Output = Result<DefragmentationStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_pressure_callback(
        &self,
        callback: Box<dyn Fn(MemoryPressure) + Send + Sync>,
    );
}
Expand description

Device memory manager for raw memory operations

Required Methods§

Source

fn allocate<'life0, 'life1, 'async_trait>( &'life0 self, size: usize, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<MemoryHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Allocate memory on device

Source

fn allocate_aligned<'life0, 'life1, 'async_trait>( &'life0 self, size: usize, alignment: usize, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<MemoryHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Allocate aligned memory

Source

fn deallocate<'life0, 'async_trait>( &'life0 self, handle: MemoryHandle, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deallocate memory

Source

fn copy<'life0, 'async_trait>( &'life0 self, src: MemoryHandle, dst: MemoryHandle, size: usize, src_offset: usize, dst_offset: usize, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Copy memory between handles

Source

fn copy_async<'life0, 'async_trait>( &'life0 self, transfer: MemoryTransfer, stream: Option<StreamHandle>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Copy memory between devices asynchronously

Source

fn memory_info<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<MemoryInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get memory information for device

Source

fn handle_info(&self, handle: MemoryHandle) -> Option<MemoryHandleInfo>

Get handle information

Source

fn configure_pool<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 Device, config: MemoryPoolConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set memory pool configuration

Source

fn defragment<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<DefragmentationStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Defragment memory (if supported)

Source

fn set_pressure_callback( &self, callback: Box<dyn Fn(MemoryPressure) + Send + Sync>, )

Set memory pressure callback

Implementors§