cuda.tile.assert_#

cuda.tile.assert_(cond, /, message=None)#

Assert that all elements of the given tile are True.

Parameters:
  • cond (Tile) – Boolean tile.

  • message (str) – Message to print if condition is false.

Notes

This operation has significant overhead, and should only be used for debugging purpose.

Examples

tile = ct.full((4,), 5, dtype=ct.int32)
ct.assert_(tile > 0)
print("assertion passed")
import cuda.tile as ct
import torch

@ct.kernel
def kernel():
    tile = ct.full((4,), 5, dtype=ct.int32)
    ct.assert_(tile > 0)
    print("assertion passed")


torch.cuda.init()
ct.launch(torch.cuda.current_stream(), (1,), kernel, ())
torch.cuda.synchronize()

Output

assertion passed