loop_cost_models
LoopBasis
¶
A basis where each loop prefix, including the empty prefix, is a component, as prefixes yields them, and get_component_features returns one row for each prefix. Models used with branch-and-bound loop search must predict nonnegative component costs.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
LoopSpaces
¶
Bases: Generic[NS]
The spaces of the last loop of a nonempty loop prefix: where it is entered, what it visits, and where its walks step, from the stats of the tables it merges, restricted as their formats and protocols allow, as unrestricted says. A table whose formats the prefix doesn't list is taken to be sparse, and a table without protocols walks the field of the loop.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
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 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
extent(stat, fields)
¶
The points of stat over fields, spanning all of those it lacks.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
located(stat, fields)
¶
The distinct points of stat at fields: the positions of a level of those fields which the loop reaches in stat, however often it runs.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
merged(node, fields=())
¶
Where a merge of the inputs of node visits parent and fields: where every fiber it merges has positions, as the formats give them.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
project(stat, fields=(), followed=())
¶
The support of stat over parent and fields, less the fields of followed, which it spans wholly.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
protocol(node)
¶
The protocol node reads the field of the loop with.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
stepped(table)
¶
The entries of table at idx which a walk of it steps through: those where the merge steps, since it steps through nothing where another fiber it merges has no positions.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
unrestricted(table, fields)
¶
The fields of fields which table doesn't restrict: the field of the loop where table follows it, since it is looked up wherever the others go, and those of the dense levels down to the deepest level of the rest, from the sparse level above them, which have a fiber at every slot of it, so the positions of the level are the entries of the sparse one, at every slot of the dense ones.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
visited()
¶
Where the loop visits idx, which its walks and gallops restrict.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
PigeonBasis
¶
Bases: LoopBasis, LoopOrderedForm
PigeonBasis counts iteration, operation, output, lookup, and dense iteration costs across loop prefixes. The empty prefix charges the non-fill values of the output once, and a nonempty prefix charges its last loop: a walk steps through the stored indices of its table, a gallop or a follow instead visits the indices where the expression runs, charging a lookup at each, and the dense iterations of a loop are those it would make if its tables were dense, so that none could restrict it: its whole extent, wherever its enclosing loops run.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
Prefix
dataclass
¶
An outermost-first loop prefix of expr, the right-hand side of a query. output_vars orders the output of the query, when there is one, and output is the tensor it writes. formats, which bases that price formatted tensors need, lists the level options each alias stores, outermost first, as level_formats lists them.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
TransposeBasis
¶
Bases: LoopBasis, LoopOrderedForm
Count dense and sparse transposed entries, charging each input once per query, at the first prefix whose last loop reads it out of its stored order.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
prefixes(term, machine, loop_order=(), formats=None)
¶
The loop prefixes of each query of term, including the empty prefix, in query order and from the shortest to the longest, advancing machine past each query after its prefixes. The loop order of a query is the fields of its enclosing Fuse nodes.
Source code in src/finch/autoschedule/cost_models/loop_cost_models.py
restrict(stats_factory, stat, fields)
¶
The support of stat over fields, reducing the rest away.