protocolize
CostProtocolizer
¶
Bases: FormattedForm, LogicLoader
Pass a program in FormattedForm to ctx, after choosing the protocol which each table reads each level of its formatted tensor with, as optimize_protocols does under cost_model.
Source code in src/finch/autoschedule/protocolize.py
LogicProtocolizer
¶
Bases: FormattedForm, LogicLoader
Pass a program in FormattedForm to ctx, after reading each level of a formatted tensor with an explicit protocol, as protocolize does.
Source code in src/finch/autoschedule/protocolize.py
choose_protocols(prgm, bindings, stats, stats_factory, cost_model=PROTOCOL_COST_MODEL, only=None, costs=None)
¶
Read each level of each formatted tensor of bindings with the protocol which costs least under cost_model, and return the program with the cost of each of its queries, in program order. The reads at a loop are chosen together, over the product of the protocols each supports, by the cost of the accesses at that loop alone, since the protocols at a loop don't change where the loops within it are entered. A read which gives its protocol keeps it. With only, the queries which touch none of its aliases keep their protocols and take their costs from costs, those of every query in order.
Source code in src/finch/autoschedule/protocolize.py
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 | |
optimize_protocols(prgm, bindings, stats, stats_factory, cost_model=PROTOCOL_COST_MODEL)
¶
prgm, reading each level with the protocol which costs least under cost_model, as choose_protocols chooses them.
Source code in src/finch/autoschedule/protocolize.py
protocolize(prgm, bindings)
¶
Read each level of a tensor of bindings with the protocol which the level uses by default, where the table which reads it gives none, so that every read of a formatted tensor states the protocol it is lowered with.
Source code in src/finch/autoschedule/protocolize.py
touches(stmt, aliases)
¶
Whether stmt reads or writes a tensor of aliases.
Source code in src/finch/autoschedule/protocolize.py
with_protocol(expr, tns, idxs, depth, protocol)
¶
expr, where each table of tns and idxs reads its level at a zero-based stored depth with protocol.