Skip to main content

OptimizationProvider

Trait OptimizationProvider 

Source
pub trait OptimizationProvider:
    Send
    + Sync
    + 'static {
    type Operation: FusedOperation;

    // Required method
    fn fuser(&self, device: &CubeDevice) -> CubeFuser;

    // Provided methods
    fn name(&self) -> &str { ... }
    fn restore(
        &self,
        device: &CubeDevice,
        state: &CubeOptimizationState,
    ) -> CubeOptimization { ... }
}
Available on crate features fusion only.
Expand description

A user-provided fusion optimization: builds one CubeFuser per execution stream, competing with the built-in fusers. The fuser’s finish wraps an implementation of FusedOperation — normally Self::Operation, which the provided methods rely on.

Register a provider with register at the start of the program, before the first tensor operation on the fusion backend.

Required Associated Types§

Source

type Operation: FusedOperation

The fused operation the fusers finish.

Required Methods§

Source

fn fuser(&self, device: &CubeDevice) -> CubeFuser

Build a fuser for a new execution stream on device.

Provided Methods§

Source

fn name(&self) -> &str

Name identifying the optimization — the handle remove takes, and the key serialized execution plans are restored by.

Source

fn restore( &self, device: &CubeDevice, state: &CubeOptimizationState, ) -> CubeOptimization

Recover an optimization produced by this provider’s fuser from its serialized state — the counterpart of FusedOperation::to_state.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§