Skip to content

[MLIR][test] introduce has_py_module_ml_dtypes #123051

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

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 9 additions & 0 deletions mlir/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ llvm_canonicalize_cmake_booleans(
MLIR_RUN_CUDA_SM90_TESTS
)

# Run python file to find out of ml_dtypes is supported or not.
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import ml_dtypes" RESULT_VARIABLE HAS_PY_MODULE_ML_DTYPES_RET)
if(NOT HAS_PY_MODULE_ML_DTYPES_RET EQUAL "0")
set(HAS_PY_MODULE_ML_DTYPES 0)
else()
set(HAS_PY_MODULE_ML_DTYPES 1)
endif()
unset(HAS_PY_MODULE_ML_DTYPES_RET)

configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
Expand Down
2 changes: 2 additions & 0 deletions mlir/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ def find_real_python_interpreter():
else:
config.available_features.add("noasserts")

if config.has_py_module_ml_dtypes:
config.available_features.add("has_py_module_ml_dtypes")

def have_host_jit_feature_support(feature_name):
mlir_cpu_runner_exe = lit.util.which("mlir-cpu-runner", config.mlir_tools_dir)
Expand Down
1 change: 1 addition & 0 deletions mlir/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config.llvm_shlib_ext = "@SHLIBEXT@"
config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@"))
config.python_executable = "@Python3_EXECUTABLE@"
config.enable_assertions = @ENABLE_ASSERTIONS@
config.has_py_module_ml_dtypes = @HAS_PY_MODULE_ML_DTYPES@
config.native_target = "@LLVM_NATIVE_ARCH@"
config.host_os = "@HOST_OS@"
config.host_cc = "@HOST_CC@"
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/python/execution_engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: env MLIR_RUNNER_UTILS=%mlir_runner_utils MLIR_C_RUNNER_UTILS=%mlir_c_runner_utils %PYTHON %s 2>&1 | FileCheck %s
# REQUIRES: host-supports-jit
# REQUIRES: host-supports-jit, has_py_module_ml_dtypes
import gc, sys, os, tempfile
from mlir.ir import *
from mlir.passmanager import *
Expand Down
Loading