cuda.tile.assume_divisible_by#
- cuda.tile.assume_divisible_by(x, divisor)#
Declares that
xis divisible bydivisor.The caller is responsible for the correctness of the claim; behavior is undefined if
xis not actually divisible bydivisorat runtime.- Parameters:
x (int | float | ScalarProtocol) – An integer scalar.
divisor (const int) – The assumed divisor. Must be a positive integer constant.
- Returns:
An integer scalar.
xvalue unchanged.- Return type:
int | float | ScalarProtocol
Examples
n = ct.bid(0) + 128 n = ct.assume_divisible_by(n, 128) print(n)
import cuda.tile as ct import torch @ct.kernel def kernel(): n = ct.bid(0) + 128 n = ct.assume_divisible_by(n, 128) print(n) torch.cuda.init() ct.launch(torch.cuda.current_stream(), (1,), kernel, ()) torch.cuda.synchronize()
Output
128