optimizer small fix: return if there's nothing to optimize

This commit is contained in:
George Hotz
2023-07-20 16:57:30 -07:00
parent 9dffc9ba23
commit d963024a13

View File

@@ -43,6 +43,7 @@ def kernel_optimize(k, create_k, runtime):
opts.append(ng.p.TransitionChoice([(i,s,"L") for s in LOCALS if k.full_shape[i]%s == 0]))
for i in range(k.shape_len-k.first_reduce):
opts.append(ng.p.TransitionChoice([(i,s,"R") for s in UPCASTS if k.full_shape[k.first_reduce+i]%s == 0]))
if len(opts) == 0: return
search_space = prod([len(x.choices) for x in opts])
optimizer = ng.optimizers.NGOpt(parametrization=ng.p.Tuple(*opts), budget=min(search_space, 200))
recommendation = optimizer.minimize(opt)