Skip to main content

module

functional

Implements higher-order functions.

You can import these APIs from the algorithm package. For example:

from algorithm import map

Aliases

  • 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)
  • 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)
  • 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.
  • 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:
  • 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)
  • Static1DTileUnitFuncWithFlag = fn[Int, Bool](Int, /) capturing -> None:
  • Dynamic1DTileUnswitchUnitFunc = fn[Bool](Int, Int, Int, /) capturing -> None:
  • Static1DTileUnitFuncWithFlags = fn[Int, Bool, Bool](Int, /) capturing -> None:

Functions

  • map: Maps a function over a range from 0 to size.
  • vectorize: Simplifies SIMD optimized loops by mapping a function across a range from 0 to size, incrementing by simd_width at each step. The remainder of size % simd_width will run in separate iterations.
  • sync_parallelize: Executes func(0) ... func(num_work_items-1) as parallel sub-tasks, and returns when all are complete.
  • parallelize: Executes func(0) ... func(N-1) as sub-tasks in parallel, and returns when all are complete. N is chosen to be the number of processors on the system.
  • tile: A generator that launches work groups in specified list of tile sizes.
  • unswitch: Performs a functional unswitch transformation.
  • 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.
  • elementwise: Executes func[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.
  • parallelize_over_rows: Parallelize func over non-axis dims of shape.
  • stencil: Computes stencil operation in parallel.