Skip to content
Open
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
3 changes: 2 additions & 1 deletion .ci/monolithic-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ 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_INSTALL_UTILS=ON
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still necessary with your new approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true it's not but it actually revealed (indirectly) a failure mode - because the monolithic script is touched, all the projects are added, and the "layering issues" are revealed.


start-group "ninja"

Expand Down
3 changes: 2 additions & 1 deletion .ci/monolithic-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion clang/tools/cir-lsp-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(LIBS
MLIRTransforms
)

add_mlir_tool(cir-lsp-server
add_clang_tool(cir-lsp-server
cir-lsp-server.cpp

DEPENDS
Expand Down
61 changes: 60 additions & 1 deletion mlir/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -125,7 +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_TEST_DEPENDS ${MLIR_TEST_DEPENDS}
mlir-capi-pdl-test
mlir-pdll-lsp-server
Expand Down Expand Up @@ -199,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
Expand Down Expand Up @@ -240,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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused?

get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS)
add_custom_target(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be very clearly document here (the "why" and the "how")

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think this command to be already pretty encompassing in itself, why are the other ones all needed below? (mlir-headers for example?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check the failing tests you will see the the union of COMMANDs here is not sufficient. I am currently trying to figure out if this can actually work at all.

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)
Copy link
Collaborator

@joker-eph joker-eph Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect we only need this if testing the examples is enabled (that is LLVM_BUILD_EXAMPLES is the guard I believe)


add_lit_testsuite(check-mlir "Running the MLIR regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${MLIR_TEST_DEPENDS}
Expand Down
2 changes: 2 additions & 0 deletions mlir/test/Examples/standalone/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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(("%standalone_install_test_prefix", config.standalone_install_test_prefix))
20 changes: 20 additions & 0 deletions mlir/test/Examples/standalone/test.install-dir.toy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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: -DLLVM_ENABLE_LIBCXX=%enable_libcxx \
# RUN: -DLLVM_EXTERNAL_LIT="%llvm_obj_root/bin/llvm-lit" \
# 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

# RUN: "%cmake_exe" --build . --target check-standalone -j | tee -a %t

# RUN: FileCheck --input-file=%t %s

# CHECK: Passed
# CHECK-NOT: Failed
# UNSUPPORTED: target={{.*(android).*}}
2 changes: 2 additions & 0 deletions mlir/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import sys

config.target_triple = "@LLVM_TARGET_TRIPLE@"
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@
Expand All @@ -19,6 +20,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.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@"
Expand Down
Loading