tilelang.jit.adapter.cython.adapter¶
The profiler and convert to torch utils
Attributes¶
Classes¶
Adapter class that converts TVM/TIR functions to callable CUDA kernels using cython. |
Functions¶
|
Check if the expression is a symbolic expression. |
Module Contents¶
- tilelang.jit.adapter.cython.adapter.logger¶
- tilelang.jit.adapter.cython.adapter.is_symbolic_expr(expr)¶
Check if the expression is a symbolic expression. A symbolic expression can be a simple tvm.Var, or an tvm.PrimExpr containing tvm.Var.
- Return type:
- class tilelang.jit.adapter.cython.adapter.CythonKernelAdapter(params, result_idx, target, func_or_mod, host_mod=None, device_mod=None, kernel_global_source=None, verbose=False, pass_configs=None, compile_flags=None)¶
Bases:
tilelang.jit.adapter.base.BaseKernelAdapterAdapter class that converts TVM/TIR functions to callable CUDA kernels using cython.
This adapter handles: 1. Converting TIR functions to compiled CUDA libraries 2. Managing dynamic shapes in tensor operations 3. Wrapping C++ kernels for Python/PyTorch usage
- Parameters:
params (list[tilelang.engine.param.KernelParam])
result_idx (list[int])
target (str | tvm.target.Target)
func_or_mod (tvm.tir.PrimFunc | tilelang.tvm.IRModule)
host_mod (tilelang.tvm.IRModule | None)
device_mod (tilelang.tvm.IRModule | None)
kernel_global_source (str | None)
verbose (bool)
pass_configs (dict[str, Any] | None)
compile_flags (list[str] | None)
- target: str | tvm.target.Target = 'cuda'¶
- ir_module: tilelang.tvm.IRModule | None = None¶
- kernel_global_source: str | None = None¶
- lib: ctypes.CDLL | None = None¶
- wrapped_source: str | None = None¶
- dynamic_symbolic_map: dict[tvm.tir.Var, tuple[int, int]] | None = None¶
- ptr_map: dict[int, str] | None = None¶
- buffer_dtype_map: dict[tvm.tir.Var, tuple[int, torch.dtype]] | None = None¶
- static_shape_map: dict[tvm.tir.Var, tuple[int, list[tuple[int, int]]]] | None = None¶
- static_strides_map: dict[tvm.tir.Var, tuple[int, list[tuple[int, int]]]] | None = None¶
- static_contiguous_list: list[tvm.tir.Var] | None = None¶
- buffer_device_map: dict[tvm.tir.Var, tuple[int, torch.device]] | None = None¶
- pass_configs: dict[str, Any] | None = None¶
- params¶
- result_idx¶
- verbose = False¶
- wrapper¶
- lib_generator¶
- cython_wrapper¶
- classmethod from_database(params, result_idx, target, func_or_mod, kernel_global_source, kernel_lib_path, verbose=False, pass_configs=None, compile_flags=None)¶
- Parameters:
params (list[tvm.relax.TensorType])
result_idx (list[int])
target (str)
func_or_mod (tvm.tir.PrimFunc | tilelang.tvm.IRModule)
kernel_global_source (str)
kernel_lib_path (str)
verbose (bool)
pass_configs (dict[str, Any] | None)
compile_flags (list[str] | None)
- property prim_func: tvm.tir.PrimFunc¶
Returns the primary TIR function from the IR module.
- Return type:
tvm.tir.PrimFunc
- property srcpath¶
Returns the source path of the compiled library.
- property libpath¶
Returns the path to the compiled library.
- property lib_code¶
Returns the code of the compiled library.
- property is_dynamic¶
Indicates whether the kernel handles dynamic shapes.