Expand description
The target-parametric passes: every one is fn(&SpatialProgram, &SpatialTarget) -> Result<SpatialProgram, SpatialReject>,
reads only the program and the descriptor, and leaves validate() holding. The order is pinned in
super::pipeline::PASS_ORDER. There is no strategy input anywhere: tile chooses the plan by the cost
model, fuse_readers re-derives the same comparison, and every later pass is a function of the structure.
Re-exports§
pub use crate::tensor_graph::front as recognize_stages;
Modules§
- compose
compose— N verified sections become ONESpatialProgram: the persistent-decoder form.- forward
forward— one section’s result handed to the next section’s compute, never through memory.- from_q8
- Q8_0 weights on the chip — a product
y = x · Wof up to a tile’s rows over a weight the deployment stores Q8_0. - from_
qwen_ ops from_qwen_ops— every op of an authored transformer forward, lowered as a COMPOSITION of the closed compute algebra: chains ofComputeOp::GenericandComputeOp::MatmulTiles, and nothing else.- from_
tensor_ op from_tensor_op— a recognized tensor op becomes a TEMPLATE spatial program (phaseTemplate): the tensors, the four stages, three double-buffered FIFOs, and one work item per output tile. The numerics are chosen HERE from the target’s matrix engine and the recognized fills, and the exactness claim is derived, never assumed: anIntsource on a float-primary engine rides as bf16 operands with an fp32 accumulator and is claimed exact only while every partial sum fits fp32’s mantissa.- fuse_
generic fuse_generic— put back into one register window what legalization had to take apart.- fuse_
readers fuse_readers— reader fusion / multicast as a GENERAL pass, decided by the cost model.- pack
- Phase packing — independent sections run at once, on disjoint sites.
- persist
persist— one resident worker per site loops over ITS work items (the “persistent kernel”).- place
place— pin every work item, stage and buffer to a site and an engine.- section_
shape - The canonical SHAPE of a section — its choreography with every name forgotten.
- shard
- ════════════════════════════════════════════════════════════════════════════════════════════════ TENSOR PARALLELISM — one program over many RDUs, and the reduction that makes it mean something.
- size_
buffers size_buffers— buffering as a GENERAL pass: depths from a rate model under the local-memory budget, a deterministic non-overlapping layout, typed refusals.- synthesize_
handshakes synthesize_handshakes— semaphore choreography DERIVED from the buffer/edge graph.- tile
tile— choose the per-site block plan from the legal lattice by the cost model.- verify
verify— attach the choreography certificate, or refuse.
Enums§
- Spatial
Reject - Why a program cannot become (or stay) a spatial program on a target — typed, never a silent fallback.
Constants§
- LV_
GEN_ COL - LV_
GEN_ K - A
ComputeOp::Generic’s CONTRACTION axis: the third iteration variable, summed at every(row, col)point —C[r, c] = Σ_k A[r, k]·B[k, c]— so a small matrix product is one stage. Maps step along it; the output never does. - LV_
GEN_ ROW - A
ComputeOp::Generic’s own iteration space: the rows inside a tile, and the columns across the operand’s tiles. Distinct from the choreography’s loop variables above, which index WORK; these index the ELEMENTS one compute stage walks, and are the axes an access map may omit to broadcast. - LV_ITEM
- LV_
ITEM_ X - LV_
ITEM_ Y - The loop variables the choreography addresses tiles with.
- LV_
KBLOCK - LV_
SUB_ H - LV_
SUB_ W