| Issue |
182747
|
| Summary |
[MLIR] Segmentation fault in AliasOperationPrinter when processing gpu program
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
jiayiw2008
|
Hi, I found a segmentation fault in the following GPU kernel program.
#### Code Example
```llvm
module {
func.func @kernelAddConstant(%arg0: memref<?xi32>, %arg1: i32) attributes {llvm.emit_c_interface} {
%0 = gpu.global_id x
%c10 = arith.constant 10 : index
%cond = arith.cmpi slt, %0, %c10 : index
scf.while (%iter = %1) : (i32) -> i32 {
%1 = memref.load %arg0[%0] : memref<?xi32>
%2 = arith.addi %iter, %arg1 : i32
scf.condition(%cond) %2 : i32
} do {
^bb0(%arg2: i32):
memref.store %arg2, %arg0[%0] : memref<?xi32>
scf.yield
}
gpu.terminator
}
}
```
#### Crash Log
```bash
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: mlir-opt cudaOpenMP_3.mlir --mlir-very-unsafe-disable-verifier-on-parsing
#0 0x0000650d714b41fd llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /llvm/lib/Support/Unix/Signals.inc:880:11
#1 0x0000650d714b472b PrintStackTraceSignalHandler(void*) /llvm/lib/Support/Unix/Signals.inc:962:1
#2 0x0000650d714b25c4 llvm::sys::RunSignalHandlers() /llvm/lib/Support/Signals.cpp:108:5
#3 0x0000650d714b4ec9 SignalHandler(int, siginfo_t*, void*) /llvm/lib/Support/Unix/Signals.inc:448:38
#4 0x000078995c045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x0000650d71489594 llvm::detail::PunnedPointer<mlir::Type>::asInt() const /llvm/include/llvm/ADT/PointerIntPair.h:41:5
#6 0x0000650d714894f5 llvm::detail::PunnedPointer<mlir::Type>::operator long() const /llvm/include/llvm/ADT/PointerIntPair.h:45:41
#7 0x0000650d71489495 llvm::PointerIntPair<mlir::Type, 3u, mlir::detail::ValueImpl::Kind, llvm::PointerLikeTypeTraits<mlir::Type>, llvm::PointerIntPairInfo<mlir::Type, 3u, llvm::PointerLikeTypeTraits<mlir::Type>>>::getPointer() const /llvm/include/llvm/ADT/PointerIntPair.h:94:58
#8 0x0000650d71489159 mlir::detail::ValueImpl::getType() const /mlir/include/mlir/IR/Value.h:63:45
#9 0x0000650d7164e0d8 mlir::Value::getType() const /mlir/include/mlir/IR/Value.h:105:39
#10 0x0000650d7185a099 mlir::ValueTypeIterator<llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator>::mapElement(mlir::Value) const /mlir/include/mlir/IR/TypeRange.h:128:53
#11 0x0000650d71859faa llvm::mapped_iterator_base<mlir::ValueTypeIterator<llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator>, llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, mlir::Type>::operator*() const /llvm/include/llvm/ADT/STLExtras.h:392:49
#12 0x0000650d7fe5de01 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) /mlir/lib/IR/AsmPrinter.cpp:750:20
#13 0x0000650d7fe5d428 (anonymous namespace)::DummyAliasOperationPrinter::printCustomOrGenericOp(mlir::Operation*) /mlir/lib/IR/AsmPrinter.cpp:737:3
#14 0x0000650d7fe60f3f (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) /mlir/lib/IR/AsmPrinter.cpp:786:24
#15 0x0000650d7fe5e027 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) /mlir/lib/IR/AsmPrinter.cpp:803:38
#16 0x0000650d7fe5dd95 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) /mlir/lib/IR/AsmPrinter.cpp:744:27
#17 0x0000650d7fe5d428 (anonymous namespace)::DummyAliasOperationPrinter::printCustomOrGenericOp(mlir::Operation*) /mlir/lib/IR/AsmPrinter.cpp:737:3
#18 0x0000650d7fe60f3f (anonymous namespace)::DummyAliasOperationPrinter::print(mlir::Block*, bool, bool) /mlir/lib/IR/AsmPrinter.cpp:786:24
#19 0x0000650d7fe5e027 (anonymous namespace)::DummyAliasOperationPrinter::printRegion(mlir::Region&, bool, bool, bool) /mlir/lib/IR/AsmPrinter.cpp:803:38
#20 0x0000650d7fe5dd95 (anonymous namespace)::DummyAliasOperationPrinter::printGenericOp(mlir::Operation*, bool) /mlir/lib/IR/AsmPrinter.cpp:744:27
#21 0x0000650d7fe5d428 (anonymous namespace)::DummyAliasOperationPrinter::printCustomOrGenericOp(mlir::Operation*) /mlir/lib/IR/AsmPrinter.cpp:737:3
#22 0x0000650d7fe5d17d (anonymous namespace)::AliasInitializer::initialize(mlir::Operation*, mlir::OpPrintingFlags const&, llvm::MapVector<void const*, (anonymous namespace)::SymbolAlias, llvm::DenseMap<void const*, unsigned int, llvm::DenseMapInfo<void const*, void>, llvm::detail::DenseMapPair<void const*, unsigned int>>, llvm::SmallVector<std::pair<void const*, (anonymous namespace)::SymbolAlias>, 0u>>&) /mlir/lib/IR/AsmPrinter.cpp:1173:16
#23 0x0000650d7fe5d0c5 (anonymous namespace)::AliasState::initialize(mlir::Operation*, mlir::OpPrintingFlags const&, mlir::DialectInterfaceCollection<mlir::OpAsmDialectInterface>&) /mlir/lib/IR/AsmPrinter.cpp:1321:1
#24 0x0000650d7fe73591 mlir::detail::AsmStateImpl::initializeAliases(mlir::Operation*) /mlir/lib/IR/AsmPrinter.cpp:1984:3
#25 0x0000650d7fe582cb mlir::Operation::print(llvm::raw_ostream&, mlir::AsmState&) /mlir/lib/IR/AsmPrinter.cpp:4163:21
#26 0x0000650d715d6758 mlir::operator<<(llvm::raw_ostream&, mlir::OpWithState const&) /mlir/include/mlir/IR/Operation.h:1148:10
#27 0x0000650d715beed0 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) /mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:618:6
#28 0x0000650d715be221 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) /mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:673:12
#29 0x0000650d715bdedc mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, llvm::raw_ostream&) const /mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:771:12
#30 0x0000650d715bdde6 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) /llvm/include/llvm/ADT/STLFunctionalExtras.h:46:12
#31 0x0000650d8009088a llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) const /llvm/include/llvm/ADT/STLFunctionalExtras.h:69:12
#32 0x0000650d8008fc4a mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) /mlir/lib/Support/ToolUtilities.cpp:30:12
#33 0x0000650d715b9b66 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) /mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:776:26
#34 0x0000650d715b9f68 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) /mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:822:14
#35 0x0000650d715ba138 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) /mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:838:10
#36 0x0000650d71488de5 main /mlir/tools/mlir-opt/mlir-opt.cpp:347:33
#37 0x000078995c02a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#38 0x000078995c02a28b call_init ./csu/../csu/libc-start.c:128:20
#39 0x000078995c02a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#40 0x0000650d71488c55 _start (/mnt/raid/build_all/bin/mlir-opt+0x4742c55)
Segmentation fault
```
Version: 7dbfc2bd0078b36e4f9ed14dd25c4d8e97b3ae77
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs