tilelang.carver.template.elementwise module#

class tilelang.carver.template.elementwise.ElementwiseTemplate(shape: Optional[List[int]] = None, dtype: str = 'float16')#

Bases: BaseTemplate

A template for element-wise operations using TVM.

shape#

The shape of the tensor.

Type:

List[int]

dtype#

The data type of the tensor (default: “float16”).

Type:

str

property class_attributes#

Returns class attributes as a dictionary.

Returns:

A dictionary representation of the class attributes.

Return type:

dict

dtype: str = 'float16'#
get_hardware_aware_configs(arch: Optional[TileDevice] = None, topk: int = 10) List[Hint]#

Retrieves hardware-aware optimization configurations.

Parameters:
  • arch (TileDevice, optional) – The target hardware architecture.

  • topk (int, optional) – Number of top configurations to consider.

Returns:

A list of optimization hints for the given architecture.

Return type:

List[Hint]

initialize_function() None#

Initializes the element-wise computation function.

Defines a simple element-wise computation: B = A + 1, where A is an input tensor. The computation graph is built using TVM’s tensor expressions.

params_as_dict()#

Returns the parameters of the template as a dictionary.

Returns:

A dictionary containing shape and dtype.

Return type:

dict

shape: List[int] = None#