tilelang.jit.adapter.base¶

The profiler and convert to torch utils

Classes¶

BaseKernelAdapter

Helper class that provides a standard way to create an ABC using

Module Contents¶

class tilelang.jit.adapter.base.BaseKernelAdapter(mod, params, result_idx)¶

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

Parameters:
func: Callable | None = None¶
mod¶
params¶
result_idx¶
static get_current_stream_functor()¶

Return a callable that reads Torch’s current CUDA stream pointer.

The returned lambda yields the raw CUDA stream handle of the current PyTorch stream on the active device. It’s a thunk (evaluated at call time) so that any upstream stream guards are respected. If CUDA is unavailable, it returns a lambda that yields 0.

Return type:

Callable[[], int]

static get_current_device_functor()¶

Return a callable that yields Torch’s current device.

Similar to the stream functor, we capture a callable that, when called, fetches the current device according to PyTorch. On CPU or when CUDA is unavailable, returns torch.device('cpu').

Return type:

Callable[[], torch.device]

__call__(*args, **kwds)¶
Parameters:
  • args (Any)

  • kwds (Any)

Return type:

Any

get_kernel_source(kernel_only=True)¶
Parameters:

kernel_only (bool)

Return type:

str