pub struct GraphJITCompiler {
pub backends: Vec<JITBackend>,
pub default_opt_level: OptimizationLevel,
pub kernel_cache: HashMap<String, CompiledKernel>,
pub stats: CompilationStats,
pub fusion_rules: Vec<FusionRule>,
}Expand description
JIT compiler for graph operations
Fields§
§backends: Vec<JITBackend>Available backends
default_opt_level: OptimizationLevelDefault optimization level
kernel_cache: HashMap<String, CompiledKernel>Compiled kernel cache
stats: CompilationStatsCompilation statistics
fusion_rules: Vec<FusionRule>Kernel fusion rules
Implementations§
Source§impl GraphJITCompiler
impl GraphJITCompiler
Sourcepub fn add_backend(&mut self, backend: JITBackend)
pub fn add_backend(&mut self, backend: JITBackend)
Add a backend to the compiler
Sourcepub fn compile_operation(
&mut self,
operation: GraphOperation,
input_shapes: &[Vec<usize>],
backend: Option<JITBackend>,
) -> Result<CompiledKernel, JITError>
pub fn compile_operation( &mut self, operation: GraphOperation, input_shapes: &[Vec<usize>], backend: Option<JITBackend>, ) -> Result<CompiledKernel, JITError>
Compile a graph operation to optimized kernel
Sourcepub fn execute_kernel(
&self,
kernel: &CompiledKernel,
inputs: &[Tensor],
) -> Result<Vec<Tensor>, JITError>
pub fn execute_kernel( &self, kernel: &CompiledKernel, inputs: &[Tensor], ) -> Result<Vec<Tensor>, JITError>
Execute a compiled kernel with given inputs
Sourcepub fn fuse_operations(
&mut self,
operations: &[GraphOperation],
input_shapes: &[Vec<usize>],
) -> Result<CompiledKernel, JITError>
pub fn fuse_operations( &mut self, operations: &[GraphOperation], input_shapes: &[Vec<usize>], ) -> Result<CompiledKernel, JITError>
Analyze and fuse multiple operations for better performance
Sourcepub fn get_stats(&self) -> &CompilationStats
pub fn get_stats(&self) -> &CompilationStats
Get compilation statistics
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the kernel cache
Trait Implementations§
Source§impl Debug for GraphJITCompiler
impl Debug for GraphJITCompiler
Auto Trait Implementations§
impl Freeze for GraphJITCompiler
impl RefUnwindSafe for GraphJITCompiler
impl Send for GraphJITCompiler
impl Sync for GraphJITCompiler
impl Unpin for GraphJITCompiler
impl UnsafeUnpin for GraphJITCompiler
impl UnwindSafe for GraphJITCompiler
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> 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