Trait DeviceMemory
pub trait DeviceMemory: Send + Sync {
// Required methods
fn allocate(
&self,
size: usize,
) -> Result<Box<dyn GpuBuffer>, RingKernelError>;
fn allocate_aligned(
&self,
size: usize,
alignment: usize,
) -> Result<Box<dyn GpuBuffer>, RingKernelError>;
fn total_memory(&self) -> usize;
fn free_memory(&self) -> usize;
}Expand description
Trait for device memory allocation.
Required Methods§
fn allocate(&self, size: usize) -> Result<Box<dyn GpuBuffer>, RingKernelError>
fn allocate(&self, size: usize) -> Result<Box<dyn GpuBuffer>, RingKernelError>
Allocate device memory.
fn allocate_aligned(
&self,
size: usize,
alignment: usize,
) -> Result<Box<dyn GpuBuffer>, RingKernelError>
fn allocate_aligned( &self, size: usize, alignment: usize, ) -> Result<Box<dyn GpuBuffer>, RingKernelError>
Allocate device memory with alignment.
fn total_memory(&self) -> usize
fn total_memory(&self) -> usize
Get total device memory.
fn free_memory(&self) -> usize
fn free_memory(&self) -> usize
Get free device memory.