pub trait Device: Clone + Debug {
type Slice: Slice<Device = Self>;
type Func;
// Required methods
unsafe fn allocate_uninit(
&self,
dtype: DType,
len: usize,
) -> Result<Self::Slice, Error>;
fn synchronize(&self) -> Result<(), Error>;
fn compile(
&self,
kernel: &Kernel,
name: Option<&str>,
) -> Result<Self::Func, Error>;
fn run(
&self,
f: &Self::Func,
args: &mut [&mut Self::Slice],
) -> Result<(), Error>;
fn matmul(
&self,
_dst: &mut Self::Slice,
_lhs: &Self::Slice,
_rhs: &Self::Slice,
_bmnk: (usize, usize, usize, usize),
_lhs_l: &Layout,
_rhs_l: &Layout,
) -> Result<(), Error>;
fn use_grid() -> bool;
}Required Associated Types§
Required Methods§
unsafe fn allocate_uninit( &self, dtype: DType, len: usize, ) -> Result<Self::Slice, Error>
fn synchronize(&self) -> Result<(), Error>
fn compile( &self, kernel: &Kernel, name: Option<&str>, ) -> Result<Self::Func, Error>
fn run( &self, f: &Self::Func, args: &mut [&mut Self::Slice], ) -> Result<(), Error>
fn matmul( &self, _dst: &mut Self::Slice, _lhs: &Self::Slice, _rhs: &Self::Slice, _bmnk: (usize, usize, usize, usize), _lhs_l: &Layout, _rhs_l: &Layout, ) -> Result<(), Error>
fn use_grid() -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.