[llvm] [NVPTX] Do not run the NVVMReflect pass as part of the normal pipeline (PR #121834)
Krzysztof Drewniak via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 13:08:32 PST 2025
krzysz00 wrote:
Hi
This PR is causing problems in some cases where LLVM is being used as a library and so where the command-line flags might not be set - that is, we've got another version of the asan failure above in https://github.com/iree-org/iree/actions/runs/12759006193/job/35562065903?pr=19683 as shown below.
>From what I can tell, `getMCPU()` isn't meant to be how you get the CPU string out of a command-line tool, and this should be looked up from the target triple instead.
Would you be willing to fix this?
<details>
<summary>Failure log</summary>
```
cd /__w/iree/iree/build-asan/runtime/src/iree/hal/drivers/cuda/cts && /__w/iree/iree/build-asan/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --compile-mode=hal-executable --iree-hal-target-backends=cuda /__w/iree/iree/runtime/src/iree/hal/cts/testdata/command_buffer_dispatch_constants_test.mlir -o cuda_command_buffer_dispatch_constants_test.bin --iree-hal-executable-object-search-path=\"/__w/iree/iree/build-asan\"
iree-compile: /__w/iree/iree/third_party/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp:58: std::string llvm::codegen::getMCPU(): Assertion `MCPUView && "RegisterCodeGenFlags not created."' failed.
Please report issues to https://github.com/iree-org/iree/issues and include the crash backtrace.
Stack dump:
0. Program arguments: /__w/iree/iree/build-asan/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --compile-mode=hal-executable --iree-hal-target-backends=cuda /__w/iree/iree/runtime/src/iree/hal/cts/testdata/command_buffer_dispatch_constants_test.mlir -o cuda_command_buffer_dispatch_constants_test.bin --iree-hal-executable-object-search-path=\"/__w/iree/iree/build-asan\"
#0 0x000056203ea51ce6 ___interceptor_backtrace (/__w/iree/iree/build-asan/tools/iree-compile+0x72ce6)
#1 0x00007fe6cfe8a681 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /__w/iree/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:800:13
#2 0x00007fe6cfe85c08 llvm::sys::RunSignalHandlers() /__w/iree/iree/third_party/llvm-project/llvm/lib/Support/Signals.cpp:0:5
#3 0x00007fe6cfe8b410 SignalHandler(int) /__w/iree/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
#4 0x00007fe6cb152520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007fe6cb1a69fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#6 0x00007fe6cb152476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#7 0x00007fe6cb1387f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#8 0x00007fe6cb13871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#9 0x00007fe6cb149e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x00007fe6e03f975f std::char_traits<char>::assign(char&, char const&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/char_traits.h:357:14
#11 0x00007fe6e03f975f std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:225:2
#12 0x00007fe6e03f975f void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:232:2
#13 0x00007fe6e03f975f void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:255:11
#14 0x00007fe6e03f975f void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:274:4
#15 0x00007fe6e03f975f std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:459:9
#16 0x00007fe6e03f975f llvm::codegen::getMCPU[abi:cxx11]() /__w/iree/iree/third_party/llvm-project/llvm/lib/CodeGen/CommandFlags.cpp:58:1
#17 0x00007fe6dc860e84 llvm::NVVMReflectPass::NVVMReflectPass() /__w/iree/iree/third_party/llvm-project/llvm/lib/Target/NVPTX/NVVMReflect.cpp:226:3
#18 0x00007fe6dc82c3c9 std::enable_if<!(std::is_same_v<llvm::NVVMReflectPass, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> > >), void>::type llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::addPass<llvm::NVVMReflectPass>(llvm::NVVMReflectPass&&) /__w/iree/iree/third_party/llvm-project/llvm/include/llvm/IR/PassManager.h:201:9
#19 0x00007fe6dc82c3c9 llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2::operator()(llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>) const /__w/iree/iree/third_party/llvm-project/llvm/lib/Target/NVPTX/NVPTXPassRegistry.def:39:1
#20 0x00007fe6dc82c3c9 bool std::__invoke_impl<bool, llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2&, llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement> >(std::__invoke_other, llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2&, llvm::StringRef&&, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61:14
#21 0x00007fe6dc82c3c9 std::enable_if<is_invocable_r_v<bool, llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2&, llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement> >, bool>::type std::__invoke_r<bool, llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2&, llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement> >(llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2&, llvm::StringRef&&, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:114:9
#22 0x00007fe6dc82c3c9 std::_Function_handler<bool (llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>), llvm::NVPTXTargetMachine::registerPassBuilderCallbacks(llvm::PassBuilder&)::$_2>::_M_invoke(std::_Any_data const&, llvm::StringRef&&, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:290:9
#23 0x00007fe6e01f791f std::function<bool (llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>)>::operator()(llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>) const /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:590:9
#24 0x00007fe6e01f791f bool callbacksAcceptPassName<llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >, llvm::SmallVector<std::function<bool (llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>)>, 2u> >(llvm::StringRef, llvm::SmallVector<std::function<bool (llvm::StringRef, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >&, llvm::ArrayRef<llvm::PassBuilder::PipelineElement>)>, 2u>&) /__w/iree/iree/third_party/llvm-project/llvm/lib/Passes/PassBuilder.cpp:1349:11
#25 0x00007fe6e008da17 llvm::PassBuilder::parsePassPipeline(llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >&, llvm::StringRef) /__w/iree/iree/third_party/llvm-project/llvm/lib/Passes/PassBuilder.cpp:2184:16
#26 0x00007fe6d35f69bd llvm::Error::getPtr() const /__w/iree/iree/third_party/llvm-project/llvm/include/llvm/Support/Error.h:282:12
#27 0x00007fe6d35f69bd llvm::Error::operator bool() /__w/iree/iree/third_party/llvm-project/llvm/include/llvm/Support/Error.h:242:16
#28 0x00007fe6d35f69bd mlir::iree_compiler::IREE::HAL::optimizeModule(llvm::Module&, llvm::TargetMachine&, std::array<int, 3ul> const&) /__w/iree/iree/compiler/plugins/target/CUDA/CUDATarget.cpp:359:7
#29 0x00007fe6d35f69bd mlir::iree_compiler::IREE::HAL::CUDATargetBackend::serializeExecutable(mlir::iree_compiler::IREE::HAL::TargetBackend::SerializationOptions const&, mlir::iree_compiler::IREE::HAL::ExecutableVariantOp, mlir::OpBuilder&) /__w/iree/iree/compiler/plugins/target/CUDA/CUDATarget.cpp:613:7
#30 0x00007fe6d4bf2334 mlir::iree_compiler::IREE::HAL::(anonymous namespace)::SerializeTargetExecutablesPass::runOnOperation() /__w/iree/iree/compiler/src/iree/compiler/Dialect/HAL/Transforms/SerializeExecutables.cpp:87:11
[...]
```
</details>
https://github.com/llvm/llvm-project/pull/121834
More information about the llvm-commits
mailing list