tilelang.language.print module#
This module provides macros and utilities for debugging TileLang (tl) programs. It includes functionality to print variables, print values in buffers, and conditionally execute debug prints.
- tilelang.language.print.print(obj: Any, msg: str = '', warp_group_id: int = 0, warp_id: int = 0) PrimExpr #
A generic print function that handles both TIR buffers and primitive expressions.
If the input is a TIR buffer, it prints its values, but only on the first thread (tx=0, ty=0, tz=0).
If the input is a TIR primitive expression, it prints its value directly.
- Parameters:
obj (Any) – The object to print. It can be either a tir.Buffer or tir.PrimExpr.
msg (str) – An optional message to include in the print statement.
warp_group_id (int) – The warp group id to print.
warp_id (int) – The warp id to print.
warp_id. (print thread will be warp_group_id * warp_group_size +) –
- Returns:
The TIR expression for the debug print operation.
- Return type:
tir.PrimExpr
- Raises:
ValueError – If the input object type is unsupported.