forked from tinygrad/tinygrad
* ** simple kernel to replace Kernel for postopt * support old * fix beam * beaming * beam on old * bring tensor cores back * raise * postbeam * test ops passes on mac * skip that * postopt default * gate that * fix tensor cores * a few test fixes * dsp fix * tc fix * loop * support swap * test_gemv * fix beam for variable * test opts from high level stuff * range annoying * compile slow * metal slow * better beam * no POSTBEAM * fix nolocals * hc opt mostly works * put that back * lil * some work * fix that * POSTOPT 2 * fix tests * no postopt 2 * work * back * padded tensors cores * shift_to * postopt 0 passes? * write PADTO * fix padded tensor cores * compare hcopt * 18000 lines * should pass tests * fix rangeify * put types back
23 lines
781 B
Python
23 lines
781 B
Python
from extra.optimization.helpers import load_worlds, ast_str_to_lin
|
|
from tinygrad.codegen.lowerer import pm_lowerer, get_index
|
|
from tinygrad.uop.ops import graph_rewrite
|
|
from tinygrad.codegen.opt.postrange import Scheduler
|
|
from tinygrad.codegen.opt.heuristic import hand_coded_optimizations
|
|
|
|
if __name__ == "__main__":
|
|
ast_strs = load_worlds()
|
|
for i, ast_str in enumerate(ast_strs):
|
|
lin = ast_str_to_lin(ast_str)
|
|
opt1 = hand_coded_optimizations(lin)
|
|
|
|
lowered = graph_rewrite(lin.ast, pm_lowerer, ctx=get_index(lin.ast), bottom_up=True)
|
|
sch = Scheduler(lowered, lin.opts)
|
|
opt2 = hand_coded_optimizations(sch)
|
|
|
|
if opt1 != opt2:
|
|
print("*******")
|
|
print("Kernel: ", opt1)
|
|
print("Scheduler: ", opt2)
|
|
else:
|
|
print("******* MATCH")
|