pub enum MatmulStrategy {
Simple,
BlockReuse,
ReuseMcast,
}Expand description
The program STRATEGY the compiler picks for a matmul — the same decision the vendor’s op-library makes.
Both are correct; they trade differently: Simple streams one tile at a time (best overlap of DRAM and
compute — wins when the problem is compute/latency-bound), BlockReuse holds operand blocks in L1 and
reuses them across a DST sub-block (fewer DRAM reads — wins when the problem is DRAM-bandwidth-bound, i.e.
large per-core output blocks). Choosing wrong is a real perf bug: at 640³ BlockReuse measures ~12,097
device cycles vs Simple’s 9,735, so the compiler must pick Simple there.
Variants§
Simple
One matmul_tiles per output tile, streamed — maximum DRAM/compute overlap.
BlockReuse
Block-reuse (a DST sub-block held while operands are reused) — fewer DRAM reads, for large blocks.
Without multicast every core re-reads its blocks from DRAM, so this can LOSE to Simple (the
redundant reads outweigh the reuse); it is retained only for 1-D grids where ReuseMcast cannot
exploit both a row and a column of receivers.
ReuseMcast
Block-reuse + NOC multicast: each operand block is read from DRAM once and multicast across its
row/column. Strictly fewer DRAM reads than BlockReuse (same L1 reuse), and the plan that closes
the gap to the vendor’s hand-optimized op on a genuine 2-D worker grid.
Trait Implementations§
Source§impl Clone for MatmulStrategy
impl Clone for MatmulStrategy
Source§fn clone(&self) -> MatmulStrategy
fn clone(&self) -> MatmulStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MatmulStrategy
impl Debug for MatmulStrategy
Source§impl PartialEq for MatmulStrategy
impl PartialEq for MatmulStrategy
impl Copy for MatmulStrategy
impl Eq for MatmulStrategy
impl StructuralPartialEq for MatmulStrategy
Auto Trait Implementations§
impl Freeze for MatmulStrategy
impl RefUnwindSafe for MatmulStrategy
impl Send for MatmulStrategy
impl Sync for MatmulStrategy
impl Unpin for MatmulStrategy
impl UnsafeUnpin for MatmulStrategy
impl UnwindSafe for MatmulStrategy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.