Skip to main content

TlCompilableExecutor

Trait TlCompilableExecutor 

Source
pub trait TlCompilableExecutor {
    // Required methods
    fn compile_graph(
        &mut self,
        graph: &EinsumGraph,
        config: &CompilationConfig,
    ) -> Result<CompiledGraph, ExecutorError>;
    fn execute_compiled(
        &mut self,
        compiled: &CompiledGraph,
        inputs: &HashMap<usize, Box<dyn Any>>,
    ) -> Result<HashMap<usize, Box<dyn Any>>, ExecutorError>;

    // Provided method
    fn supports_compilation(&self) -> bool { ... }
}
Expand description

Trait for executors that support graph compilation.

Executors implementing this trait can execute pre-compiled graphs more efficiently than executing the original graph.

Required Methods§

Source

fn compile_graph( &mut self, graph: &EinsumGraph, config: &CompilationConfig, ) -> Result<CompiledGraph, ExecutorError>

Compile a graph for efficient execution.

Returns a compiled graph that can be executed multiple times with different inputs without recompiling.

Source

fn execute_compiled( &mut self, compiled: &CompiledGraph, inputs: &HashMap<usize, Box<dyn Any>>, ) -> Result<HashMap<usize, Box<dyn Any>>, ExecutorError>

Execute a compiled graph.

This should be more efficient than executing the original graph since optimization passes have already been applied.

Provided Methods§

Source

fn supports_compilation(&self) -> bool

Check if compilation is supported for this executor.

Implementors§