~/bend-docscommunity

tensor_band_pool.bend checks

raw source on the hub · import stelliferous@0.0.2.0/tensor_band_pool.bend as Tensor_band_pool

Each band leaf assembles the rows its outputs read into one contiguous window and runs the two sweeps of the dense pool on it: along the columns of every window row, then along the rows, with output row zero's window starting at the window row that the image row would. Sample order is the dense order.

11 imports
import Base
import ./tensor_access.bend as Access
import ./tensor_operations.bend as Operations
import ./tensor_band.bend as Bands
import ./tensor_band_window.bend as BandWindow
import ./traversal_partition.bend as Partition
import ./storage_buffer.bend as Storage
import ./tensor.bend as Tensors
import ./tensor_band_schedule.bend as BandSchedule
import ./kernel_cost.bend as Cost
import ./default_kernel_cost.bend as DefaultCost

Types

type Context source · line 18 · raw

@-Element:Data -> Data

Definitions

def window_size source · line 21 · raw

@window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.RowWindow -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_schedule.Size

def plan_size source · line 25 · raw

@layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @+window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_schedule.Size

def parallel source · line 37 · raw

@window:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @workers:U32 -> @size:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_schedule.Size -> Bool

Bytes price loading, storing and the loop that moves them (copy_byte_ns is measured on copy loops); operations count the rest. Per sample (Access.read_line and the operation): an offset and a subtraction, one bound check, a two-operation index, the padding select and the compare-and-select maximum: 8. Each line adds ten for its origin (Access.line_at). An output is one line along the rows; the lines along the columns are one for every window row, stride for every output row.

Templates

template pooled source · line 49 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @+pool:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_access.Pool -> @+pad:Element -> @origin:U32 -> @+channels:U32 -> @input:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @middle:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @output:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> 0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element>

The destination of the two sweeps of channels stored planes: along the columns into middle, [channels,height,out_width], then along the rows from origin into output.

template windowed source · line 58 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @+geometry:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Geometry -> @+pad:Element -> @+fill:Element -> @+first:U32 -> @+rows:U32 -> @+rows_read:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.RowWindow -> @core:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @above:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @below:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element)

template leaf source · line 69 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @context:Context<Element> -> @first:U32 -> @rows:U32 -> @core:0x9be3b13bf249759bc81e1958bcd1a4c0/storage_buffer.Buffer<Element> -> @halo:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Halo<Element> -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element)

template prepared source · line 76 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @+context:Context<Element> -> @+layout:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan -> @owners:Pair(0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element), 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band_window.Halos(Element)) -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element)

template planned source · line 83 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @+context:Context<Element> -> @owners:Pair(0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element), 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Plan) -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element)

template execute source · line 88 · raw

@-Element:Data -> @-operation:(@_:Element -> @_:Element -> Element) -> @context:Context<Element> -> @bands:0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element) -> 0x9be3b13bf249759bc81e1958bcd1a4c0/tensor_band.Bands(Element)