pub struct CubeOptimization { /* private fields */ }Available on crate features
fusion only.Expand description
A fusion optimization ready to run on an execution stream: what fusers
finish and the fusion runtime executes. Wraps any FusedOperation.
Implementations§
Source§impl CubeOptimization
impl CubeOptimization
Sourcepub fn new(optimization: impl FusedOperation) -> CubeOptimization
pub fn new(optimization: impl FusedOperation) -> CubeOptimization
Wrap the fused operation.
Sourcepub fn num_ops_fused(&self) -> usize
pub fn num_ops_fused(&self) -> usize
The number of operations fused.
Sourcepub fn run(
&mut self,
context: &mut Context<CubeFusionHandle>,
fallback: &dyn Fn(usize) -> Box<dyn FallbackOperation>,
)
pub fn run( &mut self, context: &mut Context<CubeFusionHandle>, fallback: &dyn Fn(usize) -> Box<dyn FallbackOperation>, )
Run the fused operation. See FusedOperation::run.
Sourcepub fn to_state(&self) -> CubeOptimizationState
pub fn to_state(&self) -> CubeOptimizationState
Serialize the optimization: its name plus its state encoded as bytes.
Trait Implementations§
Source§impl Debug for CubeOptimization
impl Debug for CubeOptimization
Source§impl NumOperations for CubeOptimization
impl NumOperations for CubeOptimization
Source§fn max_relative_shape_id(&self) -> Option<usize>
fn max_relative_shape_id(&self) -> Option<usize>
The highest relative shape id this optimization names, if it names any.
None means the optimization names no relative shape, so it fits any stream.Source§impl Optimization<FusionCubeRuntime> for CubeOptimization
impl Optimization<FusionCubeRuntime> for CubeOptimization
Source§fn execute(
&mut self,
context: &mut Context<<FusionCubeRuntime as FusionRuntime>::FusionHandle>,
execution: &OrderedExecution<FusionCubeRuntime>,
)
fn execute( &mut self, context: &mut Context<<FusionCubeRuntime as FusionRuntime>::FusionHandle>, execution: &OrderedExecution<FusionCubeRuntime>, )
Execute the optimization.
Source§fn to_state(&self) -> CubeOptimizationState
fn to_state(&self) -> CubeOptimizationState
Returns the state that can be serialized.
Source§fn from_state(device: &CubeDevice, state: CubeOptimizationState) -> Self
fn from_state(device: &CubeDevice, state: CubeOptimizationState) -> Self
Create the optimization from the state.
Auto Trait Implementations§
impl !RefUnwindSafe for CubeOptimization
impl !Sync for CubeOptimization
impl !UnwindSafe for CubeOptimization
impl Freeze for CubeOptimization
impl Send for CubeOptimization
impl Unpin for CubeOptimization
impl UnsafeUnpin for CubeOptimization
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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