Mojo module
functional
Implements higher-order functions.
You can import these APIs from the algorithm
package. For example:
from algorithm import map
Aliases
-
BinaryTile1DTileUnitFunc = fn[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 = 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 = fn[Bool](Int, Int, Int) capturing -> None
: -
Static1DTileUnitFunc = fn[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 = fn[Int, Bool](Int) capturing -> None
: -
Static1DTileUnitFuncWithFlags = fn[Int, Bool, Bool](Int) capturing -> None
: -
Static1DTileUnswitchUnitFunc = fn[Int, 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 = fn[Int, 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) -
SwitchedFunction = fn[Bool]() capturing -> None
: -
SwitchedFunction2 = fn[Bool, 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. -
stencil
: Computes stencil operation in parallel. -
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_width
at each step. The remainder ofsize % simd_width
will run in separate iterations.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
😔 What went wrong?