Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

Setting LLVM_LIT_ARGS to include --quiet and then running check-mlir in a standard checkout will otherwise cause test failures here because LLVM_LIT_ARGS gets propagated into this project.

Setting LLVM_LIT_ARGS to include --quiet and then running check-mlir in
a standard checkout will otherwise cause test failures here because
LLVM_LIT_ARGS gets propagated into this project.
@llvmbot
Copy link
Member

llvmbot commented Aug 7, 2025

@llvm/pr-subscribers-mlir

Author: Aiden Grossman (boomanaiden154)

Changes

Setting LLVM_LIT_ARGS to include --quiet and then running check-mlir in a standard checkout will otherwise cause test failures here because LLVM_LIT_ARGS gets propagated into this project.


Full diff: https://github.com/llvm/llvm-project/pull/152423.diff

1 Files Affected:

  • (modified) mlir/examples/standalone/CMakeLists.txt (+5)
diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt
index 038242ba1437a..6df956ce97b17 100644
--- a/mlir/examples/standalone/CMakeLists.txt
+++ b/mlir/examples/standalone/CMakeLists.txt
@@ -8,6 +8,11 @@ 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)
 
+  # Explictily set LLVM_LIT_ARGS so that the in-tree test for this example
+  # will get the expected output regardless of the value of LLVM_LIT_ARGS
+  # in the main LLVM build.
+  set(LLVM_LIT_ARGS "")
+
   message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}")
   message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
 

Copy link
Member

@marbre marbre left a comment

Choose a reason for hiding this comment

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

May I ask you to point me to the in-tree test for this example?

As folks may copy as this project as kind of a template is is unfortunate to set something we only need for an in-tree test as this might overlooked and not be removed in cases where it should later.

@joker-eph
Copy link
Collaborator

May I ask you to point me to the in-tree test for this example?

It is mlir/test/Examples/standalone/test.toy

The issue reproduces for me with:

$ cmake . -DLLVM_LIT_ARGS="-sv --quiet"
$ bin/llvm-lit ../mlir/test/Examples/standalone/test.toy -v

As folks may copy as this project as kind of a template is is unfortunate to set something we only need for an in-tree test as this might overlooked and not be removed in cases where it should later.

I agree it is unfortunate, I tried this:

diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy
index c91b3cf8a50f..0a89a25dfb47 100644
--- a/mlir/test/Examples/standalone/test.toy
+++ b/mlir/test/Examples/standalone/test.toy
@@ -2,7 +2,7 @@
 # RUN: -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc \
 # RUN: -DLLVM_ENABLE_LIBCXX=%enable_libcxx -DMLIR_DIR=%mlir_cmake_dir \
 # RUN: -DLLVM_USE_LINKER=%llvm_use_linker \
-# RUN: -DPython3_EXECUTABLE=%python
+# RUN: -DPython3_EXECUTABLE=%python -DLLVM_LIT_ARGS="-sv"
 # RUN: "%cmake_exe" --build . --target check-standalone | tee %t | FileCheck %s
 
 # Note: The number of checked tests is not important. The command will fail

but it's not enough: the LLVM_LIT_ARGS can't be overridden from the downstream project if the project does not explicit define it as an option.

But that means that we likely should define it in the standalone project, so that users can override it on the command line!

@boomanaiden154
Copy link
Contributor Author

But that means that we likely should define it in the standalone project, so that users can override it on the command line!

I didn't realize people copied this out to create their own projects. Thank you for the additional context there. Setting it explicitly to the default inside standalone/CMakeLists.txt sounds reasonable enough to me (suggestion applied).

Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

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

LG, thanks.

@boomanaiden154 boomanaiden154 merged commit ca8ee49 into llvm:main Aug 15, 2025
9 checks passed
@boomanaiden154 boomanaiden154 deleted the mlir-standalone-lit-args branch August 15, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants