Block throughput cost model
block_throughput_cost_model
¶
This module defines an abstract base class BlockThroughputCostModel for estimating the
throughput of a given Block.
It includes a concrete implementation, MCABlockThroughputCostModel, that uses
the llvm-mca tool to perform this estimation.
BlockThroughputCostModel
¶
Bases: ABC
An abstract base class for a throughput cost model.
This class provides an interface for estimating the throughput of a block of assembly-like operations for a specific microarchitecture.
Source code in xdsl/backend/block_throughput_cost_model.py
estimate_throughput(block: Block) -> float | None
abstractmethod
¶
Estimates the throughput of a block of assembly-like operations.
Throughput is defined as the number of cycles per iteration of a block. The throughput value gives an indication of the performance of the block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
Block
|
The block of operations to analyze. |
required |
Returns:
| Type | Description |
|---|---|
float | None
|
The estimated throughput as a float, or None if the estimation fails. |
Source code in xdsl/backend/block_throughput_cost_model.py
ExternalBlockThroughputCostModel
¶
Bases: BlockThroughputCostModel
An abstract base class for throughput cost models that use external command-line tools.
This class extends BlockThroughputCostModel and provides common functionality
for models that rely on an external command-line tool to produce a report
from a source file. Subclasses must implement methods to define the command
to run (cmd) and name (tool_name), and to parse the tool's output (process_report).
Source code in xdsl/backend/block_throughput_cost_model.py
src_path: str
instance-attribute
¶
target: str = target
instance-attribute
¶
The target triple.
arch: str = arch
instance-attribute
¶
The architecture name of the target.
__init__(*, target: str, arch: str)
¶
tool_name() -> str
abstractmethod
classmethod
¶
cmd() -> list[str]
abstractmethod
¶
produce_report() -> str
¶
Source code in xdsl/backend/block_throughput_cost_model.py
process_report(report: str) -> float | None
abstractmethod
¶
is_installed() -> bool
classmethod
¶
is_available() -> bool
¶
Source code in xdsl/backend/block_throughput_cost_model.py
estimate_throughput(block: Block) -> float | None
¶
Source code in xdsl/backend/block_throughput_cost_model.py
MCABlockThroughputCostModel
¶
Bases: ExternalBlockThroughputCostModel
A throughput cost model that uses the llvm-mca tool.