File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed
Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change 66
77from mlir_egglog .term_ir import Term
88from mlir_egglog .python_to_ir import interpret
9- from mlir_egglog .ir_to_mlir import convert_term_to_mlir
9+ from mlir_egglog .mlir_gen import MLIRGen
1010
1111# Rewrite rules
1212from mlir_egglog .optimization_rules import basic_math , trig_simplify
@@ -52,3 +52,14 @@ def compile(
5252 argspec = inspect .signature (fn )
5353 params = "," .join (map (str , argspec .parameters ))
5454 return convert_term_to_mlir (extracted , params )
55+
56+
57+ def convert_term_to_mlir (tree : Term , argspec : str ) -> str :
58+ """
59+ Convert a term to MLIR.
60+ """
61+
62+ argnames = map (lambda x : x .strip (), argspec .split ("," ))
63+ argmap = {k : f"%arg_{ k } " for k in argnames }
64+ source = MLIRGen (tree , argmap ).generate ()
65+ return source
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 88from typing import Callable , Any
99
1010from mlir_egglog .python_to_ir import interpret
11- from mlir_egglog .egglog_optimizer import extract
12- from mlir_egglog .ir_to_mlir import convert_term_to_mlir
11+ from mlir_egglog .egglog_optimizer import extract , convert_term_to_mlir
1312from mlir_egglog .jit_engine import JITEngine
1413from mlir_egglog .optimization_rules import basic_math
1514
You can’t perform that action at this time.
0 commit comments