move hand_coded_optimizations to heuristic.py [pr] (#9844)

* move hand_coded_optimizations to heuristic.py [pr]

also folded all long lines

* make a copy and rename self -> k

* fix test
This commit is contained in:
chenyu
2025-04-10 23:40:16 -04:00
committed by GitHub
parent e0ec8be37d
commit 8c6299bced
15 changed files with 168 additions and 149 deletions

View File

@@ -3,6 +3,7 @@ from extra.mcts_search import mcts_search
from examples.mlperf.helpers import get_mlperf_bert_model
from tinygrad import Tensor, Device, dtypes, nn
from tinygrad.codegen.kernel import Kernel
from tinygrad.codegen.heuristic import hand_coded_optimizations
from tinygrad.ops import Ops, sym_infer
from tinygrad.device import Compiled
from tinygrad.engine.search import beam_search, bufs_from_lin
@@ -83,7 +84,7 @@ if __name__ == "__main__":
# always try hand coded opt
lin = Kernel(si.ast, opts=device.renderer)
lin.hand_coded_optimizations()
lin = hand_coded_optimizations(lin)
lins.append((lin, "HC"))
# maybe try tensor cores