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§
Sourcefn compile_graph(
&mut self,
graph: &EinsumGraph,
config: &CompilationConfig,
) -> Result<CompiledGraph, ExecutorError>
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.
Sourcefn execute_compiled(
&mut self,
compiled: &CompiledGraph,
inputs: &HashMap<usize, Box<dyn Any>>,
) -> Result<HashMap<usize, Box<dyn Any>>, ExecutorError>
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§
Sourcefn supports_compilation(&self) -> bool
fn supports_compilation(&self) -> bool
Check if compilation is supported for this executor.