Skip to content

Commit 4eee0cf

Browse files
authored
[MLIR] Reuse the path to runner_utils libraries (#108579)
Prefer to get the path to libmlir_runner_utils and libmlir_c_runner_utils via %mlir_runner_utils and %mlir_c_runner_utils. Fallback to the previous paths only if they aren't defined. This ensures the test will pass regardless of the build configuration used downstream.
1 parent ef71226 commit 4eee0cf

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mlir/test/python/execution_engine.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: %PYTHON %s 2>&1 | FileCheck %s
1+
# RUN: env MLIR_RUNNER_UTILS=%mlir_runner_utils MLIR_C_RUNNER_UTILS=%mlir_c_runner_utils %PYTHON %s 2>&1 | FileCheck %s
22
# REQUIRES: host-supports-jit
33
import gc, sys, os, tempfile
44
from mlir.ir import *
@@ -7,6 +7,12 @@
77
from mlir.runtime import *
88
from ml_dtypes import bfloat16, float8_e5m2
99

10+
MLIR_RUNNER_UTILS = os.getenv(
11+
"MLIR_RUNNER_UTILS", "../../../../lib/libmlir_runner_utils.so"
12+
)
13+
MLIR_C_RUNNER_UTILS = os.getenv(
14+
"MLIR_C_RUNNER_UTILS", "../../../../lib/libmlir_c_runner_utils.so"
15+
)
1016

1117
# Log everything to stderr and flush so that we have a unified stream to match
1218
# errors/info emitted by MLIR to stderr.
@@ -700,8 +706,8 @@ def testSharedLibLoad():
700706
]
701707
else:
702708
shared_libs = [
703-
"../../../../lib/libmlir_runner_utils.so",
704-
"../../../../lib/libmlir_c_runner_utils.so",
709+
MLIR_RUNNER_UTILS,
710+
MLIR_C_RUNNER_UTILS,
705711
]
706712

707713
execution_engine = ExecutionEngine(
@@ -743,8 +749,8 @@ def testNanoTime():
743749
]
744750
else:
745751
shared_libs = [
746-
"../../../../lib/libmlir_runner_utils.so",
747-
"../../../../lib/libmlir_c_runner_utils.so",
752+
MLIR_RUNNER_UTILS,
753+
MLIR_C_RUNNER_UTILS,
748754
]
749755

750756
execution_engine = ExecutionEngine(

0 commit comments

Comments
 (0)