From: Mehdi Amini Date: Fri, 14 Jan 2022 06:57:51 +0000 (+0000) Subject: Mark some MLIR tests as requiring the native target to be configured X-Git-Tag: upstream/15.0.7~20503 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a68a85d859acbdbdd0c447a0112e8cb1aa57a36;p=platform%2Fupstream%2Fllvm.git Mark some MLIR tests as requiring the native target to be configured This makes `ninja check-mlir` work without the host targets configured. --- diff --git a/mlir/test/CAPI/execution_engine.c b/mlir/test/CAPI/execution_engine.c index a48a2e3..22922c6 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 0567389..0aba117 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 0773271..3319629 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -107,12 +107,10 @@ llvm_config.add_tool_substitutions(tools, tool_dirs) 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 012da91..3a9b0ef 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 3cb116b..c01614f 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 2798c44..3ad9e84 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()