cuda.tile.bid#
- cuda.tile.bid(axis)#
Gets the index of current block.
- Parameters:
axis (const int) – The axis of the block index space. Possible values are 0, 1, 2.
- Return type:
int32
Examples
bidx = ct.bid(0) bidy = ct.bid(1) bidz = ct.bid(2) print(f"Hello from block ({bidx}, {bidy}, {bidz})")
import cuda.tile as ct import torch @ct.kernel def kernel(): bidx = ct.bid(0) bidy = ct.bid(1) bidz = ct.bid(2) print(f"Hello from block ({bidx}, {bidy}, {bidz})") torch.cuda.init() ct.launch(torch.cuda.current_stream(), (1,), kernel, ()) torch.cuda.synchronize()
Output
Hello from block (0, 0, 0)