Skip to content

Commit 7e87f4f

Browse files
authored
Adding the shared lib GcCpuRuntime for python GraphCompiler (#256)
* adding cpuruntime * fix * add build dependency
1 parent c744f5b commit 7e87f4f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,5 @@ add_mlir_python_modules(GcPythonModules
120120
GcPythonCAPI
121121
)
122122

123+
add_dependencies(GcPythonModules GcCpuRuntime)
123124
configure_file(config.py.in ${MLIR_BINARY_DIR}/python_packages/gc_mlir_core/gc_mlir/config.py @ONLY)

python/config.py.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import sys
44
llvm_obj_root = "@LLVM_BINARY_DIR@"
55
llvm_lib_dir = "@LLVM_LIBRARY_DIR@"
66
shlib_ext = "@LTDL_SHLIB_EXT@"
7+
gc_lib_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
8+
79

810
if sys.platform.startswith("win32"):
911
mlir_runner_utils_dir = os.path.normpath(os.path.join(llvm_obj_root, "bin"))
@@ -20,3 +22,7 @@ MLIR_C_RUNNER_UTILS = os.path.normpath(
2022
MLIR_RUNNER_UTILS = os.path.normpath(
2123
os.path.join(mlir_runner_utils_dir, shlib_prefix + "mlir_runner_utils" + shlib_ext)
2224
)
25+
26+
GC_CPU_RUNTIME = os.path.normpath(
27+
os.path.join(gc_lib_dir, shlib_prefix + "GcCpuRuntime" + shlib_ext)
28+
)

python/gc_mlir/graph_compiler.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
#
77
# ===-----------------------------------------------------------------------===#
88

9-
from gc_mlir import execution_engine
10-
from gc_mlir import ir
11-
from gc_mlir import passmanager
12-
from gc_mlir.config import MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS
9+
from gc_mlir import execution_engine, ir, passmanager
10+
from gc_mlir.config import GC_CPU_RUNTIME, MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS
1311

1412
__all__ = [
1513
"GraphCompiler",
@@ -22,7 +20,7 @@ def __init__(
2220
pipeline: str = "any(gc-cpu-pipeline)",
2321
opt_level: int = 3,
2422
):
25-
self.shared_libs = [MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS]
23+
self.shared_libs = [MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS, GC_CPU_RUNTIME]
2624
self.pipeline = pipeline
2725
self.opt_level = opt_level
2826

0 commit comments

Comments
 (0)