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 { ... }
}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§
Sourcetype Operation: FusedOperation
type Operation: FusedOperation
The fused operation the fusers finish.
Required Methods§
Sourcefn fuser(&self, device: &CubeDevice) -> CubeFuser
fn fuser(&self, device: &CubeDevice) -> CubeFuser
Build a fuser for a new execution stream on device.
Provided Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Name identifying the optimization — the handle remove takes, and
the key serialized execution plans are restored by.
Sourcefn restore(
&self,
device: &CubeDevice,
state: &CubeOptimizationState,
) -> CubeOptimization
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".