Expand description
Residency — which tensors the SRAM holds, and what leaves the chip.
★ THE SRAM IS THE PMUS’ MEMORY, AND IT IS ALLOCATED. A spatial chip’s SRAM tier is the sum of its sites’ local memories: every buffer a program lays out takes a share of it, and a tensor held there between sections — an intermediate one section writes and a later one reads, a state one step leaves for the next — takes more. It is only a tier a tensor can LIVE in where any site reaches any other’s memory (a crossbar, the RDU); a target whose sites share data through a global memory (Tensix, a GPU) hands intermediates through that memory.
Two decisions, at the two scopes that can make them:
• a PROGRAM places its intermediates (place_activations): each lives from the phase that writes it to the
last phase that reads it, and the live set of every phase must fit the SRAM its buffers leave — past it, the
intermediate whose last use is furthest away spills first (linear-scan allocation over live ranges);
• a DEPLOYMENT places the carried state (plan_states): a step’s state outlives the program, every layer
holds its own, and only the whole model knows what else is resident. The state that moves the most bytes per
byte held — a recurrent memory read and written every step before a cache read once — is kept first, within
each chip’s SRAM less the largest program’s own footprint.
What leaves the SRAM goes to the next tier down (plan_off_chip): an RDU’s HBM while it holds it, densest first,
then the DDR behind it (Dram); a chip with no HBM keeps it all in its DRAM.
Structs§
- Residency
Plan - Where a deployment keeps its carried state: each chip’s SRAM, the reserve its largest program takes while it runs, and every state class with the tier it was given.
- State
Class - A carried state of a deployment:
tensorof the programprogram, held on chipchiponce for each of theinstanceslayers that run the program, eachbytesin memory and movingmovedbytes a step.
Functions§
- buffer_
footprint - The SRAM each chip’s buffers take: over every site of the chip, the highest byte its local memory map reaches.
- holds_
tensors_ on_ chip - Whether
targetcan hold a tensor in its SRAM between sections: an SRAM tier any site reaches. - moved_
bytes - Bytes each tensor of
pmoves a step, every loop at its bound. - place_
activations - ★ PLACE THE INTERMEDIATES. Where
targetholds tensors on chip, each chip’s intermediates are allocated over their live ranges in the SRAM its buffers leave; where it does not, or past what fits, they stay in the tier they were declared in. A live set past the SRAM spills, at the first phase it overflows, the intermediate live there whose last use is furthest away — then the largest, then the lowest id — until every phase fits. - plan_
deployment - A deployment’s carried state planned and placed: every CARRIED
Statetensor of every program becomes aStateClass, once per layer that runs the program; the reserve is each chip’s largest footprint while a program runs —sram_footprintand the program’s own tables, kept on chip when the program has room for them — and every carried state takes the tierplan_statesgives it. - plan_
off_ chip - ★ THE NEXT TIER DOWN. Each class the SRAM does not hold goes, in the order
plan_statesranks by, to its chip’s HBM whilehbm_bytesholds it whole, and to the DDR (Dram) past it; with no HBM, all of it to the DRAM. - plan_
states - ★ KEEP WHAT MOVES MOST PER BYTE HELD. In order of bytes moved a step per byte held — then the smaller class, then
by name — each class goes on chip whole if its chip has room left beyond
reserve, and stays in HBM/DDR (Dram) otherwise; a class that does not fit leaves the room to the classes after it. Every byte a class keeps on chip is a byte a step does not move off it,moved / bytestimes over, so filling the SRAM densest-first is the most traffic whole classes can keep. - sram_
footprint - The SRAM each chip of
pholds while it runs: its buffers and the peak of its on-chip intermediates — the running sum of the live bytes over the phases, a range added at its first phase and taken away after its last. - tensor_
bytes - Bytes
ttakes in memory: its tiles, whole.
Type Aliases§
- Deployed
Program - One program of a deployment: its name, the layers that run it, the program, and — when the lowering knows it —
which of its
Statetensors a step carries to the next. A state the step assembles whole each time is the step’s own table: it lives while the program runs, like an intermediate, and is not the deployment’s to keep.