Issue |
73540
|
Summary |
[mlir] --affine-loop-coalescing crashed with assertion failure "Cannot destroy a value that still has uses!"
|
Labels |
mlir
|
Assignees |
|
Reporter |
anonymousMCS
|
git version: 5bd643e1456bd2acc53ac0bf594d285be89a44fe
system: Ubuntu 20.04.6 LTS (Focal Fossa)
reproduced with: ```mlir-opt --affine-loop-coalescing a.mlir```
a.mlir:
```
func.func private @func2() {
%c209092661_i64 = arith.constant 209092661 : i64
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c3 = arith.constant 3 : index
%c16 = arith.constant 16 : index
%c19 = arith.constant 19 : index
%c29 = arith.constant 29 : index
%12 = tensor.empty() : tensor<20x5x5xi1>
%17 = index.shrs %c1, %c0
memref.alloca_scope {
%131 = index.or %c3, %c29
%c0_60 = arith.constant 0 : index
%148 = index.casts %c209092661_i64 : i64 to index
%151 = tensor.empty() : tensor<20x5x5xi1>
%152 = tensor.empty() : tensor<1x1xi32>
%c1_65 = arith.constant 1 : index
%c0_69 = arith.constant 0 : index
%c1_70 = arith.constant 1 : index
%153 = scf.for %arg0 = %c0_69 to %c0_60 step %17 iter_args(%arg1 = %151) -> (tensor<20x5x5xi1>) {
%158 = scf.for %arg2 = %c0_69 to %c19 step %148 iter_args(%arg3 = %12) -> (tensor<20x5x5xi1>) {
%extracted = tensor.extract %152[%arg0, %c1_65] : tensor<1x1xi32>
%159 = arith.index_cast %extracted : i32 to index
%extracted_slice = tensor.extract_slice %151[%arg0, %arg2, %c0_69] [%131, %159, %17] [%c0_60, %131, %c0_60] : tensor<20x5x5xi1> to tensor<?x?x?xi1>
%inserted_slice = tensor.insert_slice %extracted_slice into %arg3[%148, %c16, %131] [%c1_70, %17, %148] [%c0_60, %c1_70, %c1_70] : tensor<?x?x?xi1> into tensor<20x5x5xi1>
scf.yield %inserted_slice : tensor<20x5x5xi1>
}
scf.yield %151 : tensor<20x5x5xi1>
}
}
return
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList<OperandType>::~IRObjectWithUseList() [with OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --affine-loop-coalescing a.mlir
#0 0x0000558a73df622f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x161922f)
#1 0x0000558a73df3284 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f3408c57420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f340874200b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f3408721859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f3408721729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f3408732fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000558a76b3d537 mlir::Block::~Block() (/data/bin/llvm-project/build/bin/mlir-opt+0x4360537)
#8 0x0000558a76c287ca mlir::Region::~Region() (/data/bin/llvm-project/build/bin/mlir-opt+0x444b7ca)
#9 0x0000558a76c14d2c mlir::Operation::~Operation() (/data/bin/llvm-project/build/bin/mlir-opt+0x4437d2c)
#10 0x0000558a76c14eed mlir::Operation::erase() (/data/bin/llvm-project/build/bin/mlir-opt+0x4437eed)
#11 0x0000558a754fbee1 mlir::coalesceLoops(llvm::MutableArrayRef<mlir::scf::ForOp>) (/data/bin/llvm-project/build/bin/mlir-opt+0x2d1eee1)
#12 0x0000558a73f1c016 mlir::LogicalResult mlir::affine::coalescePerfectlyNestedLoops<mlir::scf::ForOp>(mlir::scf::ForOp) (/data/bin/llvm-project/build/bin/mlir-opt+0x173f016)
#13 0x0000558a73f1c632 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::LoopCoalescingPass::runOnOperation()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) LoopCoalescing.cpp:0:0
#14 0x0000558a73f1b7f0 void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (.constprop.1) LoopCoalescing.cpp:0:0
#15 0x0000558a73f1b84c void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (.constprop.1) LoopCoalescing.cpp:0:0
#16 0x0000558a73f1c954 (anonymous namespace)::LoopCoalescingPass::runOnOperation() LoopCoalescing.cpp:0:0
#17 0x0000558a76a09aee mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x422caee)
#18 0x0000558a76a09fca mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x422cfca)
#19 0x0000558a76a0a9cc mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#20 0x0000558a76a09125 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x422c125)
#21 0x0000558a76a0988a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x422c88a)
#22 0x0000558a76a09fca mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x422cfca)
#23 0x0000558a76a0a7f4 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x422d7f4)
#24 0x0000558a769fb563 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x0000558a769fca34 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#26 0x0000558a769fcbe4 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#27 0x0000558a76afbed4 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x431eed4)
#28 0x0000558a769f5447 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4218447)
#29 0x0000558a769fcd31 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x421fd31)
#30 0x0000558a769fd196 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4220196)
#31 0x0000558a73d2d97b main (/data/bin/llvm-project/build/bin/mlir-opt+0x155097b)
#32 0x00007f3408723083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x0000558a73dc658e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15e958e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs