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
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
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
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
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)
Source code in xdsl/backend/block_throughput_cost_model.py
64 65 66 | |
tool_name() -> str
abstractmethod
classmethod
Source code in xdsl/backend/block_throughput_cost_model.py
68 69 70 71 | |
cmd() -> list[str]
abstractmethod
Source code in xdsl/backend/block_throughput_cost_model.py
73 74 75 | |
produce_report() -> str
Source code in xdsl/backend/block_throughput_cost_model.py
77 78 79 80 81 82 83 84 | |
process_report(report: str) -> float | None
abstractmethod
Source code in xdsl/backend/block_throughput_cost_model.py
86 87 88 | |
is_installed() -> bool
classmethod
Source code in xdsl/backend/block_throughput_cost_model.py
90 91 92 | |
estimate_throughput(block: Block) -> float | None
Source code in xdsl/backend/block_throughput_cost_model.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
MCABlockThroughputCostModel
Bases: ExternalBlockThroughputCostModel
A throughput cost model that uses the llvm-mca tool.
Source code in xdsl/backend/block_throughput_cost_model.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
tool_name() -> str
classmethod
Source code in xdsl/backend/block_throughput_cost_model.py
117 118 119 | |
cmd() -> list[str]
Source code in xdsl/backend/block_throughput_cost_model.py
121 122 123 124 125 126 127 | |
process_report(report: str) -> float | None
Source code in xdsl/backend/block_throughput_cost_model.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |