def sized

stelliferous@0.0.2.0 · tensor_band_schedule.bend:24

import stelliferous@0.0.2.0/tensor_band_schedule.bend as TensorBandSchedule
import Base
import stelliferous@0.0.2.0/tensor_band.bend as Bands
import stelliferous@0.0.2.0/kernel_cost.bend as Cost

24# The whole operation, not each leaf, must reach the grain: small leaves only
25# lengthen the runtime's rounds, which the region estimate already counts.
26def sized(geometry: Bands.Geometry,+workers: U32,element_ns: F32,config: Cost.Configuration,size: Size) -> Bool:
27  Bands.Geometry{batch,channels,height,width} = geometry
28  Cost.Configuration{mac,byte_ns,operation_ns,grain,wake} = config
29  Size{+leaves,rows,maximum} = size
30  +row_ns = (U32.to_f32(channels) * U32.to_f32(width) * element_ns : F32)
31  +total = (U32.to_f32(height) * row_ns : F32)
32  U32.is_eq(batch,1) && U32.is_lt(1,workers) && U32.is_lt(1,leaves) && U32.is_le(leaves,(U32.min(workers,858993459) * 5 : U32)) &&
33    F32.is_le(grain,total) &&
34    F32.is_lt((Cost.region_ns(workers,leaves,(U32.to_f32(maximum) * row_ns : F32)) + 2.0 * wake : F32),total)

Uses (18)

Used by (2)