Mojo module
functional
Implements higher-order functions.
You can import these APIs from the algorithm package. For example:
from algorithm import mapAliases
BinaryTile1DTileUnitFunc
alias BinaryTile1DTileUnitFunc = fn[width: Int](Int, Int) capturing -> None
Signature of a tiled function that performs some work with a dynamic tile size and a secondary static tile size.
Dynamic1DTileUnitFunc
alias Dynamic1DTileUnitFunc = fn(Int, Int) capturing -> None
Signature of a 1d tiled function that performs some work with a dynamic tile size and an offset. i.e. func(offset: Int, tile_size: Int)
Dynamic1DTileUnswitchUnitFunc
alias Dynamic1DTileUnswitchUnitFunc = fn[sw: Bool](Int, Int, Int) capturing -> None
Static1DTileUnitFunc
alias Static1DTileUnitFunc = fn[width: Int](Int) capturing -> None
Signature of a 1d tiled function that performs some work with a static tile size and an offset. i.e. func<tile_size: Int> (offset: Int)
Static1DTileUnitFuncWithFlag
alias Static1DTileUnitFuncWithFlag = fn[width: Int, flag: Bool](Int) capturing -> None
Static1DTileUnitFuncWithFlags
alias Static1DTileUnitFuncWithFlags = fn[width: Int, left_flag: Bool, right_flag: Bool](Int) capturing -> None
Static1DTileUnswitchUnitFunc
alias Static1DTileUnswitchUnitFunc = fn[width: Int, sw: Bool](Int, Int) capturing -> None
Signature of a tiled function that performs some work with a static tile size and an offset. i.e. func<tile_size: Int> (offset: Int)
Static2DTileUnitFunc
alias Static2DTileUnitFunc = fn[tile_x: Int, tile_y: Int](Int, Int) capturing -> None
Signature of a 2d tiled function that performs some work with a static tile size and an offset. i.e. func<tile_size_x: Int, tile_size_y: Int> (offset_x: Int, offset_y: Int)
stencil
alias stencil = _stencil_impl_cpu
stencil_gpu
alias stencil_gpu = _stencil_impl_gpu
SwitchedFunction
alias SwitchedFunction = fn[sw: Bool]() raises capturing -> None
SwitchedFunction2
alias SwitchedFunction2 = fn[sw0: Bool, sw1: Bool]() capturing -> None
Functions
- elementwise: Executesfunc[width, rank](indices), possibly as sub-tasks, for a suitable combination of width and indices so as to cover shape. Returns when all sub-tasks have completed.
- map: Maps a function over a range from 0 to size.
- parallelize: Executes func(0) ... func(num_work_items-1) as sub-tasks in parallel, and returns when all are complete.
- parallelize_over_rows: Parallelize func over non-axis dims of shape.
- sync_parallelize: Executes func(0) ... func(num_work_items-1) as parallel sub-tasks, and returns when all are complete.
- tile: A generator that launches work groups in specified list of tile sizes.
- tile_and_unswitch: Performs time and unswitch functional transformation.
- tile_middle_unswitch_boundaries: Divides 1d iteration space into three parts and tiles them with different steps.
- unswitch: Performs a functional unswitch transformation.
- vectorize: Simplifies SIMD optimized loops by mapping a function across a range from 0 tosize, incrementing bysimd_widthat each step. The remainder ofsize % simd_widthwill run in separate iterations.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
