pub enum Commutativity {
Positional,
AllCommutative,
Groups(Vec<Vec<usize>>),
}Expand description
Declares which inputs of a node are interchangeable.
Used by the fusion pattern matcher to recognize equivalent subgraphs regardless of operand order, and by future passes (e.g., canonical ordering, common subexpression elimination).
Variants§
Positional
Input order matters. No permutations attempted during pattern matching. This is the default for unary nodes and any node where operand order affects the result.
Examples: mod(dividend, divisor), div(x, K),
concat(left, right), sub(a, b).
AllCommutative
All inputs are interchangeable, including variadic. For small arity (2-3), the matcher tries all permutations. For larger arity, it uses set-matching.
Examples: sum(a, b, ..., n), product(a, b, ..., n),
min(a, b, ..., n), max(a, b, ..., n).
Groups(Vec<Vec<usize>>)
Specific groups of input port indices are interchangeable within each group. Inputs not listed in any group are positional.
Example: fma(x, y, z) = x + y * z
The multiplicands y (index 1) and z (index 2) commute,
but the addend x (index 0) does not.
Groups(vec![vec![1, 2]])
Trait Implementations§
Source§impl Clone for Commutativity
impl Clone for Commutativity
Source§fn clone(&self) -> Commutativity
fn clone(&self) -> Commutativity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Commutativity
impl Debug for Commutativity
Source§impl Default for Commutativity
impl Default for Commutativity
Source§fn default() -> Commutativity
fn default() -> Commutativity
impl Eq for Commutativity
Source§impl PartialEq for Commutativity
impl PartialEq for Commutativity
impl StructuralPartialEq for Commutativity
Auto Trait Implementations§
impl Freeze for Commutativity
impl RefUnwindSafe for Commutativity
impl Send for Commutativity
impl Sync for Commutativity
impl Unpin for Commutativity
impl UnsafeUnpin for Commutativity
impl UnwindSafe for Commutativity
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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