pub struct SpatialProgram {Show 20 fields
pub name: String,
pub tile: TileShape,
pub tensors: Vec<TensorDecl>,
pub stages: Vec<Stage>,
pub buffers: Vec<Buffer>,
pub edges: Vec<Edge>,
pub semaphores: Vec<Semaphore>,
pub sections: Vec<SectionSpan>,
pub trips: Vec<Trip>,
pub links: Vec<LinkPoint>,
pub work: WorkList,
pub numerics: NumericsPolicy,
pub claim: NumericsClaim,
pub acc_tiles_used: usize,
pub mem_banks: usize,
pub requires: Requirements,
pub placement: Option<Placement>,
pub memory: Option<MemoryMap>,
pub schedule: Option<Schedule>,
pub certificate: Option<ChoreographyCertificate>,
}Fields§
§name: String§tile: TileShape§tensors: Vec<TensorDecl>§stages: Vec<Stage>§buffers: Vec<Buffer>§edges: Vec<Edge>§semaphores: Vec<Semaphore>§sections: Vec<SectionSpan>The sections, in execution order. EMPTY for a single-workload program — which is every program the one-op front end builds, so the field is absent from their serialization and every existing artifact and fixture parses and round-trips unchanged.
trips: Vec<Trip>The loop counts the program reads from its data (Trip); a loop names one by its index. EMPTY for every
program whose counts are all fixed, so the field is absent from their serialization.
links: Vec<LinkPoint>Where this chip’s program halts for tensors to cross to or from another chip (LinkPoint), in order. EMPTY for
every program that is a whole machine’s, so the field is absent from their serialization.
work: WorkList§numerics: NumericsPolicy§claim: NumericsClaim§acc_tiles_used: usizeAccumulator tiles a compute stage may hold at once (recorded from the target by the passes).
mem_banks: usizeThe banks a site’s local memory interleaves its elements over (recorded from the target by the passes): the consecutive elements a lowering moves in one cycle. One — and absent from the serialization, so every program built before banks existed parses and round-trips unchanged — where a memory serves an element a cycle.
requires: Requirements§placement: Option<Placement>§memory: Option<MemoryMap>§schedule: Option<Schedule>§certificate: Option<ChoreographyCertificate>Implementations§
Source§impl SpatialProgram
impl SpatialProgram
pub fn tensor(&self, id: TensorId) -> &TensorDecl
pub fn stage(&self, id: StageId) -> &Stage
pub fn buffer(&self, id: BufferId) -> &Buffer
Sourcepub fn page_extents(&self) -> Vec<usize>
pub fn page_extents(&self) -> Vec<usize>
★ THE TILES ONE PAGE OF EACH BUFFER HOLDS, by buffer index: the most tiles any op fills or drains one page of it
with, and never fewer than its declared page_tiles.
A page is what the op that fills it writes. The evaluator keeps each page as that op’s list of tiles, and reads
a page’s plane at that list’s width. The declared page can be smaller. On a target whose accumulator lives in
registers, tile declares a matmul’s output as one tile per accumulator lane, because the GEMM kernel stores
each lane’s tiles straight to the tensor and never stages the block. The choreography still packs the whole
osh · osw block into one page of it. A lowering that stages every page through memory lays its slots out at
this extent, or the pack writes past the ring.
pub fn output_tensor(&self) -> Option<&TensorDecl>
Sourcepub fn section_result(&self, section: Option<usize>) -> Option<&TensorDecl>
pub fn section_result(&self, section: Option<usize>) -> Option<&TensorDecl>
What a section’s work WRITES — the tensor its items’ rectangles and its plan’s grid are blocks of: the
section’s Output, or, for a section whose every effect is an in-place update, the state it stores.
None names the uncomposed program’s one implicit section.
Sourcepub fn carries(&self) -> BTreeMap<BufferId, StageId>
pub fn carries(&self) -> BTreeMap<BufferId, StageId>
Every CARRIED buffer and the one stage that updates it: a buffer a stage both reads and writes. A carry holds a value across the K blocks of an item — the running state of a fold — and its first page is written by a second stage, its init, before the blocks begin.
Sourcepub fn fold_levels(&self) -> Vec<FoldLevel>
pub fn fold_levels(&self) -> Vec<FoldLevel>
Each stage’s level in its item’s K-block fold (FoldLevel), derived from the dataflow. A value MOVES WITH
THE BLOCKS when a load that steps LV_KBLOCK (or a K-block receive) brings it, or a body stage computes it.
The BODY is every stage that reads such a value, every carry’s update, and every stage that reads a carry
and computes what the body reads (a block’s limit from its running start); the EPILOGUE is every other
stage that reads a carry — its value after the last block — or what the epilogue computed; the PROLOGUE is
what remains: stages that read only values fixed for the item.
Sourcepub fn section_of_stage(&self, s: StageId) -> Option<usize>
pub fn section_of_stage(&self, s: StageId) -> Option<usize>
The section a stage belongs to, by index. None for an uncomposed program (which is ONE
implicit section, so every section-scoped query falls back to the whole program).
Sourcepub fn section_of_buffer(&self, b: BufferId) -> Option<usize>
pub fn section_of_buffer(&self, b: BufferId) -> Option<usize>
The section a buffer belongs to, by index.
Sourcepub fn section_of_item(&self, i: WorkItemId) -> Option<usize>
pub fn section_of_item(&self, i: WorkItemId) -> Option<usize>
The section a work item belongs to, by index.
Sourcepub fn items_at_in(&self, section: Option<usize>, site: Site) -> Vec<WorkItemId>
pub fn items_at_in(&self, section: Option<usize>, site: Site) -> Vec<WorkItemId>
The work items of site WITHIN a section — the composed program’s item list is the sections’
concatenated, so an unscoped items_at would hand a section every other section’s items.
Sourcepub fn site_items(&self) -> SiteItems<'_>
pub fn site_items(&self) -> SiteItems<'_>
Self::items_at_in for every section and site at once, built in one pass over the placement, for the loops
that ask it per stage or per executed op: each question is a lookup, not a copy of the site’s item list.
Sourcepub fn plan_of_stage(&self, s: StageId) -> Option<BlockPlan>
pub fn plan_of_stage(&self, s: StageId) -> Option<BlockPlan>
The plan a stage was lowered under: its section’s, or the program’s own.
Sourcepub fn state_tensors(&self) -> Vec<&TensorDecl>
pub fn state_tensors(&self) -> Vec<&TensorDecl>
Every tensor the program carries ACROSS steps — the state a second token chains through.
Sourcepub fn dim_classes(&self) -> Vec<Vec<(TensorId, DimAxis)>>
pub fn dim_classes(&self) -> Vec<Vec<(TensorId, DimAxis)>>
Tile dimensions the computation forces equal: a GEMM’s A.cols ≡ B.rows (K), B.cols ≡ C.cols (N),
A.rows ≡ C.rows (M); an elementwise op’s operands and result share both extents; a row op’s rows
and its per-column parameters share its width. A lowering prints one runtime symbol per class, so a
kernel’s address arithmetic names each extent once — the form the vendor’s kernels have.
Sourcepub fn dim_representative(
&self,
tensor: TensorId,
axis: DimAxis,
) -> (TensorId, DimAxis)
pub fn dim_representative( &self, tensor: TensorId, axis: DimAxis, ) -> (TensorId, DimAxis)
The representative of a tile dimension’s class: the output tensor’s extent when the class reaches the output, else the lowest-numbered tensor’s.
pub fn buffer_bytes(&self, b: &Buffer) -> usize
pub fn phase(&self) -> Phase
Sourcepub fn neutral_dump(&self) -> String
pub fn neutral_dump(&self) -> String
The deterministic, total, parseable dump of the program (the certificate travels separately).
pub fn parse_neutral(s: &str) -> Result<SpatialProgram, String>
Sourcepub fn stage_group(&self, s: &Stage) -> Option<GroupId>
pub fn stage_group(&self, s: &Stage) -> Option<GroupId>
The multicast group a Load sends to or a Recv receives from.
Sourcepub fn dram_tiles_read(&self) -> u64
pub fn dram_tiles_read(&self) -> u64
DRAM tiles the Load stages read over the whole run.
Sourcepub fn engine_signature(&self, p: &EngineProgram) -> String
pub fn engine_signature(&self, p: &EngineProgram) -> String
A site-independent structural signature of an engine program: the kernel a lowering would emit. A buffer is keyed by its template AND its page: a kernel counts pages in literals, so two sites whose pages differ (a boundary site of a grid that does not divide the tile count) cannot share one.
Sourcepub fn summary(&self) -> PlanSummary
pub fn summary(&self) -> PlanSummary
The emergent plan.
Sourcepub fn validate(&self) -> Result<(), IrViolation>
pub fn validate(&self) -> Result<(), IrViolation>
Every structural invariant, target-free. Runs after every pass.
Sourcepub fn bound_counts(&self) -> Vec<usize>
pub fn bound_counts(&self) -> Vec<usize>
Each trip’s greatest count, in trip order — the counts every static question takes.
pub fn trip(&self, id: TripId) -> &Trip
Sourcepub fn section_phases(&self) -> Vec<usize>
pub fn section_phases(&self) -> Vec<usize>
Each section’s PHASE: the run of sections one barrier closes, counted from the first.
Sourcepub fn has_indirect_access(&self) -> bool
pub fn has_indirect_access(&self) -> bool
Whether any access anywhere in the program — a Load/Store tile address, a Generic map, in the
stages or in the schedule’s own ops — is value-dependent. A lowering with no gather semantics
refuses the whole program by name on this, before it could print past the term.
Sourcepub fn generic_is_plain_pointwise(
&self,
iters: &[IterSpec],
maps: &[ElemAccess],
out: &ElemAccess,
ins: &[BufferId],
) -> bool
pub fn generic_is_plain_pointwise( &self, iters: &[IterSpec], maps: &[ElemAccess], out: &ElemAccess, ins: &[BufferId], ) -> bool
Whether a Generic is the PLAIN pointwise form and nothing more: every axis parallel, every
operand map the exact identity over its own page, the output map the identity with no indirect
term. The integer fabric’s elementwise datapath can express exactly this and refuses the rest
by name; a printer that pattern-matched the body alone would lower a transposed or gathered
operand as if it were the identity.
Trait Implementations§
Source§impl Clone for SpatialProgram
impl Clone for SpatialProgram
Source§fn clone(&self) -> SpatialProgram
fn clone(&self) -> SpatialProgram
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpatialProgram
impl Debug for SpatialProgram
Source§impl<'de> Deserialize<'de> for SpatialProgram
impl<'de> Deserialize<'de> for SpatialProgram
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>,
Source§impl PartialEq for SpatialProgram
impl PartialEq for SpatialProgram
Source§impl Serialize for SpatialProgram
impl Serialize for SpatialProgram
impl StructuralPartialEq for SpatialProgram
Auto Trait Implementations§
impl Freeze for SpatialProgram
impl RefUnwindSafe for SpatialProgram
impl Send for SpatialProgram
impl Sync for SpatialProgram
impl Unpin for SpatialProgram
impl UnsafeUnpin for SpatialProgram
impl UnwindSafe for SpatialProgram
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.