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§
Sourcefn 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<'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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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<'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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn handle_info(&self, handle: MemoryHandle) -> Option<MemoryHandleInfo>
fn handle_info(&self, handle: MemoryHandle) -> Option<MemoryHandleInfo>
Get handle information
Sourcefn 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 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
Sourcefn 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 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)
Sourcefn set_pressure_callback(
&self,
callback: Box<dyn Fn(MemoryPressure) + Send + Sync>,
)
fn set_pressure_callback( &self, callback: Box<dyn Fn(MemoryPressure) + Send + Sync>, )
Set memory pressure callback