pub struct Prelude {
pub dense: BTreeSet<String>,
pub ranges: BTreeMap<String, Interval>,
pub views: BTreeMap<usize, String>,
}Expand description
The decisions the spatial chips make about a whole program before any op of it is linked.
Fields§
§dense: BTreeSet<String>The tables laid out dense — as a rows × cols matrix, a tile row holding tile rows — rather than as one flat
row (dense_tables).
ranges: BTreeMap<String, Interval>The interval each integer tensor is proven to hold, by name: a product’s operand precision is the narrowest that holds its operands’.
views: BTreeMap<usize, String>The view each product over a stored Q8_0 weight reads its activation through, by op.
Implementations§
Source§impl Prelude
impl Prelude
Sourcepub fn of(
g: &TensorGraph,
linked: &[usize],
target: &SpatialTarget,
agreed: &BTreeSet<String>,
ranges: BTreeMap<String, Interval>,
q8: &BTreeSet<String>,
chip: &dyn Fn(&str) -> Option<u16>,
) -> Prelude
pub fn of( g: &TensorGraph, linked: &[usize], target: &SpatialTarget, agreed: &BTreeSet<String>, ranges: BTreeMap<String, Interval>, q8: &BTreeSet<String>, chip: &dyn Fn(&str) -> Option<u16>, ) -> Prelude
The decisions for the ops linked of g, in the order they are linked: agreed the tables a deployment’s other
programs lay out dense, q8 the weights it stores Q8_0, and chip the chip of a tensor-parallel deployment each
result is computed on.
Sourcepub fn agree_layouts(
&self,
g: &TensorGraph,
ps: Vec<SpatialProgram>,
twins: &mut BTreeSet<String>,
passes: &dyn Fn(SpatialProgram) -> Result<SpatialProgram, SpatialReject>,
target: &SpatialTarget,
) -> Result<Vec<SpatialProgram>, SpatialReject>
pub fn agree_layouts( &self, g: &TensorGraph, ps: Vec<SpatialProgram>, twins: &mut BTreeSet<String>, passes: &dyn Fn(SpatialProgram) -> Result<SpatialProgram, SpatialReject>, target: &SpatialTarget, ) -> Result<Vec<SpatialProgram>, SpatialReject>
★ LAYOUT IS AGREED AT THE EDGES, ONCE, FOR EVERY OP. Each op lowers in its own layout — an attention or a rope
over flat rows, a matmul over a matrix. Where a section declares one of the program’s matrices in the layout the
prelude did not choose (Prelude::dense), that section’s tensor is renamed to its twin (X__rows flat,
X__dense dense) and ONE relayout section bridges the two: before the section for a matrix it reads, after it
for one it writes. A twin is made once and shared by every later reader. Carried state is updated in place and
is never bridged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Prelude
impl RefUnwindSafe for Prelude
impl Send for Prelude
impl Sync for Prelude
impl Unpin for Prelude
impl UnsafeUnpin for Prelude
impl UnwindSafe for Prelude
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.