MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / autotune_warmup

Function autotune_warmup

inference/utils/load_quant.py:164–182  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

162
163
164def 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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected