| Issue |
109646
|
| Summary |
[mlir] -promote-buffers-to-stack crashes
|
| Labels |
|
| Assignees |
|
| Reporter |
axeabc
|
git version: c3d3cef8d5837
system: `Ubuntu 18.04.6 LTS`
reproduce with: `mlir-opt -promote-buffers-to-stack a.mlir`
a.mlir:
```
func.func @memref_allocation_only_in_loop() {
%c0 = arith.constant 0 : index
%A = memref.alloc() : memref<2 x memref<4 x memref<8 x f32>>>
scf.for %i = %c0 to %c0 step %c0 {
%1 = "test.dummy"(%i) : (index) -> (index)
scf.yield
}
return
}
```
stack trace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/szy/MLIR/llvm-debug/llvm-project/build/bin/mlir-opt -promote-buffers-to-stack a.mlir
#0 0x00005572663f2359 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:11
#1 0x00005572663f280b PrintStackTraceSignalHandler(void*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
#2 0x00005572663f0a3f llvm::sys::RunSignalHandlers() /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Signals.cpp:105:5
#3 0x00005572663f2ede SignalHandler(int) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
#4 0x00007fa726528420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#5 0x00007fa725b6500b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#6 0x00007fa725b44859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#7 0x000055726643505c llvm::report_fatal_error(llvm::Twine const&, bool) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/ErrorHandling.cpp:126:5
#8 0x000055726fc09bea /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Interfaces/DataLayoutInterfaces.cpp:32:3
#9 0x000055726fc0968b mlir::detail::getDefaultTypeSizeInBits(mlir::Type, mlir::DataLayout const&, llvm::ArrayRef<mlir::DataLayoutEntryInterface>) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Interfaces/DataLayoutInterfaces.cpp:89:1
#10 0x000055726fc104d4 mlir::DataLayout::getTypeSizeInBits(mlir::Type) const::$_0::operator()(mlir::Type) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Interfaces/DataLayoutInterfaces.cpp:543:12
#11 0x000055726fc10375 llvm::TypeSize llvm::function_ref<llvm::TypeSize (mlir::Type)>::callback_fn<mlir::DataLayout::getTypeSizeInBits(mlir::Type) const::$_0>(long, mlir::Type) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#12 0x000055726fc14b19 llvm::function_ref<llvm::TypeSize (mlir::Type)>::operator()(mlir::Type) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#13 0x000055726fc0b84d llvm::TypeSize cachedLookup<llvm::TypeSize>(mlir::Type, llvm::DenseMap<mlir::Type, llvm::TypeSize, llvm::DenseMapInfo<mlir::Type, void>, llvm::detail::DenseMapPair<mlir::Type, llvm::TypeSize>>&, llvm::function_ref<llvm::TypeSize (mlir::Type)>) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Interfaces/DataLayoutInterfaces.cpp:519:38
#14 0x000055726fc099e1 mlir::DataLayout::getTypeSizeInBits(mlir::Type) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Interfaces/DataLayoutInterfaces.cpp:537:10
#15 0x0000557266dbf36c defaultIsSmallAlloc(mlir::Value, unsigned int, unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp:107:28
#16 0x0000557266dbf22e (anonymous namespace)::PromoteBuffersToStackPass::initialize(mlir::MLIRContext*)::'lambda'(mlir::Value)::operator()(mlir::Value) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp:458:9
#17 0x0000557266dbf0e0 std::_Function_handler<bool (mlir::Value), (anonymous namespace)::PromoteBuffersToStackPass::initialize(mlir::MLIRContext*)::'lambda'(mlir::Value)>::_M_invoke(std::_Any_data const&, mlir::Value&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:2
#18 0x0000557266dc11d6 std::function<bool (mlir::Value)>::operator()(mlir::Value) const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:7
#19 0x0000557266dc1195 bool llvm::function_ref<bool (mlir::Value)>::callback_fn<std::function<bool (mlir::Value)>>(long, mlir::Value) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#20 0x0000557266d100d9 llvm::function_ref<bool (mlir::Value)>::operator()(mlir::Value) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
#21 0x0000557266dbebff (anonymous namespace)::BufferPlacementPromotion::promote(llvm::function_ref<bool (mlir::Value)>) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp:389:32
#22 0x0000557266dbe94c (anonymous namespace)::PromoteBuffersToStackPass::runOnOperation() /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp:469:3
#23 0x000055726b966104 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:0:17
#24 0x000055726b9660a5 void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1>(long) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#25 0x00005572664163f9 llvm::function_ref<void ()>::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
#26 0x000055726b968d9b void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef<mlir::IRUnit>, mlir::Pass&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/MLIRContext.h:276:3
#27 0x000055726b961d00 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:532:17
#28 0x000055726b962217 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:592:16
#29 0x000055726b9672c5 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:812:36
#30 0x000055726b966f70 llvm::LogicalResult mlir::failableParallelForEach<__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext*, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Threading.h:46:18
#31 0x000055726b9633cb llvm::LogicalResult mlir::failableParallelForEach<std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>&, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&>(mlir::MLIRContext*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>&, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Threading.h:92:10
#32 0x000055726b962d37 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:822:14
#33 0x000055726b962890 mlir::detail::OpToOpPassAdaptor::runOnOperation(bool) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:713:5
#34 0x000055726b9660f2 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:524:11
#35 0x000055726b9660a5 void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1>(long) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#36 0x00005572664163f9 llvm::function_ref<void ()>::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
#37 0x000055726b968d9b void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef<mlir::IRUnit>, mlir::Pass&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/MLIRContext.h:276:3
#38 0x000055726b961d00 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:532:17
#39 0x000055726b962217 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:592:16
#40 0x000055726b963b18 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:903:10
#41 0x000055726b963a4d mlir::PassManager::run(mlir::Operation*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:883:60
#42 0x000055726b95840d performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:412:17
#43 0x000055726b958072 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:477:12
#44 0x000055726b957e6c 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::raw_ostream&) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:560:12
#45 0x000055726b957e06 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 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::raw_ostream&) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#46 0x000055726bacd832 llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#47 0x000055726bacce45 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Support/ToolUtilities.cpp:27:12
#48 0x000055726b954cf3 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:563:10
#49 0x000055726b955095 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:604:14
#50 0x000055726b955268 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:620:10
#51 0x000055726637bf83 main /data/szy/MLIR/llvm-debug/llvm-project/mlir/tools/mlir-opt/mlir-opt.cpp:319:33
#52 0x00007fa725b46083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#53 0x000055726637bb9e _start (/data/szy/MLIR/llvm-debug/llvm-project/build/bin/mlir-opt+0x255fb9e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs