warp.tile_zeros#
- warp.tile_zeros( ) Tile[Any, tuple[int, ...]]#
Allocate a tile of zero-initialized items.
Every element is set to the zero value of
dtype. Scalar, vector, matrix, and Warp struct element types are all zero-filled component-wise.- Parameters:
shape – Shape of the output tile. Must be a compile-time constant.
dtype – Data type of output tile’s elements. Must be a compile-time constant.
storage – The storage location for the tile:
"register"for registers or"shared"for shared memory. Must be a compile-time constant.
- Returns:
A zero-initialized tile with the requested shape and data type.
Example
@wp.kernel def add_tiles(a: wp.array[float], b: wp.array[float], out: wp.array[float]): total = wp.tile_zeros(shape=(4,), dtype=float) total += wp.tile_load(a, shape=(4,)) total += wp.tile_load(b, shape=(4,)) wp.tile_store(out, total) a = wp.array([1.0, 2.0, 3.0, 4.0], dtype=float) b = wp.array([10.0, 20.0, 30.0, 40.0], dtype=float) out = wp.zeros(4, dtype=float) wp.launch_tiled(add_tiles, dim=1, inputs=[a, b], outputs=[out], block_dim=2) print(out.numpy())
[11. 22. 33. 44.]