cuda.tile.floordiv#

cuda.tile.floordiv(x, y, /)#

Elementwise floordiv on two tiles.

Can also use builtin operation x // y.

Supports both integer and floating-point operands. For float inputs, the result is floor(x / y) as a float (e.g. 5.5 // 2.2 == 2.0).

Parameters:
  • x (Tile) – LHS tile.

  • y (Tile) – RHS tile.

The shape of x and y will be broadcasted and dtype promoted to common dtype.

Return type:

Tile

Examples

tx = ct.full((4,), 7, dtype=ct.int32)
ty = ct.full((4,), 3, dtype=ct.int32)
tz = tx // ty
print(tz)
import cuda.tile as ct
import torch

@ct.kernel
def kernel():
    tx = ct.full((4,), 7, dtype=ct.int32)
    ty = ct.full((4,), 3, dtype=ct.int32)
    tz = tx // ty
    print(tz)


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

Output

[2, 2, 2, 2]