hespas.mlir_parser.mlir_analyzer
Functions
|
Main function to parse command-line arguments and run MLIR analysis. |
Classes
|
A class for analyzing MLIR (Multi-Level Intermediate Representation) code. |
- class hespas.mlir_parser.mlir_analyzer.MLIRAnalyzer(*, mlir_string=None, mlir_path=None, mlir_module=None, input_sensitive=False, format='table')
Bases:
MLIRParserA class for analyzing MLIR (Multi-Level Intermediate Representation) code. It can count unique operators, total operators, and generate a histogram of operator frequencies.
- __init__(*, mlir_string=None, mlir_path=None, mlir_module=None, input_sensitive=False, format='table')
Initializes the MLIRAnalyzer with an MLIR string or file path.
- Args:
mlir_input (str): The MLIR code as a string or the path to an MLIR file. input_sensitive (bool): Consider the inputs as part of the operator while considering uniqueness format (str): Output format for printing results (‘table’ or ‘csv’).
- count_unique_operators(expand_func_calls=True)
Counts the number of unique operators in the MLIR code.
- Args:
expand_func_calls (bool): Whether to use expanded operators or not
- Returns:
int: The number of unique operators.
- total_number_of_operators(expand_func_calls=True)
Counts the total number of operators in the MLIR code.
- Returns:
int: The total number of operators.
- histogram_of_operators(expand_func_calls=True)
Generates a histogram (dictionary) of operator frequencies.
- Returns:
dict: A dictionary where keys are operators and values are their counts.
- update(other_analyzer)
Updates the current analyzer’s operator list with operators from another MLIRAnalyzer instance.
- Args:
other_analyzer (MLIRAnalyzer): Another MLIRAnalyzer instance.
- property op_count
- property op_count_expanded
- property op_count_and_expanded
- property operators
- property operators_expanded
- static get_op_key(operation, input_sensitive)
- get_operator_counts()
- get_expanded_operator_counts(operation, operator_name)
- get_expanded_operator_counts_list(operations)
- to_str(expand=True)
Prints the MLIR statistics in a formatted way.
- hespas.mlir_parser.mlir_analyzer.main()
Main function to parse command-line arguments and run MLIR analysis.