The Triton kernels autotune themselves for specific input sizes. But this takes time. This function collects information on all possible input sizes for the different kernels and then runs them through the autotuner. The intended use is to run this on startup so the autotuner doesn't have to r
(model)
| 162 | |
| 163 | |
| 164 | def autotune_warmup(model): |
| 165 | """ |
| 166 | The Triton kernels autotune themselves for specific input sizes. But this takes time. |
| 167 | This function collects information on all possible input sizes for the different kernels |
| 168 | and then runs them through the autotuner. |
| 169 | The intended use is to run this on startup so the autotuner doesn't have to run during |
| 170 | actual inference. |
| 171 | """ |
| 172 | from tqdm import tqdm |
| 173 | |
| 174 | warmups = itertools.chain(quant_linear.autotune_warmup(model), fused_mlp.autotune_warmup(model)) |
| 175 | warmups = list(warmups) |
| 176 | |
| 177 | print('Warming up autotune cache ...') |
| 178 | with torch.no_grad(): |
| 179 | for m in tqdm(range(0, 12)): |
| 180 | m = 2 ** m |
| 181 | for func in warmups: |
| 182 | func(m) |
nothing calls this directly
no outgoing calls
no test coverage detected