cuda.tile.print#

cuda.tile.print(*args, sep=' ', end='\n')#

Print values at runtime from the device using Python-style syntax.

Supports Python f-strings and positional arguments similar to Python’s built-in print() function.

Parameters:
  • *args – Values to print. Each argument can be: - A string literal or f-string - A tile value (format inferred from dtype: int→``%d``, float→``%f``)

  • sep (str) – Separator inserted between arguments (default: ' ')

  • end (str) – String appended after the last argument (default: '\n')

Examples

tile = ct.full((), 42, dtype=ct.int32)
ct.print(f"value={tile}")
print(f"value={tile}")
import cuda.tile as ct
import torch

@ct.kernel
def kernel():
    tile = ct.full((), 42, dtype=ct.int32)
    ct.print(f"value={tile}")
    print(f"value={tile}")


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

Output

value=42
value=42

Notes

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

F-string expressions must evaluate to tile values. Constant compile-time values are supported as string-formatted segments.