Trait cubecl_runtime::storage::ComputeStorage

source ·
pub trait ComputeStorage: Send {
    type Resource: Send;

    // Required methods
    fn get(&mut self, handle: &StorageHandle) -> Self::Resource;
    fn alloc(&mut self, size: usize) -> StorageHandle;
    fn dealloc(&mut self, id: StorageId);
    fn copy(&mut self, from: &StorageHandle, to: &StorageHandle);
}
Expand description

Storage types are responsible for allocating and deallocating memory.

Required Associated Types§

source

type Resource: Send

The resource associated type determines the way data is implemented and how it can be accessed by kernels.

Required Methods§

source

fn get(&mut self, handle: &StorageHandle) -> Self::Resource

Returns the underlying resource for a specified storage handle

source

fn alloc(&mut self, size: usize) -> StorageHandle

Allocates size units of memory and returns a handle to it

source

fn dealloc(&mut self, id: StorageId)

Deallocates the memory pointed by the given storage id.

source

fn copy(&mut self, from: &StorageHandle, to: &StorageHandle)

Copy

Implementors§