warp.tile_full#
- warp.tile_full( ) Tile[Any, tuple[int, ...]]#
Allocate a tile filled with the specified value.
Every element is initialized with
value. Omittingdtypegives a tile whose element type is the type ofvalue. Whendtypeis provided, a scalarvalueis converted to it; a composite or Warp structvaluemust already have that type.- Parameters:
shape – Shape of the output tile. Must be a compile-time constant.
value – Value to fill the tile with.
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 tile with the requested shape and data type filled with
value.
Example
@wp.kernel def clamp_below(x: wp.array[float], out: wp.array[float]): lo = wp.tile_full(shape=(4,), value=2.0, dtype=float) t = wp.tile_load(x, shape=(4,)) wp.tile_store(out, wp.tile_map(wp.max, t, lo)) x = wp.array([1.0, 2.0, 3.0, 4.0], dtype=float) out = wp.zeros(4, dtype=float) wp.launch_tiled(clamp_below, dim=1, inputs=[x], outputs=[out], block_dim=2) print(out.numpy())
[2. 2. 3. 4.]