cuda.tile.assume_divisible_by#

cuda.tile.assume_divisible_by(x, divisor)#

Declares that x is divisible by divisor.

The caller is responsible for the correctness of the claim; behavior is undefined if x is not actually divisible by divisor at 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. x value 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