tilelang.cpu.language.kernel¶

CPU dialect of T.Kernel: the common launch plus CPU launch annotations.

Functions¶

Kernel(*blocks[, prelude, cpu_num_threads])

Construct a kernel launch frame for CPU: a grid of tile programs.

Module Contents¶

tilelang.cpu.language.kernel.Kernel(*blocks, prelude=None, cpu_num_threads=None)¶

Construct a kernel launch frame for CPU: a grid of tile programs.

The grid becomes the outer loop nest of the generated function and each tile program runs as a plain serial body; T.Parallel loops are lowered to serial loops. There are no SIMT threads, so this dialect has no threads and T.get_thread_binding() is rejected at compile time.

Parameters:
  • *blocks (int | PrimExpr) – Grid extent along each axis (1-3 dimensions). The launch yields one program index per axis.

  • prelude (str, optional) – C source injected before the generated kernel, e.g. #include lines or helper functions.

  • cpu_num_threads (int, optional) – OpenMP thread count for the grid parallel region when the tl.cpu_parallel pass config is enabled: emitted as the num_threads(n) clause. None (default) omits the clause and lets the OpenMP runtime pick the thread count (e.g. from OMP_NUM_THREADS). Only the c target consumes it — on the llvm target it has no effect, since that path lowers to TVMBackendParallelLaunch and uses TVM’s own thread pool.

Return type:

tilelang.language.kernel.KernelLaunchFrame

Examples

with T.Kernel(T.ceildiv(N, 128)) as bx:
    for i in T.Parallel(128):
        ...