stelliferous Releases (2): 0.0.3.0 0xd6aaab858a4fbd1461bd0fee27b97184 invalid https://jend.leeeet.dev/files.txt?path=stelliferous@0.0.3.0 expected a fresh constructor name (duplicate declaration: Text) At https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.3.0/checkpoint_pickle.bend&start_line=14. Files that do not load: checkpoint_pickle.bend, tensor_batch_norm.bend, tensor_checkpoint.bend, tensor_f32.bend, tensor_layer.bend and 3 more. 0.0.2.0 0x9be3b13bf249759bc81e1958bcd1a4c0 indexed https://jend.leeeet.dev/files.txt?path=stelliferous@0.0.2.0 Definitions (2086, 1 to 100 shown): DefaultKernelCost.cycle_ns (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/default_kernel_cost.bend&name=cycle_ns) def cycle_ns() -> F32: DefaultKernelCost.configuration (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/default_kernel_cost.bend&name=configuration) def configuration() -> Cost.Configuration: DefaultMachineLimits.capacity (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/default_machine_limits.bend&name=capacity) # The capacity as a word, for run-time guards that need no other limit. def capacity() -> U32: DefaultMachineLimits.limits (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/default_machine_limits.bend&name=limits) def limits() -> Machine.Limits: KernelBandPipeline.Context (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=Context) type Context is Data: Context{window: BandWindow.Geometry,channels: U32,inner: U32,parallel: Bool,activation: Activations.Activation} KernelBandPipeline.windowed (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=windowed) # A leaf assembles the rows its outputs read into one contiguous window whose # first row is a stride multiple, then runs the dense leaf on it: packing a # window is packing a shorter image with output rows shifted by first / stride. def windowed(~custom: F32 -> F32,activation: Activations.Activation,+geometry: BandWindow.Geometry,+channels: U32,+inner: U32,+first: U32,+rows: U32,+rows_read: BandWindow.RowWindow, core: Storage.Buffer,above: Storage.Buffer,below: Storage.Buffer,weights: Storage.Buffer,bias: Storage.Buffer) -> Bands.Bands(~F32): KernelBandPipeline.leaf (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=leaf) def leaf(~custom: F32 -> F32,context: Context,+first: U32,+rows: U32,core: Storage.Buffer,halo: BandWindow.Halo, weights: Storage.Buffer,bias: Storage.Buffer) -> Bands.Bands(~F32): KernelBandPipeline.parallel (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=parallel) def parallel(context: Context) -> Bool: KernelBandPipeline.input_geometry (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=input_geometry) def input_geometry(context: Context) -> Bands.Geometry: KernelBandPipeline.parallel_plan (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=parallel_plan) def parallel_plan(+context: Context,plan: Bands.Plan) -> Bool: KernelBandPipeline.Parameters (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=Parameters) def Parameters() -> Type: KernelBandPipeline.shared (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=shared) def shared(weights: Storage.Buffer & Storage.Buffer,bias: Storage.Buffer & Storage.Buffer) -> Parameters() & Parameters(): KernelBandPipeline.share (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=share) # Each half of a split owns its copy of the read-only weights and bias. def share(parameters: Parameters()) -> Parameters() & Parameters(): KernelBandPipeline.band (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=band) def band(~custom: F32 -> F32,context: Context,first: U32,rows: U32,core: Storage.Buffer,halo: BandWindow.Halo,parameters: Parameters()) -> Bands.Bands(~F32): KernelBandPipeline.run (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=run) # Every core leaf with its halo, through the shared band recursion. Trees of # another shape keep the cores. def run(~custom: F32 -> F32,plan: Bands.Plan,mode: Bool,+context: Context,bands: Bands.Bands(~F32),halos: BandWindow.Halos(~F32), weights: Storage.Buffer,bias: Storage.Buffer) -> Bands.Bands(~F32): KernelBandPipeline.prepared (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=prepared) def prepared(~custom: F32 -> F32,+context: Context,+plan: Bands.Plan,weights: Storage.Buffer,bias: Storage.Buffer, owners: Bands.Bands(~F32) & BandWindow.Halos(~F32)) -> Bands.Bands(~F32): KernelBandPipeline.planned (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=planned) def planned(~custom: F32 -> F32,+context: Context,weights: Storage.Buffer,bias: Storage.Buffer, owners: Bands.Bands(~F32) & Bands.Plan) -> Bands.Bands(~F32): KernelBandPipeline.execute (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_pipeline.bend&name=execute) # The weights arrive in the order the kernel reads them. def execute(~custom: F32 -> F32,context: Context,bands: Bands.Bands(~F32),weights: Storage.Buffer,bias: Storage.Buffer) -> Bands.Bands(~F32): KernelBandPlanning.Movement (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=Movement) # 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. type Movement is Data: Movement{work: F32,span: F32,open: U32,settled: F32,preparation: F32,minimum: F32,leaves: U32} KernelBandPlanning.Plan (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=Plan) type Plan is Data: Plan{depth: U32,parallel: Bool,estimated_ns: F32} KernelBandPlanning.transfer (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=transfer) def transfer(+count: U32,byte_ns: F32) -> F32: KernelBandPlanning.leaf_cost (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=leaf_cost) def leaf_cost(preparation: F32,+tail: F32,cost: KernelPlanning.Movement) -> Movement: KernelBandPlanning.assembly (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=assembly) # BandWindow.assemble reuses the core exactly when both row ranges agree. def assembly(channels: U32,width: U32,first: U32,rows: U32,window_first: U32,+window_rows: U32,byte_ns: F32) -> F32: KernelBandPlanning.leaf_window (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=leaf_window) def leaf_window(+work: KernelPlanning.Work,first: U32,count: U32,window: BandWindow.RowWindow,+config: Cost.Configuration) -> Movement: KernelBandPlanning.merge (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=merge) def merge(clone: F32,left: Movement,right: Movement) -> Movement: KernelBandPlanning.merge_images (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=merge_images) # A split between images finishes both sides' regions in turn. def merge_images(+workers: U32,clone: F32,left: Movement,right: Movement) -> Movement: KernelBandPlanning.merge_layout (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=merge_layout) def merge_layout(same_image: Bool,+workers: U32,clone: F32,left: Movement,right: Movement) -> Movement: KernelBandPlanning.clone_cost (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=clone_cost) def clone_cost(work: KernelPlanning.Work,config: Cost.Configuration) -> F32: KernelBandPlanning.reorder_cost (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=reorder_cost) def reorder_cost(work: KernelPlanning.Work,config: Cost.Configuration) -> F32: KernelBandPlanning.movement (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=movement) def movement(layout: Bands.Plan,+workers: U32,+work: KernelPlanning.Work,+window: BandWindow.Geometry,+config: Cost.Configuration) -> Movement: KernelBandPlanning.parallel_ns (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=parallel_ns) def parallel_ns(+workers: U32,+span: F32,+open: U32,+settled: F32) -> F32: KernelBandPlanning.estimate (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=estimate) def estimate(parallel: Bool,+workers: U32,initial_copy: F32,cost: Movement) -> F32: KernelBandPlanning.choose (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=choose) def choose(allowed: Bool,depth: U32,parallel: Bool,+time: F32,best: Plan) -> Plan: KernelBandPlanning.transfer_layout (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=transfer_layout) def transfer_layout(layout: Bands.Plan,+geometry: Bands.Geometry,+byte_ns: F32) -> F32: KernelBandPlanning.wake_cost (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=wake_cost) def wake_cost(window: BandWindow.Geometry,config: Cost.Configuration) -> F32: KernelBandPlanning.candidate (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=candidate) def candidate(+depth: U32,+workers: U32,+initial_copy: F32,+wake: F32,+cost: Movement,config: Cost.Configuration,best: Plan) -> Plan: KernelBandPlanning.initial_candidate (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=initial_candidate) def initial_candidate(depth: U32,+layout: Bands.Plan,+workers: U32,+work: KernelPlanning.Work,+window: BandWindow.Geometry,+config: Cost.Configuration,best: Plan) -> Plan: KernelBandPlanning.candidates (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=candidates) def candidates(remaining: Nat,allowed: Bool,+depth: U32,+tasks: U32,+ceiling: U32,+workers: U32,+batch: U32,+height: U32, +work: KernelPlanning.Work,+window: BandWindow.Geometry,+config: Cost.Configuration,best: Plan) -> Plan: KernelBandPlanning.dense_baseline (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=dense_baseline) def dense_baseline(+work: KernelPlanning.Work,window: BandWindow.Geometry,+config: Cost.Configuration) -> F32: KernelBandPlanning.select (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=select) # Grain bounds the operation's work; the two wake rounds are charged separately. def select(+work: KernelPlanning.Work,+window: BandWindow.Geometry,workers: U32,+config: Cost.Configuration) -> Plan: KernelBandPlanning.LayoutPlan (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=LayoutPlan) type LayoutPlan is Data: LayoutPlan{layout: Bands.Plan,parallel: Bool,estimated_ns: F32,repartition_ns: F32} KernelBandPlanning.retained_parallel (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=retained_parallel) def retained_parallel(window: BandWindow.Geometry,workers: U32,config: Cost.Configuration,cost: Movement) -> Bool: KernelBandPlanning.layout_cost (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=layout_cost) def layout_cost(layout: Bands.Plan,+parallel: Bool,workers: U32,+repartition: F32,wake: F32,reorder: F32,cost: Movement) -> LayoutPlan: KernelBandPlanning.evaluated (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=evaluated) def evaluated(+layout: Bands.Plan,+previous: Bands.Plan,+work: KernelPlanning.Work,+window: BandWindow.Geometry,+workers: U32,+config: Cost.Configuration,+cost: Movement) -> LayoutPlan: KernelBandPlanning.prefer (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=prefer) def prefer(candidate: LayoutPlan,best: LayoutPlan) -> LayoutPlan: KernelBandPlanning.layout_candidate (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=layout_candidate) def layout_candidate(+layout: Bands.Plan,previous: Bands.Plan,+work: KernelPlanning.Work,+window: BandWindow.Geometry,+workers: U32,+config: Cost.Configuration,best: LayoutPlan) -> LayoutPlan: KernelBandPlanning.layouts (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=layouts) def layouts(remaining: Nat,allowed: Bool,+depth: U32,+tasks: U32,+ceiling: U32,+height: U32,+batch: U32,+previous: Bands.Plan, +work: KernelPlanning.Work,+window: BandWindow.Geometry,+workers: U32,+config: Cost.Configuration,best: LayoutPlan) -> LayoutPlan: KernelBandPlanning.replan (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_band_planning.bend&name=replan) def replan(+previous: Bands.Plan,+work: KernelPlanning.Work,+window: BandWindow.Geometry,workers: U32,+config: Cost.Configuration) -> LayoutPlan: KernelBlock.Twin (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_block.bend&name=Twin) # A statically shaped product. Pairing readers preserves one buffer owner. type Twin<-Element: Data> is Data: Twin{first: Element,second: Element} KernelBlock.zip_map (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_block.bend&name=zip_map) # Static product composition also lifts an operation to any pair of elements. # Nesting this template gives wider products without another arithmetic kernel. def zip_map(~Element: Data,~Context: Data,~combine: Element -> Element -> Context -> Element, left: Twin,right: Twin,context: Context) -> Twin: KernelBlock.finish_pair (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_block.bend&name=finish_pair) def finish_pair(~State: Type,~Element: Data,first: Element,result: State & Element) -> State & Twin: KernelBlock.read_second (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_block.bend&name=read_second) def read_second( ~State: Type,~Context: Data,~Element: Data,~Index: Data, ~read: State -> Context -> Index -> State & Element, result: State & Element,context: Context,index: Index ) -> State & Twin: KernelBlock.read_at (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_block.bend&name=read_at) def read_at( ~State: Type,~Context: Data,~Element: Data,~Index: Data, ~read: State -> Context -> Index -> State & Element, state: State,+context: Context,first: Index,second: Index ) -> State & Twin: KernelBlock.read_pair (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_block.bend&name=read_pair) def read_pair( ~State: Type,~Context: Data,~Element: Data, ~read: State -> Context -> Nat -> State & Element,~stride: Nat, state: State,context: Context,index: Nat ) -> State & Twin: KernelCost.Configuration (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_cost.bend&name=Configuration) type Configuration is Data: Configuration{mac_ns: F32,copy_byte_ns: F32,operation_ns: F32,grain_ns: F32,wake_round_ns: F32} KernelCost.element_ns (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_cost.bend&name=element_ns) # One element's cost. Bytes price loading, storing and the loop that moves # them, as the copies that measured copy_byte_ns do; operations are the other # scalar work, counted from source. def element_ns(+bytes: F32,+operations: F32,config: Configuration) -> F32: KernelCost.region_ns (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_cost.bend&name=region_ns) # The official runtime grows fork tasks and queues fork-free tasks for its # work round (monk_step, row_grow, cube_run). No fixed number of leaves can # be subtracted as already completed by growth. Price complete waves of at # most workers leaves, using the largest path (including clones) per wave. # This is a conservative scheduling estimate, not a bound on the runtime's # static ring distribution. Callers charge the two wake rounds separately. def region_ns(+workers: U32,+leaves: U32,+span: F32) -> F32: KernelGather.gather_width_when (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather.bend&name=gather_width_when) # Clip once per leaf. A channel is one contiguous copy; padding never becomes # a store into the next channel. Both owners stay affine across the channel loop. def gather_width_when(inside: Bool,offset: U32,output_positions: U32,span: U32) -> U32: KernelGather.gather_width (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather.bend&name=gather_width) def gather_width(+offset: U32,+output_positions: U32,span: U32) -> U32: KernelGather.gather_channel (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather.bend&name=gather_channel) def gather_channel(+channel: U32,+width: U32,+offset: U32,+output_positions: U32,+span: U32, owners: Array & Array) -> Array & Array: KernelGather.gather_channels (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather.bend&name=gather_channels) def gather_channels(remaining: Nat,+channel: U32,+width: U32,+offset: U32,+output_positions: U32,+span: U32, owners: Array & Array) -> Array & Array: KernelGather.gathered_output (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather.bend&name=gathered_output) def gathered_output(owners: Array & Array) -> Array: KernelGather.gather_block (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather.bend&name=gather_block) def gather_block(channels: U32,+offset: U32,+output_positions: U32,+span: U32,input_storage: Array,output_storage: Array) -> Array: KernelGatherBuffer.run (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gather_buffer.bend&name=run) def run(+channels: U32,+offset: U32,+positions: U32,+span: U32,input: Storage.Buffer,output: Storage.Buffer) -> Storage.Buffer: KernelGemm.Buffers (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=Buffers) type Buffers is Type: Buffers{input: Array,weights: Array,bias: Array,output: Array} KernelGemm.Layout (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=Layout) # Row-major output, eight contiguous columns; packed weights are [M/8,K,8]. # A job is one half of a weight block, four rows, at eight positions. Only # valid rows are stored; the last weight block is zero-padded to eight rows. type Layout is Data: Layout{rows: U32,columns: U32,inner: U32,start: U32,output_columns: U32} KernelGemm.Context (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=Context) # input_base and weight_base address the job's first input group and weight # tile; the loop index advances both. type Context is Data: Context{row: U32,position: U32,rows: U32,columns: U32,input_base: U32,weight_base: U32} KernelGemm.Job (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=Job) type Job is Data: Job{context: Context,upper: Bool,count: Nat} KernelGemm.Loop (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=Loop) # One flat loop state. Every owner, the index and the accumulators are fields # of this record, and each helper that passes the accumulators on carries few # other values: a nested owner record or a longer helper chain made every k # step a real call. type Loop is Type: Loop{input: Array,weights: Array,bias: Array,output: Array,index: U32,context: Context, accumulators: Rows.Rows} KernelGemm.row_units (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=row_units) # A job owns four output rows: one half of an eight-row weight block. def row_units(rows: U32) -> U32: KernelGemm.column_groups (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=column_groups) def column_groups(columns: U32) -> U32: KernelGemm.job_count (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=job_count) def job_count(rows: U32,columns: U32) -> U32: KernelGemm.job (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=job) # Input-major: one input group stays in cache while every row unit passes # over it (the BLIS loop order). Units 2b and 2b+1 share weight block b. def job(layout: Layout,index: U32) -> Job: KernelGemm.update (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=update) def update(accumulators: Rows.Rows,+input: Tile.Tile8,weights: Rows.Rows) -> Rows.Rows: KernelGemm.with_input (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=with_input) def with_input(weights: Array,bias: Array,output: Array,+index: U32,context: Context, accumulators: Rows.Rows,samples: Rows.Rows,read: Array & Tile.Tile8) -> Loop: KernelGemm.with_weights (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=with_weights) def with_weights(~upper: Bool,input: Array,bias: Array,output: Array,+index: U32,context: Context,+input_base: U32, accumulators: Rows.Rows,read: Array & Tile.Tile8) -> Loop: KernelGemm.step (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=step) # One ordered k step: read the weight tile, then the input tile, then MAC. def step(~upper: Bool,state: Loop) -> Loop: KernelGemm.store_lane (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=store_lane) # The last group can contain padding lanes; only real columns are written. def store_lane(inside: Bool,output: Array,offset: U32,value: F32) -> Array: KernelGemm.store_tail (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=store_tail) def store_tail(+count: U32,output: Array,+offset: U32,+bias: F32,+accumulator: Tile.Tile8) -> Array: KernelGemm.write_bias (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=write_bias) def write_bias(output: Array,offset: U32,accumulator: Tile.Tile8,count: U32,read: Array & F32) -> Array & Array: KernelGemm.write_row (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=write_row) def write_row(valid: Bool,+row: U32,+position: U32,+columns: U32,accumulator: Tile.Tile8, owners: Array & Array) -> Array & Array: KernelGemm.write (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=write) def write(context: Context,+accumulators: Rows.Rows,bias: Array,output: Array) -> Array & Array: KernelGemm.after_write (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=after_write) def after_write(input: Array,weights: Array,written: Array & Array) -> Buffers: KernelGemm.finish (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=finish) # The loop's final step stores its accumulators; bias is added once. def finish(state: Loop) -> Buffers: KernelGemm.reduce (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=reduce) def reduce(upper: Bool,count: Nat,state: Loop) -> Buffers: KernelGemm.execute (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=execute) # Every output folds k in order from +0, then adds its bias once. def execute(job: Job,buffers: Buffers) -> Buffers: KernelGemm.step_job (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=step_job) def step_job(index: U32,layout: Layout,buffers: Buffers) -> Buffers: KernelGemm.result (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=result) def result(buffers: Buffers) -> Array: KernelGemm.run_keeping (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=run_keeping) # Every job in order. Only the output changes, so the caller gets its other # three buffers back. def run_keeping(+rows: U32,input: Array,weights: Array,bias: Array,output: Array,+columns: U32,inner: U32,start: U32,output_columns: U32) -> Buffers: KernelGemm.run_at (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=run_at) def run_at(+rows: U32,input: Array,weights: Array,bias: Array,output: Array,+columns: U32,inner: U32,start: U32,output_columns: U32) -> Array: KernelGemm.run (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=run) def run(+rows: U32,input: Array,weights: Array,bias: Array,output: Array,+columns: U32,inner: U32) -> Array: KernelGemm.kept_input (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=kept_input) def kept_input(buffers: Buffers) -> Array: KernelGemm.kept_weights (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=kept_weights) def kept_weights(buffers: Buffers) -> Array: KernelGemm.kept_bias (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm.bend&name=kept_bias) def kept_bias(buffers: Buffers) -> Array: KernelGemmBuffer.run (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm_buffer.bend&name=run) # The live certificate is updated once, outside every output and MAC loop. def run(+rows: U32,input: Storage.Buffer,weights: Storage.Buffer,bias: Storage.Buffer, output: Storage.Buffer,+columns: U32,+inner: U32) -> Storage.Buffer: KernelGemmBuffer.Kept (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm_buffer.bend&name=Kept) # The tiles, the weights and the bias come back with the output, for a caller # that uses them again. type Kept is Type: Kept{input: Storage.Buffer,weights: Storage.Buffer,bias: Storage.Buffer,output: Storage.Buffer} KernelGemmBuffer.kept (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm_buffer.bend&name=kept) def kept(state: Gemm.Buffers,input_length: Nat,weight_length: Nat,bias_length: Nat,length: Nat,certificates: GemmCertificate.Kept) -> Kept: KernelGemmBuffer.run_keeping (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm_buffer.bend&name=run_keeping) def run_keeping(+rows: U32,input: Storage.Buffer,weights: Storage.Buffer,bias: Storage.Buffer, output: Storage.Buffer,+columns: U32,+inner: U32,+start: U32,+output_columns: U32) -> Kept: KernelGemmBuffer.reorder (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_gemm_buffer.bend&name=reorder) def reorder(+rows: U32,+inner: U32,weights: Storage.Buffer) -> Storage.Buffer: KernelPackingBuffer.buffers (https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_packing_buffer.bend&name=buffers) def buffers(input_length: Nat,output_length: Nat,result: Array & Array, certificates: TraversalCertificate.Certificates,Tile.Tile8,Certificate.family(~F32),result>) -> Storage.Buffer & Storage.Buffer: More: https://jend.leeeet.dev/packages/stelliferous.txt?definitions_offset=100