pub struct CompilerOptimizer { /* private fields */ }Expand description
Main compiler optimizer interface
Implementations§
Source§impl CompilerOptimizer
impl CompilerOptimizer
Sourcepub fn new(config: CompilerConfig) -> Result<Self, TrustformersError>
pub fn new(config: CompilerConfig) -> Result<Self, TrustformersError>
Create a new compiler optimizer with the given configuration
Sourcepub fn with_optimization_level(
level: OptimizationLevel,
) -> Result<Self, TrustformersError>
pub fn with_optimization_level( level: OptimizationLevel, ) -> Result<Self, TrustformersError>
Create a new compiler optimizer with a specific optimization level
Sourcepub fn config(&self) -> &CompilerConfig
pub fn config(&self) -> &CompilerConfig
Get the current configuration
Sourcepub fn set_config(
&mut self,
config: CompilerConfig,
) -> Result<(), TrustformersError>
pub fn set_config( &mut self, config: CompilerConfig, ) -> Result<(), TrustformersError>
Update the configuration
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the compilation cache
Sourcepub fn cache_stats(&self) -> HashMap<String, usize>
pub fn cache_stats(&self) -> HashMap<String, usize>
Get compilation cache statistics
Sourcepub fn optimize_graph(
&mut self,
graph: ComputationGraph,
) -> Result<OptimizationResult, TrustformersError>
pub fn optimize_graph( &mut self, graph: ComputationGraph, ) -> Result<OptimizationResult, TrustformersError>
Optimize a computation graph using all enabled optimizations
Sourcepub fn compile_graph(
&mut self,
graph: ComputationGraph,
) -> Result<CompilationResult, TrustformersError>
pub fn compile_graph( &mut self, graph: ComputationGraph, ) -> Result<CompilationResult, TrustformersError>
Compile an optimized graph to executable code
Sourcepub fn analyze_performance(
&mut self,
graph: &ComputationGraph,
) -> Result<PerformanceAnalysis, TrustformersError>
pub fn analyze_performance( &mut self, graph: &ComputationGraph, ) -> Result<PerformanceAnalysis, TrustformersError>
Perform comprehensive performance analysis
Sourcepub fn analyze_memory(
&mut self,
graph: &ComputationGraph,
) -> Result<MemoryAnalysis, TrustformersError>
pub fn analyze_memory( &mut self, graph: &ComputationGraph, ) -> Result<MemoryAnalysis, TrustformersError>
Perform memory usage analysis
Sourcepub fn analyze_dependencies(
&mut self,
graph: &ComputationGraph,
) -> Result<DependencyAnalysis, TrustformersError>
pub fn analyze_dependencies( &mut self, graph: &ComputationGraph, ) -> Result<DependencyAnalysis, TrustformersError>
Perform dependency analysis
Sourcepub fn recommend_optimizations(
&mut self,
graph: &ComputationGraph,
) -> Result<OptimizationRecommendations, TrustformersError>
pub fn recommend_optimizations( &mut self, graph: &ComputationGraph, ) -> Result<OptimizationRecommendations, TrustformersError>
Generate optimization recommendations for a graph
Sourcepub fn get_comprehensive_stats(&self) -> CompilerStatistics
pub fn get_comprehensive_stats(&self) -> CompilerStatistics
Get comprehensive compiler statistics
Auto Trait Implementations§
impl Freeze for CompilerOptimizer
impl !RefUnwindSafe for CompilerOptimizer
impl !Send for CompilerOptimizer
impl !Sync for CompilerOptimizer
impl Unpin for CompilerOptimizer
impl UnsafeUnpin for CompilerOptimizer
impl !UnwindSafe for CompilerOptimizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more