From cd4844a8255ec2914439aa621ef4e78a2f0b4e29 Mon Sep 17 00:00:00 2001 From: "Xu, Rui" Date: Sun, 18 Aug 2024 17:51:55 -0700 Subject: [PATCH 1/3] adding cpuruntime --- python/config.py.in | 6 ++++++ python/gc_mlir/graph_compiler.py | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/python/config.py.in b/python/config.py.in index 2e4a2099e..13c5354c1 100644 --- a/python/config.py.in +++ b/python/config.py.in @@ -4,6 +4,8 @@ import sys llvm_obj_root = "@LLVM_BINARY_DIR@" llvm_lib_dir = "@LLVM_LIBRARY_DIR@" shlib_ext = "@LTDL_SHLIB_EXT@" +gc_lib_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@" + if sys.platform.startswith("win32"): 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( MLIR_RUNNER_UTILS = os.path.normpath( os.path.join(mlir_runner_utils_dir, shlib_prefix + "mlir_runner_utils" + shlib_ext) ) + +GC_CPU_RUNTIME = os.path.normpath( + os.path.join(gc_lib_dir, shlib_prefix + "libGcCpuRuntime" + shlib_ext) +) \ No newline at end of file diff --git a/python/gc_mlir/graph_compiler.py b/python/gc_mlir/graph_compiler.py index c7c58804d..fd2966d19 100644 --- a/python/gc_mlir/graph_compiler.py +++ b/python/gc_mlir/graph_compiler.py @@ -6,10 +6,8 @@ # # ===-----------------------------------------------------------------------===# -from gc_mlir import execution_engine -from gc_mlir import ir -from gc_mlir import passmanager -from gc_mlir.config import MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS +from gc_mlir import execution_engine, ir, passmanager +from gc_mlir.config import GC_CPU_RUNTIME, MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS __all__ = [ "GraphCompiler", @@ -22,7 +20,7 @@ def __init__( pipeline: str = "any(gc-cpu-pipeline)", opt_level: int = 3, ): - self.shared_libs = [MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS] + self.shared_libs = [MLIR_C_RUNNER_UTILS, MLIR_RUNNER_UTILS, GC_CPU_RUNTIME] self.pipeline = pipeline self.opt_level = opt_level From ea76ebf693c9841f3e89c21690b5b7924741f3d3 Mon Sep 17 00:00:00 2001 From: "Xu, Rui" Date: Sun, 18 Aug 2024 18:09:29 -0700 Subject: [PATCH 2/3] fix --- python/config.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/config.py.in b/python/config.py.in index 13c5354c1..963ac498c 100644 --- a/python/config.py.in +++ b/python/config.py.in @@ -24,5 +24,5 @@ MLIR_RUNNER_UTILS = os.path.normpath( ) GC_CPU_RUNTIME = os.path.normpath( - os.path.join(gc_lib_dir, shlib_prefix + "libGcCpuRuntime" + shlib_ext) + os.path.join(gc_lib_dir, shlib_prefix + "GcCpuRuntime" + shlib_ext) ) \ No newline at end of file From 85b35345e696b1dcd09bc4253ebb263aa23d5142 Mon Sep 17 00:00:00 2001 From: "Xu, Rui" Date: Sun, 18 Aug 2024 18:38:27 -0700 Subject: [PATCH 3/3] add build dependency --- python/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index ef1c4d457..49b2bd361 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -120,4 +120,5 @@ add_mlir_python_modules(GcPythonModules GcPythonCAPI ) +add_dependencies(GcPythonModules GcCpuRuntime) configure_file(config.py.in ${MLIR_BINARY_DIR}/python_packages/gc_mlir_core/gc_mlir/config.py @ONLY)