def range_leaf

stelliferous@0.0.2.0 · tensor_band.bend:300

import stelliferous@0.0.2.0/tensor_band.bend as TensorBand
import Base
import stelliferous@0.0.2.0/storage_buffer.bend as Storage

300# Repartition and halo extraction share this owned range reader. Empty
301# intersections copy zero elements; each source owner is returned unchanged.
302def range_leaf(~Element: Data,geometry: Geometry,+target_first: U32,+target_rows: U32,target_offset: U32,+first: U32,+rows: U32,
303  source: Storage.Buffer<Element>,output: Storage.Buffer<Element>) -> Bands(~Element) & Storage.Buffer<Element>:
304  Geometry{batch,channels,height,+width} = geometry
305  +begin = U32.max(first,target_first)
306  +end = U32.max(begin,U32.min((first + rows : U32),(target_first + target_rows : U32)))
307  range_result(~Element,first,rows,range_planes(~Element,U32.is_eq(begin,end),channels,((end - begin) * width : U32),
308    (rows * width : U32),(target_rows * width : U32),((begin - first) * width : U32),(target_offset + (begin - target_first) * width : U32),(source,output)))

Uses (14)

Used by (2)