From 514f5574c5e5f2d1db63d3e55105be16a509de82 Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Thu, 11 Sep 2025 07:53:48 -0700 Subject: [PATCH 01/17] [CI] Update monolithic-linux.sh --- .ci/monolithic-linux.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index 5abb8d72df028..f16cbcd5b2904 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -62,7 +62,10 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D CMAKE_EXE_LINKER_FLAGS="-no-pie" \ - -D LLVM_ENABLE_WERROR=ON + -D LLVM_ENABLE_WERROR=ON \ + -DLLVM_BUILD_UTILS=ON \ + -DLLVM_INCLUDE_UTILS=ON \ + -DLLVM_INSTALL_UTILS=ON start-group "ninja" From 989e06fea8b4a04679037465ec0043d75f742355 Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Thu, 11 Sep 2025 07:55:30 -0700 Subject: [PATCH 02/17] Update monolithic-windows.sh --- .ci/monolithic-linux.sh | 2 -- .ci/monolithic-windows.sh | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh index f16cbcd5b2904..119996dc5c171 100755 --- a/.ci/monolithic-linux.sh +++ b/.ci/monolithic-linux.sh @@ -63,8 +63,6 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -D CMAKE_EXE_LINKER_FLAGS="-no-pie" \ -D LLVM_ENABLE_WERROR=ON \ - -DLLVM_BUILD_UTILS=ON \ - -DLLVM_INCLUDE_UTILS=ON \ -DLLVM_INSTALL_UTILS=ON start-group "ninja" diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh index f85d6e3d51b57..0770340b15470 100755 --- a/.ci/monolithic-windows.sh +++ b/.ci/monolithic-windows.sh @@ -49,7 +49,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \ -D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \ -D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \ - -D LLVM_ENABLE_RUNTIMES="${runtimes}" + -D LLVM_ENABLE_RUNTIMES="${runtimes}" \ + -DLLVM_INSTALL_UTILS=ON start-group "ninja" From 8ba23b7b52f53020c3df0efb8aebb71616682d73 Mon Sep 17 00:00:00 2001 From: makslevental Date: Wed, 10 Sep 2025 12:57:54 -0700 Subject: [PATCH 03/17] [MLIR][Standalone] test Standalone against install distributions --- mlir/test/Examples/standalone/lit.local.cfg | 2 ++ .../Examples/standalone/test.toy.install-dir | 16 ++++++++++++++++ mlir/test/lit.cfg.py | 3 +++ mlir/test/lit.site.cfg.py.in | 1 + 4 files changed, 22 insertions(+) create mode 100644 mlir/test/Examples/standalone/test.toy.install-dir diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index 3b12dcbd99e83..fe0e298541bb7 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -11,3 +11,5 @@ config.substitutions.append(("%enable_libcxx", config.enable_libcxx)) config.substitutions.append(("%mlir_cmake_dir", config.mlir_cmake_dir)) config.substitutions.append(("%llvm_use_linker", config.llvm_use_linker)) config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) +config.substitutions.append(("%llvm_obj_root", config.llvm_obj_root)) +config.substitutions.append(("%host_cmake_install_prefix", config.host_cmake_install_prefix)) diff --git a/mlir/test/Examples/standalone/test.toy.install-dir b/mlir/test/Examples/standalone/test.toy.install-dir new file mode 100644 index 0000000000000..5c33a70491ae1 --- /dev/null +++ b/mlir/test/Examples/standalone/test.toy.install-dir @@ -0,0 +1,16 @@ +# REQUIRES: github-actions +# RUN: "%cmake_exe" --build %llvm_obj_root --target install +# RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ +# RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ +# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%host_cmake_install_prefix \ +# RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ +# RUN: -DPython3_EXECUTABLE=%python \ +# RUN: -DPython_EXECUTABLE=%python +# RUN: "%cmake_exe" --build . --target check-standalone | tee %t +# RUN: FileCheck --input-file=%t %s + +# Note: The number of checked tests is not important. The command will fail +# if any fail. +# CHECK: Passed +# CHECK-NOT: Failed +# UNSUPPORTED: target={{.*(windows|android).*}} diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index f99c24d6e299a..08c7947c1e9a6 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -383,3 +383,6 @@ def have_host_jit_feature_support(feature_name): if sys.version_info >= (3, 11): config.available_features.add("python-ge-311") + +if "GITHUB_ACTIONS" in os.environ: + config.available_features.add("github-actions") diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index 2fc595dfabbf5..ba83dd6b76411 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -19,6 +19,7 @@ config.enable_libcxx = "@LLVM_ENABLE_LIBCXX@" config.host_cmake = "@CMAKE_COMMAND@" config.host_cmake_generator = "@CMAKE_GENERATOR@" config.cmake_build_type = "@CMAKE_BUILD_TYPE@" +config.host_cmake_install_prefix = "@CMAKE_INSTALL_PREFIX@" config.llvm_use_linker = "@LLVM_USE_LINKER@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.host_arch = "@HOST_ARCH@" From b52185e1b034bd1661ed739367a7cf135af8d82c Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Wed, 10 Sep 2025 13:23:07 -0700 Subject: [PATCH 04/17] Update lit.site.cfg.py.in --- .../standalone/{test.toy.install-dir => test.install-dir.toy} | 0 mlir/test/lit.site.cfg.py.in | 1 + 2 files changed, 1 insertion(+) rename mlir/test/Examples/standalone/{test.toy.install-dir => test.install-dir.toy} (100%) diff --git a/mlir/test/Examples/standalone/test.toy.install-dir b/mlir/test/Examples/standalone/test.install-dir.toy similarity index 100% rename from mlir/test/Examples/standalone/test.toy.install-dir rename to mlir/test/Examples/standalone/test.install-dir.toy diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index ba83dd6b76411..1916525c885d7 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -3,6 +3,7 @@ import sys config.target_triple = "@LLVM_TARGET_TRIPLE@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" From 41b3bc7fa7e4eac89e7d0541ed7de38c6f89123b Mon Sep 17 00:00:00 2001 From: makslevental Date: Wed, 10 Sep 2025 15:54:54 -0700 Subject: [PATCH 05/17] add test.install-distribution-dir.toy --- mlir/test/Examples/standalone/lit.local.cfg | 1 + .../Examples/standalone/test.install-dir.toy | 4 ++-- .../test.install-distribution-dir.toy | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 mlir/test/Examples/standalone/test.install-distribution-dir.toy diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index fe0e298541bb7..483a8cb3a581a 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -12,4 +12,5 @@ config.substitutions.append(("%mlir_cmake_dir", config.mlir_cmake_dir)) config.substitutions.append(("%llvm_use_linker", config.llvm_use_linker)) config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) config.substitutions.append(("%llvm_obj_root", config.llvm_obj_root)) +config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) config.substitutions.append(("%host_cmake_install_prefix", config.host_cmake_install_prefix)) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index 5c33a70491ae1..b2bf8726ba17f 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,8 +1,8 @@ # REQUIRES: github-actions -# RUN: "%cmake_exe" --build %llvm_obj_root --target install +# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ -# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%host_cmake_install_prefix \ +# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR="%host_cmake_install_prefix" \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ # RUN: -DPython_EXECUTABLE=%python diff --git a/mlir/test/Examples/standalone/test.install-distribution-dir.toy b/mlir/test/Examples/standalone/test.install-distribution-dir.toy new file mode 100644 index 0000000000000..f50f1c1ebf989 --- /dev/null +++ b/mlir/test/Examples/standalone/test.install-distribution-dir.toy @@ -0,0 +1,17 @@ +# REQUIRES: github-actions +# RUN: "%cmake_exe" "%llvm_src_root" -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-python-sources" +# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install-distribution +# RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ +# RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ +# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%host_cmake_install_prefix \ +# RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ +# RUN: -DPython3_EXECUTABLE=%python \ +# RUN: -DPython_EXECUTABLE=%python +# RUN: "%cmake_exe" --build . --target check-standalone | tee %t +# RUN: FileCheck --input-file=%t %s + +# Note: The number of checked tests is not important. The command will fail +# if any fail. +# CHECK: Passed +# CHECK-NOT: Failed +# UNSUPPORTED: target={{.*(windows|android).*}} From 321bc5d8108785e1b419a3e5ece14171f1900bee Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Wed, 10 Sep 2025 18:34:14 -0700 Subject: [PATCH 06/17] Update lit.local.cfg --- mlir/test/Examples/standalone/lit.local.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index 483a8cb3a581a..e23b3d25f73fc 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -14,3 +14,4 @@ config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) config.substitutions.append(("%llvm_obj_root", config.llvm_obj_root)) config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) config.substitutions.append(("%host_cmake_install_prefix", config.host_cmake_install_prefix)) +config.substitutions.append(("%host_cmake_cmd", config.host_cmake)) From 0b46d9e0fa66e0d19da826148fd85f2b748636e8 Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Wed, 10 Sep 2025 18:34:35 -0700 Subject: [PATCH 07/17] Update test.install-distribution-dir.toy --- mlir/examples/standalone/CMakeLists.txt | 1 - mlir/test/Examples/standalone/lit.local.cfg | 4 +++- mlir/test/Examples/standalone/test.install-dir.toy | 1 + .../Examples/standalone/test.install-distribution-dir.toy | 4 +++- mlir/test/lit.cfg.py | 2 +- mlir/test/lit.site.cfg.py.in | 3 +++ 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt index 03627c0c10496..887eba036e99c 100644 --- a/mlir/examples/standalone/CMakeLists.txt +++ b/mlir/examples/standalone/CMakeLists.txt @@ -8,7 +8,6 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) find_package(MLIR REQUIRED CONFIG) - # Define the default argument to use by `lit` when testing. set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit") diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index e23b3d25f73fc..2f1415568dec1 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -14,4 +14,6 @@ config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) config.substitutions.append(("%llvm_obj_root", config.llvm_obj_root)) config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) config.substitutions.append(("%host_cmake_install_prefix", config.host_cmake_install_prefix)) -config.substitutions.append(("%host_cmake_cmd", config.host_cmake)) +config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) +config.substitutions.append(("%cmake_c_compiler_launcher", config.cmake_c_compiler_launcher)) +config.substitutions.append(("%cmake_cxx_compiler_launcher", config.cmake_cxx_compiler_launcher)) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index b2bf8726ba17f..725f63133c933 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,4 +1,5 @@ # REQUIRES: github-actions +# RUN: rm -rf %host_cmake_install_prefix # RUN: "%cmake_exe" --build "%llvm_obj_root" --target install # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ diff --git a/mlir/test/Examples/standalone/test.install-distribution-dir.toy b/mlir/test/Examples/standalone/test.install-distribution-dir.toy index f50f1c1ebf989..c26bf104247e9 100644 --- a/mlir/test/Examples/standalone/test.install-distribution-dir.toy +++ b/mlir/test/Examples/standalone/test.install-distribution-dir.toy @@ -1,5 +1,7 @@ # REQUIRES: github-actions -# RUN: "%cmake_exe" "%llvm_src_root" -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-python-sources" +# RUN: rm -rf %host_cmake_install_prefix +# RUN: "%cmake_exe" "%llvm_src_root" -DCMAKE_BUILD_TYPE=%cmake_build_type -B "%llvm_obj_root" \ +# RUN: -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-python-sources" # RUN: "%cmake_exe" --build "%llvm_obj_root" --target install-distribution # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index 08c7947c1e9a6..a404aac2ef2f7 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -187,7 +187,7 @@ def find_real_python_interpreter(): llvm_config.with_environment("PATH", dirs, append_path=True) tools = [ - "mlir-tblgen", + ToolSubst("mlir-tblgen", pre=";", post=";", unresolved="fatal"), "mlir-translate", "mlir-lsp-server", "mlir-capi-execution-engine-test", diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index 1916525c885d7..db77c3b921cd5 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -18,6 +18,9 @@ config.host_cc = "@HOST_CC@" config.host_cxx = "@HOST_CXX@" config.enable_libcxx = "@LLVM_ENABLE_LIBCXX@" config.host_cmake = "@CMAKE_COMMAND@" +config.cmake_build_type = "@CMAKE_BUILD_TYPE@" +config.cmake_c_compiler_launcher = "@CMAKE_C_COMPILER_LAUNCHER@" +config.cmake_cxx_compiler_launcher= "@CMAKE_CXX_COMPILER_LAUNCHER@" config.host_cmake_generator = "@CMAKE_GENERATOR@" config.cmake_build_type = "@CMAKE_BUILD_TYPE@" config.host_cmake_install_prefix = "@CMAKE_INSTALL_PREFIX@" From 6970e86215832edf350c1f46ac014cd2d1919937 Mon Sep 17 00:00:00 2001 From: makslevental Date: Wed, 10 Sep 2025 23:15:52 -0700 Subject: [PATCH 08/17] add compiler launcher --- mlir/test/Examples/standalone/test.install-dir.toy | 1 + mlir/test/Examples/standalone/test.install-distribution-dir.toy | 1 + mlir/test/Examples/standalone/test.toy | 1 + 3 files changed, 3 insertions(+) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index 725f63133c933..2a068e92f5880 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -3,6 +3,7 @@ # RUN: "%cmake_exe" --build "%llvm_obj_root" --target install # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ +# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR="%host_cmake_install_prefix" \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ diff --git a/mlir/test/Examples/standalone/test.install-distribution-dir.toy b/mlir/test/Examples/standalone/test.install-distribution-dir.toy index c26bf104247e9..3c8ac6b1d5854 100644 --- a/mlir/test/Examples/standalone/test.install-distribution-dir.toy +++ b/mlir/test/Examples/standalone/test.install-distribution-dir.toy @@ -5,6 +5,7 @@ # RUN: "%cmake_exe" --build "%llvm_obj_root" --target install-distribution # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ +# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%host_cmake_install_prefix \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy index 8b6d9dd62b76d..6ee942b61b5b5 100644 --- a/mlir/test/Examples/standalone/test.toy +++ b/mlir/test/Examples/standalone/test.toy @@ -1,6 +1,7 @@ # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_BUILD_TYPE=%cmake_build_type \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ +# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%mlir_cmake_dir \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ From c26e15abf3fa7caaa3233704280f2ab0783e9f35 Mon Sep 17 00:00:00 2001 From: makslevental Date: Thu, 11 Sep 2025 02:53:04 -0700 Subject: [PATCH 09/17] join files --- mlir/examples/standalone/test/CMakeLists.txt | 2 +- mlir/examples/standalone/test/lit.cfg.py | 2 +- mlir/test/Examples/standalone/lit.local.cfg | 8 +++ .../Examples/standalone/test.install-dir.toy | 52 ++++++++++++++++--- .../test.install-distribution-dir.toy | 20 ------- mlir/test/lit.cfg.py | 2 +- 6 files changed, 55 insertions(+), 31 deletions(-) delete mode 100644 mlir/test/Examples/standalone/test.install-distribution-dir.toy diff --git a/mlir/examples/standalone/test/CMakeLists.txt b/mlir/examples/standalone/test/CMakeLists.txt index 8864563df8a33..643d34b86233f 100644 --- a/mlir/examples/standalone/test/CMakeLists.txt +++ b/mlir/examples/standalone/test/CMakeLists.txt @@ -10,7 +10,7 @@ configure_lit_site_cfg( ) set(STANDALONE_TEST_DEPENDS - FileCheck count not + FileCheck standalone-capi-test standalone-opt standalone-translate diff --git a/mlir/examples/standalone/test/lit.cfg.py b/mlir/examples/standalone/test/lit.cfg.py index e27dddd7fb0b9..d4c1918fc5b3e 100644 --- a/mlir/examples/standalone/test/lit.cfg.py +++ b/mlir/examples/standalone/test/lit.cfg.py @@ -53,7 +53,7 @@ tool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir] tools = [ - "mlir-opt", + ToolSubst("mlir-opt", pre=";", post=";", unresolved="fatal"), "standalone-capi-test", "standalone-opt", "standalone-translate", diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index 2f1415568dec1..15b631b5d057a 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -17,3 +17,11 @@ config.substitutions.append(("%host_cmake_install_prefix", config.host_cmake_ins config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) config.substitutions.append(("%cmake_c_compiler_launcher", config.cmake_c_compiler_launcher)) config.substitutions.append(("%cmake_cxx_compiler_launcher", config.cmake_cxx_compiler_launcher)) + +# see https://github.com/llvm/llvm-project/blob/57782eff31e9d454b54a201c7ac43dc1b93dbb3f/llvm/utils/lit/lit/TestRunner.py#L1858 +config.substitutions.insert(0, ("FileCheck", "FileChuck")) +config.substitutions.insert(0, ("count", "kount")) +config.substitutions.insert(0, ("not", "mot")) +config.substitutions.append(("kount", "count")) +config.substitutions.append(("mot", "not")) +config.substitutions.append(("FileChuck", "FileCheck")) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index 2a068e92f5880..c545e174d2818 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,18 +1,54 @@ -# REQUIRES: github-actions -# RUN: rm -rf %host_cmake_install_prefix -# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install +# REQUIRESgithub-actions + +# RUN: echo "test full install" | tee %t +# CHECK: test full install + +# RUN: rm -rf "%host_cmake_install_prefix" + +# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install -j | tee -a %t + # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ # RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ -# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR="%host_cmake_install_prefix" \ +# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx \ +# RUN: -DLLVM_EXTERNAL_LIT="%llvm_obj_root/bin/llvm-lit" \ +# RUN: -DMLIR_DIR="%host_cmake_install_prefix/lib/cmake/mlir" \ +# RUN: -DLLVM_DIR="%host_cmake_install_prefix/lib/cmake/llvm" \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ -# RUN: -DPython_EXECUTABLE=%python -# RUN: "%cmake_exe" --build . --target check-standalone | tee %t +# RUN: -DPython_EXECUTABLE=%python | tee -a %t + +# RUN: "%cmake_exe" --build . --target check-standalone -j | tee -a %t + +# CHECK: Passed +# CHECK-NOT: Failed +# UNSUPPORTED: target={{.*(windows|android).*}} + +# RUN: rm -rf "%host_cmake_install_prefix" + +# RUN: echo "test install distribution" | tee -a %t +# CHECK: test install distribution + +# RUN: "%cmake_exe" "%llvm_src_root" -DCMAKE_BUILD_TYPE=%cmake_build_type -B "%llvm_obj_root" \ +# RUN: -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-opt;mlir-python-sources" | tee -a %t + +# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install-distribution -j | tee -a %t + +# RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ +# RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ +# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ +# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx \ +# RUN: -DLLVM_EXTERNAL_LIT="%llvm_obj_root/bin/llvm-lit" \ +# RUN: -DMLIR_DIR="%host_cmake_install_prefix/lib/cmake/mlir" \ +# RUN: -DLLVM_DIR="%host_cmake_install_prefix/lib/cmake/llvm" \ +# RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ +# RUN: -DPython3_EXECUTABLE=%python \ +# RUN: -DPython_EXECUTABLE=%python | tee -a %t + +# RUN: "%cmake_exe" --build . --target check-standalone -j | tee -a %t + # RUN: FileCheck --input-file=%t %s -# Note: The number of checked tests is not important. The command will fail -# if any fail. # CHECK: Passed # CHECK-NOT: Failed # UNSUPPORTED: target={{.*(windows|android).*}} diff --git a/mlir/test/Examples/standalone/test.install-distribution-dir.toy b/mlir/test/Examples/standalone/test.install-distribution-dir.toy deleted file mode 100644 index 3c8ac6b1d5854..0000000000000 --- a/mlir/test/Examples/standalone/test.install-distribution-dir.toy +++ /dev/null @@ -1,20 +0,0 @@ -# REQUIRES: github-actions -# RUN: rm -rf %host_cmake_install_prefix -# RUN: "%cmake_exe" "%llvm_src_root" -DCMAKE_BUILD_TYPE=%cmake_build_type -B "%llvm_obj_root" \ -# RUN: -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-python-sources" -# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install-distribution -# RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ -# RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ -# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ -# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%host_cmake_install_prefix \ -# RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ -# RUN: -DPython3_EXECUTABLE=%python \ -# RUN: -DPython_EXECUTABLE=%python -# RUN: "%cmake_exe" --build . --target check-standalone | tee %t -# RUN: FileCheck --input-file=%t %s - -# Note: The number of checked tests is not important. The command will fail -# if any fail. -# CHECK: Passed -# CHECK-NOT: Failed -# UNSUPPORTED: target={{.*(windows|android).*}} diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index a404aac2ef2f7..e3bf1ea943374 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -318,7 +318,7 @@ def find_real_python_interpreter(): ] ) else: - tools.extend(["mlir-opt"]) + tools.extend([ToolSubst("mlir-opt", pre=";", post=";", unresolved="fatal")]) llvm_config.add_tool_substitutions(tools, tool_dirs) From a8b9c7dbc675b302d5fa6cf1205976baac1cb084 Mon Sep 17 00:00:00 2001 From: makslevental Date: Thu, 11 Sep 2025 03:04:43 -0700 Subject: [PATCH 10/17] restore count not --- mlir/examples/standalone/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/examples/standalone/test/CMakeLists.txt b/mlir/examples/standalone/test/CMakeLists.txt index 643d34b86233f..8864563df8a33 100644 --- a/mlir/examples/standalone/test/CMakeLists.txt +++ b/mlir/examples/standalone/test/CMakeLists.txt @@ -10,7 +10,7 @@ configure_lit_site_cfg( ) set(STANDALONE_TEST_DEPENDS - FileCheck + FileCheck count not standalone-capi-test standalone-opt standalone-translate From d8cd431149595cf35277722299a0e8bc026138df Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Thu, 11 Sep 2025 03:14:37 -0700 Subject: [PATCH 11/17] Update test.install-dir.toy --- mlir/test/Examples/standalone/test.install-dir.toy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index c545e174d2818..f9a9b5e201cbb 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,4 +1,4 @@ -# REQUIRESgithub-actions +# REQUIRES: github-actions # RUN: echo "test full install" | tee %t # CHECK: test full install From 74c84801f224d2e8be70955ec89ecc7c4ba00443 Mon Sep 17 00:00:00 2001 From: makslevental Date: Thu, 11 Sep 2025 14:13:33 -0700 Subject: [PATCH 12/17] use config command instead of env var --- mlir/test/CMakeLists.txt | 7 +++++++ mlir/test/Examples/standalone/lit.local.cfg | 16 +++++++++------- .../Examples/standalone/test.install-dir.toy | 2 +- mlir/test/lit.cfg.py | 3 --- mlir/test/lit.site.cfg.py.in | 1 + 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt index 628adcfb6e285..922325bd3ba27 100644 --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -65,6 +65,12 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS) endif() +option(MLIR_RUN_STANDALONE_INSTALL_TESTS "Run Standalone example install tests." ON) +if(MLIR_RUN_STANDALONE_INSTALL_TESTS AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "") + message(WARNING "Standalone example install tests will install into root!\ + If you want to disable this behavior pass -DMLIR_RUN_STANDALONE_INSTALL_TESTS=OFF") +endif() + llvm_canonicalize_cmake_booleans( LLVM_BUILD_EXAMPLES LLVM_HAS_NVPTX_TARGET @@ -76,6 +82,7 @@ llvm_canonicalize_cmake_booleans( MLIR_ENABLE_SPIRV_CPU_RUNNER MLIR_ENABLE_VULKAN_RUNNER MLIR_INCLUDE_INTEGRATION_TESTS + MLIR_RUN_STANDALONE_INSTALL_TESTS MLIR_RUN_AMX_TESTS MLIR_RUN_CUDA_TENSOR_CORE_TESTS MLIR_RUN_X86VECTOR_TESTS diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index 15b631b5d057a..1918790d4a96d 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -18,10 +18,12 @@ config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) config.substitutions.append(("%cmake_c_compiler_launcher", config.cmake_c_compiler_launcher)) config.substitutions.append(("%cmake_cxx_compiler_launcher", config.cmake_cxx_compiler_launcher)) -# see https://github.com/llvm/llvm-project/blob/57782eff31e9d454b54a201c7ac43dc1b93dbb3f/llvm/utils/lit/lit/TestRunner.py#L1858 -config.substitutions.insert(0, ("FileCheck", "FileChuck")) -config.substitutions.insert(0, ("count", "kount")) -config.substitutions.insert(0, ("not", "mot")) -config.substitutions.append(("kount", "count")) -config.substitutions.append(("mot", "not")) -config.substitutions.append(("FileChuck", "FileCheck")) +if config.run_standalone_install_tests: + config.available_features.add("run-standalone-install-tests") + # see https://github.com/llvm/llvm-project/blob/57782eff31e9d454b54a201c7ac43dc1b93dbb3f/llvm/utils/lit/lit/TestRunner.py#L1858 + config.substitutions.insert(0, ("FileCheck", "FileChuck")) + config.substitutions.insert(0, ("count", "kount")) + config.substitutions.insert(0, ("not", "mot")) + config.substitutions.append(("kount", "count")) + config.substitutions.append(("mot", "not")) + config.substitutions.append(("FileChuck", "FileCheck")) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index f9a9b5e201cbb..e6af922dad83c 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,4 +1,4 @@ -# REQUIRES: github-actions +# REQUIRES: run-standalone-install-tests # RUN: echo "test full install" | tee %t # CHECK: test full install diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index e3bf1ea943374..c1cd371a466b7 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -383,6 +383,3 @@ def have_host_jit_feature_support(feature_name): if sys.version_info >= (3, 11): config.available_features.add("python-ge-311") - -if "GITHUB_ACTIONS" in os.environ: - config.available_features.add("github-actions") diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index db77c3b921cd5..3fe62472087d3 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -37,6 +37,7 @@ config.build_examples = @LLVM_BUILD_EXAMPLES@ config.run_nvptx_tests = @LLVM_HAS_NVPTX_TARGET@ config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@ config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@ +config.run_standalone_install_tests = @MLIR_RUN_STANDALONE_INSTALL_TESTS@ config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@ config.gpu_compilation_format = "@MLIR_GPU_COMPILATION_TEST_FORMAT@" config.rocm_test_chipset = "@ROCM_TEST_CHIPSET@" From c9829076aee773067f15f65752d36d2bc6966baf Mon Sep 17 00:00:00 2001 From: makslevental Date: Thu, 11 Sep 2025 15:08:16 -0700 Subject: [PATCH 13/17] run CI From 1b69ff6a57ffba93690f1b73cb2f7935f6c6804b Mon Sep 17 00:00:00 2001 From: makslevental Date: Thu, 11 Sep 2025 16:08:29 -0700 Subject: [PATCH 14/17] remove pre --- mlir/examples/standalone/test/lit.cfg.py | 2 +- mlir/test/lit.cfg.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mlir/examples/standalone/test/lit.cfg.py b/mlir/examples/standalone/test/lit.cfg.py index d4c1918fc5b3e..447d214d9507c 100644 --- a/mlir/examples/standalone/test/lit.cfg.py +++ b/mlir/examples/standalone/test/lit.cfg.py @@ -53,7 +53,7 @@ tool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir] tools = [ - ToolSubst("mlir-opt", pre=";", post=";", unresolved="fatal"), + ToolSubst("mlir-opt", post=";", unresolved="fatal"), "standalone-capi-test", "standalone-opt", "standalone-translate", diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index c1cd371a466b7..e992d81273141 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -187,7 +187,7 @@ def find_real_python_interpreter(): llvm_config.with_environment("PATH", dirs, append_path=True) tools = [ - ToolSubst("mlir-tblgen", pre=";", post=";", unresolved="fatal"), + ToolSubst("mlir-tblgen", post=";", unresolved="fatal"), "mlir-translate", "mlir-lsp-server", "mlir-capi-execution-engine-test", @@ -318,7 +318,7 @@ def find_real_python_interpreter(): ] ) else: - tools.extend([ToolSubst("mlir-opt", pre=";", post=";", unresolved="fatal")]) + tools.extend([ToolSubst("mlir-opt", post=";", unresolved="fatal")]) llvm_config.add_tool_substitutions(tools, tool_dirs) From d153c85b43d468fff247702803e54cfb18caecc2 Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Thu, 11 Sep 2025 21:49:56 -0400 Subject: [PATCH 15/17] reduce install-distribution test --- mlir/examples/standalone/CMakeLists.txt | 1 + .../Examples/standalone/test.install-dir.toy | 28 +------------------ 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt index 887eba036e99c..03627c0c10496 100644 --- a/mlir/examples/standalone/CMakeLists.txt +++ b/mlir/examples/standalone/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) find_package(MLIR REQUIRED CONFIG) + # Define the default argument to use by `lit` when testing. set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit") diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index e6af922dad83c..e3cdc481d66be 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,32 +1,6 @@ # REQUIRES: run-standalone-install-tests -# RUN: echo "test full install" | tee %t -# CHECK: test full install - -# RUN: rm -rf "%host_cmake_install_prefix" - -# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install -j | tee -a %t - -# RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ -# RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ -# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ -# RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx \ -# RUN: -DLLVM_EXTERNAL_LIT="%llvm_obj_root/bin/llvm-lit" \ -# RUN: -DMLIR_DIR="%host_cmake_install_prefix/lib/cmake/mlir" \ -# RUN: -DLLVM_DIR="%host_cmake_install_prefix/lib/cmake/llvm" \ -# RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ -# RUN: -DPython3_EXECUTABLE=%python \ -# RUN: -DPython_EXECUTABLE=%python | tee -a %t - -# RUN: "%cmake_exe" --build . --target check-standalone -j | tee -a %t - -# CHECK: Passed -# CHECK-NOT: Failed -# UNSUPPORTED: target={{.*(windows|android).*}} - -# RUN: rm -rf "%host_cmake_install_prefix" - -# RUN: echo "test install distribution" | tee -a %t +# RUN: echo "test install distribution" | tee %t # CHECK: test install distribution # RUN: "%cmake_exe" "%llvm_src_root" -DCMAKE_BUILD_TYPE=%cmake_build_type -B "%llvm_obj_root" \ From 018124101558579da97b4b653300f201cc001e8d Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Mon, 15 Sep 2025 22:07:17 -0400 Subject: [PATCH 16/17] use add_custom_target --- mlir/examples/standalone/test/lit.cfg.py | 2 +- mlir/test/CMakeLists.txt | 51 ++++++++++++++++--- mlir/test/Examples/standalone/lit.local.cfg | 16 +----- .../Examples/standalone/test.install-dir.toy | 18 ++----- mlir/test/Examples/standalone/test.toy | 1 - mlir/test/lit.cfg.py | 4 +- mlir/test/lit.site.cfg.py.in | 8 +-- 7 files changed, 55 insertions(+), 45 deletions(-) diff --git a/mlir/examples/standalone/test/lit.cfg.py b/mlir/examples/standalone/test/lit.cfg.py index 447d214d9507c..e27dddd7fb0b9 100644 --- a/mlir/examples/standalone/test/lit.cfg.py +++ b/mlir/examples/standalone/test/lit.cfg.py @@ -53,7 +53,7 @@ tool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir] tools = [ - ToolSubst("mlir-opt", post=";", unresolved="fatal"), + "mlir-opt", "standalone-capi-test", "standalone-opt", "standalone-translate", diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt index 922325bd3ba27..e09ad9289feca 100644 --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -65,12 +65,6 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS) endif() -option(MLIR_RUN_STANDALONE_INSTALL_TESTS "Run Standalone example install tests." ON) -if(MLIR_RUN_STANDALONE_INSTALL_TESTS AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "") - message(WARNING "Standalone example install tests will install into root!\ - If you want to disable this behavior pass -DMLIR_RUN_STANDALONE_INSTALL_TESTS=OFF") -endif() - llvm_canonicalize_cmake_booleans( LLVM_BUILD_EXAMPLES LLVM_HAS_NVPTX_TARGET @@ -82,7 +76,6 @@ llvm_canonicalize_cmake_booleans( MLIR_ENABLE_SPIRV_CPU_RUNNER MLIR_ENABLE_VULKAN_RUNNER MLIR_INCLUDE_INTEGRATION_TESTS - MLIR_RUN_STANDALONE_INSTALL_TESTS MLIR_RUN_AMX_TESTS MLIR_RUN_CUDA_TENSOR_CORE_TESTS MLIR_RUN_X86VECTOR_TESTS @@ -132,6 +125,50 @@ set(MLIR_TEST_DEPENDS if(NOT MLIR_STANDALONE_BUILD) list(APPEND MLIR_TEST_DEPENDS FileCheck count not split-file yaml2obj) endif() +set(MLIR_STANDALONE_INSTALL_TEST_PREFIX "${MLIR_BINARY_DIR}/mlir-standalone-test-install") +add_custom_target( + install-mlir-standalone-test-prefix + DEPENDS mlir-headers mlir-libraries mlir-cmake-exports mlir-tblgen + mlir-opt mlir-python-sources FileCheck count not + COMMAND ${CMAKE_COMMAND} -E make_directory "${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-headers + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-libraries + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-cmake-exports + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-tblgen + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-opt + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-python-sources + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=FileCheck + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=count + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=not + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" +) +list(APPEND MLIR_TEST_DEPENDS install-mlir-standalone-test-prefix) set(MLIR_TEST_DEPENDS ${MLIR_TEST_DEPENDS} mlir-capi-pdl-test diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg index 1918790d4a96d..b2a6384a34e41 100644 --- a/mlir/test/Examples/standalone/lit.local.cfg +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -12,18 +12,4 @@ config.substitutions.append(("%mlir_cmake_dir", config.mlir_cmake_dir)) config.substitutions.append(("%llvm_use_linker", config.llvm_use_linker)) config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) config.substitutions.append(("%llvm_obj_root", config.llvm_obj_root)) -config.substitutions.append(("%llvm_src_root", config.llvm_src_root)) -config.substitutions.append(("%host_cmake_install_prefix", config.host_cmake_install_prefix)) -config.substitutions.append(("%cmake_build_type", config.cmake_build_type)) -config.substitutions.append(("%cmake_c_compiler_launcher", config.cmake_c_compiler_launcher)) -config.substitutions.append(("%cmake_cxx_compiler_launcher", config.cmake_cxx_compiler_launcher)) - -if config.run_standalone_install_tests: - config.available_features.add("run-standalone-install-tests") - # see https://github.com/llvm/llvm-project/blob/57782eff31e9d454b54a201c7ac43dc1b93dbb3f/llvm/utils/lit/lit/TestRunner.py#L1858 - config.substitutions.insert(0, ("FileCheck", "FileChuck")) - config.substitutions.insert(0, ("count", "kount")) - config.substitutions.insert(0, ("not", "mot")) - config.substitutions.append(("kount", "count")) - config.substitutions.append(("mot", "not")) - config.substitutions.append(("FileChuck", "FileCheck")) +config.substitutions.append(("%standalone_install_test_prefix", config.standalone_install_test_prefix)) diff --git a/mlir/test/Examples/standalone/test.install-dir.toy b/mlir/test/Examples/standalone/test.install-dir.toy index e3cdc481d66be..cdb6276c790aa 100644 --- a/mlir/test/Examples/standalone/test.install-dir.toy +++ b/mlir/test/Examples/standalone/test.install-dir.toy @@ -1,20 +1,12 @@ -# REQUIRES: run-standalone-install-tests - -# RUN: echo "test install distribution" | tee %t -# CHECK: test install distribution - -# RUN: "%cmake_exe" "%llvm_src_root" -DCMAKE_BUILD_TYPE=%cmake_build_type -B "%llvm_obj_root" \ -# RUN: -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-opt;mlir-python-sources" | tee -a %t - -# RUN: "%cmake_exe" --build "%llvm_obj_root" --target install-distribution -j | tee -a %t +# RUN: echo "test install" | tee %t +# CHECK: test install # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ -# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx \ # RUN: -DLLVM_EXTERNAL_LIT="%llvm_obj_root/bin/llvm-lit" \ -# RUN: -DMLIR_DIR="%host_cmake_install_prefix/lib/cmake/mlir" \ -# RUN: -DLLVM_DIR="%host_cmake_install_prefix/lib/cmake/llvm" \ +# RUN: -DMLIR_DIR="%standalone_install_test_prefix/lib/cmake/mlir" \ +# RUN: -DLLVM_DIR="%standalone_install_test_prefix/lib/cmake/llvm" \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ # RUN: -DPython_EXECUTABLE=%python | tee -a %t @@ -25,4 +17,4 @@ # CHECK: Passed # CHECK-NOT: Failed -# UNSUPPORTED: target={{.*(windows|android).*}} +# UNSUPPORTED: target={{.*(android).*}} diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy index 6ee942b61b5b5..8b6d9dd62b76d 100644 --- a/mlir/test/Examples/standalone/test.toy +++ b/mlir/test/Examples/standalone/test.toy @@ -1,7 +1,6 @@ # RUN: "%cmake_exe" "%mlir_src_root/examples/standalone" -G "%cmake_generator" \ # RUN: -DCMAKE_BUILD_TYPE=%cmake_build_type \ # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \ -# RUN: -DCMAKE_CXX_COMPILER_LAUNCHER=%cmake_cxx_compiler_launcher -DCMAKE_C_COMPILER_LAUNCHER=%cmake_c_compiler_launcher \ # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%mlir_cmake_dir \ # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \ # RUN: -DPython3_EXECUTABLE=%python \ diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index e992d81273141..f99c24d6e299a 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -187,7 +187,7 @@ def find_real_python_interpreter(): llvm_config.with_environment("PATH", dirs, append_path=True) tools = [ - ToolSubst("mlir-tblgen", post=";", unresolved="fatal"), + "mlir-tblgen", "mlir-translate", "mlir-lsp-server", "mlir-capi-execution-engine-test", @@ -318,7 +318,7 @@ def find_real_python_interpreter(): ] ) else: - tools.extend([ToolSubst("mlir-opt", post=";", unresolved="fatal")]) + tools.extend(["mlir-opt"]) llvm_config.add_tool_substitutions(tools, tool_dirs) diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index 3fe62472087d3..ab3674cb3aa5b 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -3,8 +3,8 @@ import sys config.target_triple = "@LLVM_TARGET_TRIPLE@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.spirv_tools_tests = @LLVM_INCLUDE_SPIRV_TOOLS_TESTS@ @@ -18,12 +18,9 @@ config.host_cc = "@HOST_CC@" config.host_cxx = "@HOST_CXX@" config.enable_libcxx = "@LLVM_ENABLE_LIBCXX@" config.host_cmake = "@CMAKE_COMMAND@" -config.cmake_build_type = "@CMAKE_BUILD_TYPE@" -config.cmake_c_compiler_launcher = "@CMAKE_C_COMPILER_LAUNCHER@" -config.cmake_cxx_compiler_launcher= "@CMAKE_CXX_COMPILER_LAUNCHER@" config.host_cmake_generator = "@CMAKE_GENERATOR@" config.cmake_build_type = "@CMAKE_BUILD_TYPE@" -config.host_cmake_install_prefix = "@CMAKE_INSTALL_PREFIX@" +config.standalone_install_test_prefix = "@MLIR_STANDALONE_INSTALL_TEST_PREFIX@" config.llvm_use_linker = "@LLVM_USE_LINKER@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.host_arch = "@HOST_ARCH@" @@ -37,7 +34,6 @@ config.build_examples = @LLVM_BUILD_EXAMPLES@ config.run_nvptx_tests = @LLVM_HAS_NVPTX_TARGET@ config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@ config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@ -config.run_standalone_install_tests = @MLIR_RUN_STANDALONE_INSTALL_TESTS@ config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@ config.gpu_compilation_format = "@MLIR_GPU_COMPILATION_TEST_FORMAT@" config.rocm_test_chipset = "@ROCM_TEST_CHIPSET@" From 8f0f30d004c2a336f1cd8c5cd55ac33f7c38818a Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Mon, 15 Sep 2025 23:34:50 -0400 Subject: [PATCH 17/17] run CI --- clang/tools/cir-lsp-server/CMakeLists.txt | 2 +- mlir/test/CMakeLists.txt | 105 ++++++++++++---------- 2 files changed, 61 insertions(+), 46 deletions(-) diff --git a/clang/tools/cir-lsp-server/CMakeLists.txt b/clang/tools/cir-lsp-server/CMakeLists.txt index f421215173e62..e165b481d68c6 100644 --- a/clang/tools/cir-lsp-server/CMakeLists.txt +++ b/clang/tools/cir-lsp-server/CMakeLists.txt @@ -20,7 +20,7 @@ set(LIBS MLIRTransforms ) -add_mlir_tool(cir-lsp-server +add_clang_tool(cir-lsp-server cir-lsp-server.cpp DEPENDS diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt index e09ad9289feca..7809ec21e82d3 100644 --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -65,6 +65,8 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS) endif() +set(MLIR_STANDALONE_INSTALL_TEST_PREFIX "${MLIR_BINARY_DIR}/mlir-standalone-test-install") + llvm_canonicalize_cmake_booleans( LLVM_BUILD_EXAMPLES LLVM_HAS_NVPTX_TARGET @@ -125,51 +127,6 @@ set(MLIR_TEST_DEPENDS if(NOT MLIR_STANDALONE_BUILD) list(APPEND MLIR_TEST_DEPENDS FileCheck count not split-file yaml2obj) endif() -set(MLIR_STANDALONE_INSTALL_TEST_PREFIX "${MLIR_BINARY_DIR}/mlir-standalone-test-install") -add_custom_target( - install-mlir-standalone-test-prefix - DEPENDS mlir-headers mlir-libraries mlir-cmake-exports mlir-tblgen - mlir-opt mlir-python-sources FileCheck count not - COMMAND ${CMAKE_COMMAND} -E make_directory "${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=mlir-headers - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=mlir-libraries - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=mlir-cmake-exports - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=mlir-tblgen - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=mlir-opt - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=mlir-python-sources - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=FileCheck - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=count - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=not - -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" -) -list(APPEND MLIR_TEST_DEPENDS install-mlir-standalone-test-prefix) - set(MLIR_TEST_DEPENDS ${MLIR_TEST_DEPENDS} mlir-capi-pdl-test mlir-pdll-lsp-server @@ -243,6 +200,8 @@ if(LLVM_BUILD_EXAMPLES) transform-opt-ch4 mlir-minimal-opt mlir-transform-opt + mlir-cat + mlir-minimal-opt-canonicalize ) if(MLIR_ENABLE_EXECUTION_ENGINE) list(APPEND MLIR_TEST_DEPENDS @@ -284,6 +243,62 @@ add_custom_target(check-mlir-build-only ) set_target_properties(check-mlir-build-only PROPERTIES FOLDER "MLIR/Tests") +get_property(LLVM_EXPORTS GLOBAL PROPERTY LLVM_EXPORTS) +get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS) +add_custom_target( + install-mlir-standalone-test-prefix + DEPENDS ${MLIR_TEST_DEPENDS} ${MLIR_EXPORTS} FileCheck count not + COMMAND ${CMAKE_COMMAND} -E make_directory "${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${MLIR_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-headers + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-libraries + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-cmake-exports + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-tblgen + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-pdll + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-linalg-ods-yaml-gen + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-opt + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=mlir-python-sources + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=FileCheck + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=count + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=not + -DCMAKE_INSTALL_PREFIX="${MLIR_STANDALONE_INSTALL_TEST_PREFIX}" + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" +) +list(APPEND MLIR_TEST_DEPENDS install-mlir-standalone-test-prefix) + add_lit_testsuite(check-mlir "Running the MLIR regression tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${MLIR_TEST_DEPENDS}