kernel_band_planning.bend checks
raw source on the hub · import stelliferous@0.0.2.0/kernel_band_planning.bend as Kernel_band_planning
Row-layout costs follow the actual halo ranges and allocation capacities. Preparation is serial. Fork copies weights and bias, never input cores.
6 imports
import Base import ./kernel_cost.bend as Cost import ./kernel_planning.bend as KernelPlanning import ./tensor_band.bend as Bands import ./tensor_band_window.bend as BandWindow import ./kernel_window.bend as KernelWindow
Types
type Movement source · line 14 · raw
Data
Images run one after another, each as its own parallel region (the runtime forks only within an image). span and open describe the current image's region: its costliest leaf path and its leaves. settled is the time of the image regions already finished.
Movement@work:F32 -> @span:F32 -> @open:U32 -> @settled:F32 -> @preparation:F32 -> @minimum:F32 -> @leaves:U32 -> Movement
type Plan source · line 17 · raw
Data
Plan@depth:U32 -> @parallel:Bool -> @estimated_ns:F32 -> Plan
type LayoutPlan source · line 130 · raw
Data
LayoutPlan@layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @parallel:Bool -> @estimated_ns:F32 -> @repartition_ns:F32 -> LayoutPlan
Definitions
def transfer source · line 20 · raw
@+count:U32 -> @byte_ns:F32 -> F32
def leaf_cost source · line 23 · raw
@preparation:F32 -> @+tail:F32 -> @cost:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Movement -> Movement
def assembly source · line 28 · raw
@channels:U32 -> @width:U32 -> @first:U32 -> @rows:U32 -> @window_first:U32 -> @+window_rows:U32 -> @byte_ns:F32 -> F32
BandWindow.assemble reuses the core exactly when both row ranges agree.
def leaf_window source · line 31 · raw
@+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @first:U32 -> @count:U32 -> @window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.RowWindow -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> Movement
def merge source · line 38 · raw
@clone:F32 -> @left:Movement -> @right:Movement -> Movement
def merge_images source · line 45 · raw
@+workers:U32 -> @clone:F32 -> @left:Movement -> @right:Movement -> Movement
A split between images finishes both sides' regions in turn.
def merge_layout source · line 52 · raw
@same_image:Bool -> @+workers:U32 -> @clone:F32 -> @left:Movement -> @right:Movement -> Movement
def clone_cost source · line 57 · raw
@work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> F32
def reorder_cost source · line 61 · raw
@work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> F32
def movement source · line 64 · raw
@layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+workers:U32 -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> Movement
def parallel_ns source · line 71 · raw
@+workers:U32 -> @+span:F32 -> @+open:U32 -> @+settled:F32 -> F32
def estimate source · line 74 · raw
@parallel:Bool -> @+workers:U32 -> @initial_copy:F32 -> @cost:Movement -> F32
def choose source · line 78 · raw
@allowed:Bool -> @depth:U32 -> @parallel:Bool -> @+time:F32 -> @best:Plan -> Plan
def transfer_layout source · line 82 · raw
@layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+geometry:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Geometry -> @+byte_ns:F32 -> F32
def wake_cost source · line 87 · raw
@window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> F32
def candidate source · line 92 · raw
@+depth:U32 -> @+workers:U32 -> @+initial_copy:F32 -> @+wake:F32 -> @+cost:Movement -> @config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @best:Plan -> Plan
def initial_candidate source · line 97 · raw
@depth:U32 -> @+layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+workers:U32 -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @best:Plan -> Plan
def candidates source · line 102 · raw
@remaining:Nat -> @allowed:Bool -> @+depth:U32 -> @+tasks:U32 -> @+ceiling:U32 -> @+workers:U32 -> @+batch:U32 -> @+height:U32 -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @best:Plan -> Plan
def dense_baseline source · line 112 · raw
@+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> F32
def select source · line 123 · raw
@+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @workers:U32 -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> Plan
Grain bounds the operation's work; the two wake rounds are charged separately.
def retained_parallel source · line 133 · raw
@window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @workers:U32 -> @config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @cost:Movement -> Bool
def layout_cost source · line 141 · raw
@layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+parallel:Bool -> @workers:U32 -> @+repartition:F32 -> @wake:F32 -> @reorder:F32 -> @cost:Movement -> LayoutPlan
def evaluated source · line 144 · raw
@+layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+previous:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+workers:U32 -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @+cost:Movement -> LayoutPlan
def prefer source · line 149 · raw
@candidate:LayoutPlan -> @best:LayoutPlan -> LayoutPlan
def layout_candidate source · line 154 · raw
@+layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @previous:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+workers:U32 -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @best:LayoutPlan -> LayoutPlan
def layouts source · line 157 · raw
@remaining:Nat -> @allowed:Bool -> @+depth:U32 -> @+tasks:U32 -> @+ceiling:U32 -> @+height:U32 -> @+batch:U32 -> @+previous:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+workers:U32 -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> @best:LayoutPlan -> LayoutPlan
def replan source · line 167 · raw
@+previous:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+work:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_planning.Work -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @workers:U32 -> @+config:0x9be3b13bf249759bc81e1958bcd1a4c0/kernel_cost.Configuration -> LayoutPlan