Skip to main content

Module pack

Module pack 

Source
Expand description

Phase packing — independent sections run at once, on disjoint sites.

★ A BARRIER ONLY WHERE DATA FLOWS. A composed program’s sections run in PHASES: every section of a phase starts together, and a barrier closes the phase. Two sections may share one when neither reads what the other writes nor writes what the other touches (by tensor name, the carried state included) — and, on one chip, when they hold DISJOINT SITES: a site’s local memory is laid out for the one section it runs in a phase, so two sections never share a buffer. On a chip whose sites are interchangeable — a crossbar, no multicast rectangle whose geometry a section’s plan depends on — where a section runs is a renaming (for_each_site_mut), so each section is packed onto the next free sites of the earliest phase after everything it depends on that still has room for it.

A decode layer’s sections each hold a few dozen of the SN50’s 1,040 sites: the projections of one normalized row, the convolutions of its three streams, the per-head norms beside them run in one phase each instead of one after another with the rest of the fabric idle.

Functions§

for_each_site_mut
Every site p names, rewritten by f: its stages’, buffers’, placement’s, memory map’s, semaphores’ and engine programs’, and the semaphore posts inside those programs. A bijection of sites moves where the program runs and nothing it computes.
pack_phases
The sections packed into phases: each moved onto the next free sites of the earliest phase after every section it depends on that still has room, returned in phase order with barrier_after[k] closing each phase’s last section — or the sections back, untouched, when they cannot be moved on target (see packable).
sites_used
The sites p runs on.