Skip to content

Adding the shared lib GcCpuRuntime for python GraphCompiler #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions python/config.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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 + "GcCpuRuntime" + shlib_ext)
)
8 changes: 3 additions & 5 deletions python/gc_mlir/graph_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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

Expand Down