tilelang.tools.Analyzer module#

class tilelang.tools.Analyzer.AnalysisResult(total_flops: int, total_global_bytes: int, estimated_time: float, expected_tflops: float, expected_bandwidth_GBps: float)#

Bases: object

A data class to store the results of the analysis. .. attribute:: total_flops

Total floating-point operations.

type:

int

total_global_bytes#

Total bytes transferred to/from global memory.

Type:

int

estimated_time#

Estimated execution time (seconds).

Type:

float

tflops#

Achieved TFLOPS (trillions of FLOPs per second).

bandwidth_GBps#

Achieved memory bandwidth in GB/s.

estimated_time: float#
expected_bandwidth_GBps: float#
expected_tflops: float#
total_flops: int#
total_global_bytes: int#
class tilelang.tools.Analyzer.Analyzer(fn, device)#

Bases: object

A class to analyze the performance of a TVM IR module. It calculates metrics such as FLOPs, memory bandwidth, and estimated execution time.

classmethod analysis(fn, device)#

Perform a full analysis of the given IR module or PrimFunc. :param fn: A TVM IRModule or PrimFunc to analyze. :param device: The target device information.

Returns:

The calculated performance metrics.

Return type:

AnalysisResult

calculate() AnalysisResult#

Calculate performance metrics based on the analysis. :returns: The calculated performance metrics. :rtype: AnalysisResult

ir_pass()#

Traverse and transform the IR module to extract performance-related information. :returns: The Analyzer instance. :rtype: self