warp.launch_tiled#

warp.launch_tiled(*args, **kwargs)[source]#

A helper method for launching a grid with an extra trailing dimension equal to the block size.

For example, to launch a 2D grid, where each element has 64 threads assigned you would use the following:

warp.launch_tiled(kernel, [M, N], inputs=[...], block_dim=64)

Which is equivalent to the following:

warp.launch(kernel, [M, N, 64], inputs=[...], block_dim=64)

Inside your kernel code you can retrieve the first two indices of the thread as usual, ignoring the implicit third dimension if desired:

@warp.kernel
def compute()

    i, j = warp.tid()

    ...

The required block_dim argument is appended to the launch dimensions. On CPU, values from 2 through 1024 are effective only when warp.config.enable_cpu_blocks is True; otherwise they resolve to 1. None and non-positive values select the per-device default.