-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mlir] Use the process (host) triple in MLIRTargetLLVMTests #69538
Conversation
The default target triple might be set to something other than the host while the test is meant to run on the host
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-llvm Author: Stella Stamenova (sstamenova) ChangesThe test is meant to execute on the native target and only initializes the native target. However, it then gets the default target triple instead of the process (host) triple. This fails in cases where the native target and the default target are not the same. The test was added here: https://reviews.llvm.org/D154100 Full diff: https://github.com/llvm/llvm-project/pull/69538.diff 1 Files Affected:
diff --git a/mlir/unittests/Target/LLVM/SerializeToLLVMBitcode.cpp b/mlir/unittests/Target/LLVM/SerializeToLLVMBitcode.cpp
index c23ed7efd72fdf4..69c9d9b2f320202 100644
--- a/mlir/unittests/Target/LLVM/SerializeToLLVMBitcode.cpp
+++ b/mlir/unittests/Target/LLVM/SerializeToLLVMBitcode.cpp
@@ -55,7 +55,7 @@ TEST_F(MLIRTargetLLVM, SKIP_WITHOUT_NATIVE(SerializeToLLVMBitcode)) {
ASSERT_TRUE(!!module);
// Serialize the module.
- std::string targetTriple = llvm::sys::getDefaultTargetTriple();
+ std::string targetTriple = llvm::sys::getProcessTriple();
LLVM::ModuleToObject serializer(*(module->getOperation()), targetTriple, "",
"");
std::optional<SmallVector<char, 0>> serializedModule = serializer.run();
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for catching this!
Why would the test fail? It seems like just emitting LLVM IR and parsing it back which should not even require a target? |
@@ -55,7 +55,7 @@ TEST_F(MLIRTargetLLVM, SKIP_WITHOUT_NATIVE(SerializeToLLVMBitcode)) { | |||
ASSERT_TRUE(!!module); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabianmcg : why is the test decorated with SKIP_WITHOUT_NATIVE
?
(I can't comment above, it's line 41)
It fails because the test code only registers the native target. The error is: |
Thanks @sstamenova, we could likely fix this and make it work without the native target, but that's probably not worth the effort considering what this test is about! |
The reason is that |
The test is meant to execute on the native target and only initializes the native target. However, it then gets the default target triple instead of the process (host) triple. This fails in cases where the native target and the default target are not the same.
The test was added here: https://reviews.llvm.org/D154100