tilelang.carver.template.base

類別

BaseTemplate

Base class template for hardware-aware configurations.

Module Contents

class tilelang.carver.template.base.BaseTemplate

Bases: abc.ABC

Base class template for hardware-aware configurations. This serves as an abstract base class (ABC) that defines the structure for subclasses implementing hardware-specific optimizations.

abstractmethod get_hardware_aware_configs(arch=None, topk=10)

Abstract method that must be implemented by subclasses. It should return a list of hardware-aware configurations (hints) based on the specified architecture.

參數:
  • arch (TileDevice, optional) -- The target architecture. Defaults to None.

  • topk (int, optional) -- Number of top configurations to return. Defaults to 10.

回傳:

A list of recommended hardware-aware configurations.

回傳型別:

List[Hint]

with_arch(arch)

Sets the architecture for this template and returns itself.

參數:

arch (TileDevice) -- The architecture to set.

回傳:

The instance with the updated architecture.

回傳型別:

BaseTemplate

has_arch()

Checks whether the architecture is set.

回傳:

True if the architecture is set, False otherwise.

回傳型別:

bool

is_volta_arch()

Checks if the current architecture is a Volta architecture.

回傳:

True if the architecture is Volta, False otherwise.

回傳型別:

bool

is_ampere_arch()

Checks if the current architecture is an Ampere architecture.

回傳:

True if the architecture is Ampere, False otherwise.

回傳型別:

bool

is_cdna_arch()

Checks if the current architecture is a CDNA architecture.

回傳:

True if the architecture is CDNA, False otherwise.

回傳型別:

bool

equivalent_function()

Returns the function associated with this template.

回傳:

The stored function.

回傳型別:

PrimFunc

abstractmethod initialize_function()

Placeholder method that should be implemented by subclasses. This method is responsible for initializing the function.

引發:

NotImplementedError -- If not implemented in the subclass.

回傳型別:

None

set_function(func)

Sets the function for this template and returns itself.

參數:

func (PrimFunc) -- The function to associate with this template.

回傳:

The instance with the updated function.

回傳型別:

BaseTemplate

set_output_nodes(output_nodes)

Sets the output nodes for this template and returns itself.

參數:

output_nodes (List[OutputNode]) -- The output nodes to associate with this template.

回傳:

The instance with the updated output nodes.

回傳型別:

BaseTemplate

recommend_hints(topk=10)

Provides a list of recommended hardware-aware configurations.

參數:

topk (int, optional) -- Number of top configurations to return. Defaults to 10.

回傳:

A list of recommended configurations.

回傳型別:

List[Hint]

property arch: tilelang.carver.arch.TileDevice

Returns the current architecture.

回傳:

The architecture of this template.

回傳型別:

TileDevice

property output_nodes: list[tilelang.carver.roller.node.OutputNode]

Returns the output nodes associated with this template.

回傳:

The output nodes.

回傳型別:

List[OutputNode]

__post_init__()

Post-initialization method that is called after the data class is created. Ensures that the function is initialized.