pub trait Compiler {
type Buffer;
type Program;
// Required methods
fn store<T: Scalar>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> Result<Self::Buffer, ZyxError>;
fn load<T: Scalar>(
&mut self,
buffer: &Self::Buffer,
numel: usize,
) -> Result<Vec<T>, ZyxError>;
fn drop_buffer(&mut self, buffer: &mut Self::Buffer) -> Result<(), ZyxError>;
fn drop_program(
&mut self,
program: &mut Self::Program,
) -> Result<(), ZyxError>;
fn launch(
&mut self,
program: &Self::Program,
args: &[&Self::Buffer],
flop: usize,
bytes: usize,
) -> Result<Self::Buffer, ZyxError>;
fn compile(&mut self, ir: &IR) -> Result<Self::Program, ZyxError>;
}
Expand description
Implement this trait for compiled backends
Required Associated Types§
Required Methods§
Sourcefn store<T: Scalar>(
&mut self,
iter: impl IntoIterator<Item = T>,
) -> Result<Self::Buffer, ZyxError>
fn store<T: Scalar>( &mut self, iter: impl IntoIterator<Item = T>, ) -> Result<Self::Buffer, ZyxError>
Store iter into buffer
Sourcefn load<T: Scalar>(
&mut self,
buffer: &Self::Buffer,
numel: usize,
) -> Result<Vec<T>, ZyxError>
fn load<T: Scalar>( &mut self, buffer: &Self::Buffer, numel: usize, ) -> Result<Vec<T>, ZyxError>
Load buffer into vec
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.