Memref stream interleave
memref_stream_interleave
¶
IndexAndFactor
¶
Bases: NamedTuple
Helper data structure holding an option for which index of a memref_stream.generic
operation to interleave and with which factor.
Source code in xdsl/transforms/memref_stream_interleave.py
iterator_index: int
instance-attribute
¶
factor: int
instance-attribute
¶
choose(indices_and_factors: Sequence[IndexAndFactor], pipeline_depth: int) -> IndexAndFactor | None
staticmethod
¶
A heuristic to choose the interleave index and factor automatically given the pipeline depth of floating-point operations on the processor. The higher the factor chosen, the higher the instruction-level parallelism, but also the more registers need to be used at the same time, potentially leading to spilling.
Source code in xdsl/transforms/memref_stream_interleave.py
PipelineGenericPattern
dataclass
¶
Bases: RewritePattern
Source code in xdsl/transforms/memref_stream_interleave.py
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 110 111 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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
pipeline_depth: int
instance-attribute
¶
iterator_index: int | None = field(default=None)
class-attribute
instance-attribute
¶
unroll_factor: int | None = field(default=None)
class-attribute
instance-attribute
¶
__init__(pipeline_depth: int, iterator_index: int | None = None, unroll_factor: int | None = None) -> None
¶
indices_and_factors(op: memref_stream.GenericOp) -> tuple[IndexAndFactor, ...]
staticmethod
¶
Given a memref_stream.generic operation, returns all the possible options for
unrolling.
Source code in xdsl/transforms/memref_stream_interleave.py
match_and_rewrite(op: memref_stream.GenericOp, rewriter: PatternRewriter) -> None
¶
Source code in xdsl/transforms/memref_stream_interleave.py
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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
MemRefStreamInterleavePass
dataclass
¶
Bases: ModulePass
Tiles the innermost parallel dimension of a memref_stream.generic.
If specified, the pipeline-depth parameter specifies the number of operations in the
resulting body that should be executed concurrently.
The pass will select the largest factor of the corresponding bound smaller than
pipeline-depth * 2.
The search range is bound by pipeline-depth * 2 as very large interleaving factors
can increase register pressure and potentially exhaust all available registers.
In the future, it would be good to take the number of available registers into account
when choosing a search range, as well as inspecting the generic body for
read-after-write dependencies.
Source code in xdsl/transforms/memref_stream_interleave.py
name = 'memref-stream-interleave'
class-attribute
instance-attribute
¶
pipeline_depth: int = field(default=4)
class-attribute
instance-attribute
¶
op_index: int | None = field(default=None)
class-attribute
instance-attribute
¶
iterator_index: int | None = field(default=None)
class-attribute
instance-attribute
¶
unroll_factor: int | None = field(default=None)
class-attribute
instance-attribute
¶
__init__(pipeline_depth: int = 4, op_index: int | None = None, iterator_index: int | None = None, unroll_factor: int | None = None) -> None
¶
apply(ctx: Context, op: ModuleOp) -> None
¶
Source code in xdsl/transforms/memref_stream_interleave.py
schedule_space(ctx: Context, module_op: ModuleOp)
classmethod
¶
Source code in xdsl/transforms/memref_stream_interleave.py
factors(num: int) -> tuple[int, ...]
¶
For all positive integers, returns the n-tuple of all numbers that evenly divide the input, returns an empty tuple for 0 or negative inputs.