warp.tile_scan_exclusive#

warp.tile_scan_exclusive(
a: Tile[Scalar, tuple[int, ...]],
) Tile[Scalar, tuple[int, ...]]#
  • Kernel

Exclusive scan (prefix sum) across the tile.

This function cooperatively performs an exclusive scan (cumulative sum) across the tile.

param a:

The input tile. Must be a tile of type float32, int32, or uint32.

returns:

A new tile containing the exclusive scan result.

Example:

@wp.kernel
def scan_example():
    t = wp.tile_arange(1, 5, dtype=int)
    s = wp.tile_scan_exclusive(t)
    print(s)

wp.launch_tiled(scan_example, dim=[1], inputs=[], block_dim=16)

Prints:

[0, 1, 3, 6] = tile(shape=(4), storage=register)