pub enum StageKind {
Load {
tensor: TensorId,
pattern: AccessPattern,
num_blocks: usize,
multicast: Option<GroupId>,
},
Store {
tensor: TensorId,
pattern: AccessPattern,
sub_blocks: (usize, usize),
},
Recv {
group: GroupId,
},
AllReduce {
pool: ReducePool,
tensor: TensorId,
combine: Box<ComputeOp>,
},
Compute(ComputeOp),
Scalar(ScalarBody),
}Variants§
Load
Fields
pattern: AccessPatternStore
Recv
The receiver side of a multicast group: its output buffer is filled by the group’s sender.
AllReduce
CROSS-CHIP REDUCTION. Every chip of group holds a PARTIAL of tensor — the full output shape,
summed over only its slice of the contraction axis. This stage combines them, and until it runs the
tensor does not hold the answer.
★ ITS ARITHMETIC IS ALREADY IN THE CLOSED ALGEBRA. An all-reduce’s combine is an N-ary elementwise
fold — for Sum, Add(Add(op0, op1), op2)… — which ComputeOp::Generic expresses exactly. So
combine is a Generic built from the pool and the operand count, and every consumer downstream
(the scheduler, the evaluator, the cost model) sees an ordinary compute op rather than a new form.
What is genuinely NEW here is the TOPOLOGY, not the arithmetic: this stage’s operands live on
different chips, which is what the certificate’s UnreducedShard obligation is about.
★ AND THE MEMBERSHIP IS NOT STORED, because it cannot then disagree with the truth. The chips
taking part are exactly the sites of the buffers in ins — Group is the multicast RECTANGLE
abstraction and a rectangle of (x, y) cannot name a set of chips, so widening it here would stretch
a type to carry something it was not built for. A derived answer beats a field that can drift.
Compute(ComputeOp)
Scalar(ScalarBody)
Implementations§
Source§impl StageKind
impl StageKind
Sourcepub fn remap_buffers(&mut self, f: &dyn Fn(BufferId) -> BufferId)
pub fn remap_buffers(&mut self, f: &dyn Fn(BufferId) -> BufferId)
Rename every buffer the stage’s KIND names beyond its ports — an indirect address’s index buffer, a
matmul’s spill buffer, a bias. A pass that renumbers buffers maps these with ins/outs, or the stage
silently points at somebody else’s buffer.
pub fn role(&self) -> SiteRole
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StageKind
impl<'de> Deserialize<'de> for StageKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for StageKind
impl StructuralPartialEq for StageKind
Auto Trait Implementations§
impl Freeze for StageKind
impl RefUnwindSafe for StageKind
impl Send for StageKind
impl Sync for StageKind
impl Unpin for StageKind
impl UnsafeUnpin for StageKind
impl UnwindSafe for StageKind
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.