Skip to main content

Compiler

Trait Compiler 

Source
pub trait Compiler:
    Sync
    + Send
    + 'static
    + Clone
    + Debug {
    type Representation: Display;
    type CompilationOptions: Send + Default + Debug;

    // Required methods
    fn compile(
        &mut self,
        kernel: KernelDefinition,
        compilation_options: &Self::CompilationOptions,
        mode: ExecutionMode,
        addr_type: StorageType,
    ) -> Result<Self::Representation, CompilationError>;
    fn elem_size(&self, elem: ElemType) -> usize;
    fn extension(&self) -> &'static str;
}
Expand description

Compiles the representation into its own representation that can be formatted into tokens.

Required Associated Types§

Source

type Representation: Display

The representation for the compiled code.

Source

type CompilationOptions: Send + Default + Debug

The compilation options used to configure the compiler

Required Methods§

Source

fn compile( &mut self, kernel: KernelDefinition, compilation_options: &Self::CompilationOptions, mode: ExecutionMode, addr_type: StorageType, ) -> Result<Self::Representation, CompilationError>

Compiles the kernel definition into the compiler’s representation.

Source

fn elem_size(&self, elem: ElemType) -> usize

The size of the given element in bytes.

Source

fn extension(&self) -> &'static str

The default extension for the runtime’s kernel/shader code. Might change based on which compiler is used.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§