pub trait BackendTrait: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn capabilities(&self) -> &BackendCapabilities;
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn compile_kernel<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn launch_kernel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kernel: &'life1 [u8],
grid: (u32, u32, u32),
block: (u32, u32, u32),
args: &'life2 [*const u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn allocate_memory(&self, size: usize) -> Result<*mut u8>;
fn free_memory(&self, ptr: *mut u8) -> Result<()>;
fn copy_memory(
&self,
dst: *mut u8,
src: *const u8,
size: usize,
kind: MemcpyKind,
) -> Result<()>;
fn synchronize(&self) -> Result<()>;
}
Expand description
Common interface for all backends
Required Methods§
Sourcefn capabilities(&self) -> &BackendCapabilities
fn capabilities(&self) -> &BackendCapabilities
Get backend capabilities
Sourcefn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the backend
Sourcefn compile_kernel<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compile_kernel<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Compile a kernel
Sourcefn launch_kernel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kernel: &'life1 [u8],
grid: (u32, u32, u32),
block: (u32, u32, u32),
args: &'life2 [*const u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn launch_kernel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kernel: &'life1 [u8],
grid: (u32, u32, u32),
block: (u32, u32, u32),
args: &'life2 [*const u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Launch a kernel
Sourcefn copy_memory(
&self,
dst: *mut u8,
src: *const u8,
size: usize,
kind: MemcpyKind,
) -> Result<()>
fn copy_memory( &self, dst: *mut u8, src: *const u8, size: usize, kind: MemcpyKind, ) -> Result<()>
Copy memory
Sourcefn synchronize(&self) -> Result<()>
fn synchronize(&self) -> Result<()>
Synchronize device