[Mlir-commits] [mlir] 5a68a85 - Mark some MLIR tests as requiring the native target to be configured

Mehdi Amini llvmlistbot at llvm.org
Thu Jan 13 23:23:36 PST 2022


Author: Mehdi Amini
Date: 2022-01-14T07:23:14Z
New Revision: 5a68a85d859acbdbdd0c447a0112e8cb1aa57a36

URL: https://github.com/llvm/llvm-project/commit/5a68a85d859acbdbdd0c447a0112e8cb1aa57a36
DIFF: https://github.com/llvm/llvm-project/commit/5a68a85d859acbdbdd0c447a0112e8cb1aa57a36.diff

LOG: Mark some MLIR tests as requiring the native target to be configured

This makes `ninja check-mlir` work without the host targets configured.

Added: 
    

Modified: 
    mlir/test/CAPI/execution_engine.c
    mlir/test/CMakeLists.txt
    mlir/test/lit.cfg.py
    mlir/test/mlir-cpu-runner/lit.local.cfg
    mlir/test/python/execution_engine.py
    mlir/unittests/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/test/CAPI/execution_engine.c b/mlir/test/CAPI/execution_engine.c
index a48a2e330b20f..22922c6faa123 100644
--- a/mlir/test/CAPI/execution_engine.c
+++ b/mlir/test/CAPI/execution_engine.c
@@ -9,6 +9,8 @@
 
 /* RUN: mlir-capi-execution-engine-test 2>&1 | FileCheck %s
  */
+/* REQUIRES: llvm_has_native_target
+*/
 
 #include "mlir-c/Conversion.h"
 #include "mlir-c/ExecutionEngine.h"

diff  --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt
index 0567389b26924..0aba117e3c412 100644
--- a/mlir/test/CMakeLists.txt
+++ b/mlir/test/CMakeLists.txt
@@ -29,6 +29,12 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
   # Passed to lit.site.cfg.py.in to set up the path where to find the libraries.
   set(MLIR_INTEGRATION_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
+
+  # The native target may not be enabled when cross compiling, raise an error.
+  if(NOT TARGET ${LLVM_NATIVE_ARCH})
+    message(FATAL_ERROR "MLIR_INCLUDE_INTEGRATION_TESTS requires a native target")
+  endif()
+
   # Copy test data over.
   file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns
             ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx

diff  --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index 0773271f29c04..3319629b9d8b7 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -107,12 +107,10 @@
 config.environment['FILECHECK_OPTS'] = "-enable-var-scope --allow-unused-prefixes=false"
 
 
-# LLVM can be configured with an empty default triple
-# by passing ` -DLLVM_DEFAULT_TARGET_TRIPLE="" `.
-# This is how LLVM filters tests that require the host target
-# to be available for JIT tests.
-if config.target_triple:
-    config.available_features.add('default_triple')
+if config.native_target in config.targets_to_build:
+    config.available_features.add('llvm_has_native_target')
+
+
 
 # Add the python path for both the source and binary tree.
 # Note that presently, the python sources come from the source tree and the

diff  --git a/mlir/test/mlir-cpu-runner/lit.local.cfg b/mlir/test/mlir-cpu-runner/lit.local.cfg
index 012da916f226b..3a9b0ef14268a 100644
--- a/mlir/test/mlir-cpu-runner/lit.local.cfg
+++ b/mlir/test/mlir-cpu-runner/lit.local.cfg
@@ -4,11 +4,7 @@ import sys
 if sys.platform == 'win32':
     config.unsupported = True
 
-# Requires a non-empty default triple for these tests.
-# Passing ` -DLLVM_DEFAULT_TARGET_TRIPLE="" ` when the
-# host target isn't available is how LLVM filters
-# tests that require the host target to be available
-# for JIT tests.
-if 'default_triple' not in config.available_features:
+# Requires the native target to be configured in.
+if 'llvm_has_native_target' not in config.available_features:
     config.unsupported = True
 

diff  --git a/mlir/test/python/execution_engine.py b/mlir/test/python/execution_engine.py
index 3cb116b04ae33..c01614f686215 100644
--- a/mlir/test/python/execution_engine.py
+++ b/mlir/test/python/execution_engine.py
@@ -1,5 +1,5 @@
 # RUN: %PYTHON %s 2>&1 | FileCheck %s
-
+# REQUIRES: llvm_has_native_target
 import gc, sys
 from mlir.ir import *
 from mlir.passmanager import *

diff  --git a/mlir/unittests/CMakeLists.txt b/mlir/unittests/CMakeLists.txt
index 2798c443cf98d..3ad9e84cd9c85 100644
--- a/mlir/unittests/CMakeLists.txt
+++ b/mlir/unittests/CMakeLists.txt
@@ -7,7 +7,6 @@ endfunction()
 add_subdirectory(Analysis)
 add_subdirectory(Conversion)
 add_subdirectory(Dialect)
-add_subdirectory(ExecutionEngine)
 add_subdirectory(Interfaces)
 add_subdirectory(IR)
 add_subdirectory(Pass)
@@ -15,3 +14,8 @@ add_subdirectory(Support)
 add_subdirectory(Rewrite)
 add_subdirectory(TableGen)
 add_subdirectory(Transforms)
+
+# The native target may not be enabled when cross compiling.
+if(TARGET ${LLVM_NATIVE_ARCH})
+  add_subdirectory(ExecutionEngine)
+endif()


        


More information about the Mlir-commits mailing list