Kernel.apply_opts [pr] (#9917)

* Kernel.apply_opts [pr]

updated all `for opt in`. also updated a few test_liinearizer tests to not implcitly depend on hand_coded_optimization

* not you yet
This commit is contained in:
chenyu
2025-04-17 08:00:56 -04:00
committed by GitHub
parent e2ed673c94
commit f5256e0020
17 changed files with 44 additions and 52 deletions

View File

@@ -51,7 +51,7 @@ def dataset_from_cache(fn):
lin = Kernel(eval(ast))
except Exception:
continue
for opt in k[:-1]: lin.apply_opt(opt)
lin.apply_opts(k[:-1])
act = k[-1]
log_ratio = math.log(old_tm/new_tm)
#print(f"ratio: {old_tm/new_tm:6.2f}x (log {log_ratio:5.2f}) from {str(act):50s} on {lin.colored_shape()}")

View File

@@ -15,8 +15,7 @@ def ast_str_to_lin(ast_str:str, opts=None): return Kernel(ast_str_to_ast(ast_str
def kern_str_to_lin(kern_str:str, opts=None):
(ast, applied_opts,) = eval(kern_str)
k = Kernel(ast, opts=opts)
for opt in applied_opts:
k.apply_opt(opt)
k.apply_opts(applied_opts)
return k
# load worlds, a dataset of about 12k kernels