| Issue |
75758
|
| Summary |
[mlir][scf] --scf-for-loop-peeling crashed in "mlir::scf::peelForLoopAndSimplifyBounds" or "llvm::vfs::RedirectingFileSystem::create".
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
anonymousMCS
|
git version: 0ca95b269ff90afb706e2cf4c4a59d7c3afe6c65
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --scf-for-loop-peeling a.mlir```
a.mlir:
```
// When change1 or change2 are applied, trace1 will change to trace2...
func.func nested @func2() {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%1 = builtin.unrealized_conversion_cast %c1 : index to i64
%51 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
// change1: remove this line
%400 = llvm.mlir.constant(64 : index) : i64
%1668 = llvm.mlir.constant(64 : index) : i64
%1709 = index.shrs %c1, %c1
%1953 = builtin.unrealized_conversion_cast %51 : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> to memref<?x10x10xf16>
%1956 = scf.for %arg0 = %c0 to %c1 step %c1 iter_args(%arg1 = %1953) -> (memref<?x10x10xf16>) {
%2012 = scf.for %arg2 = %c0 to %c1 step %1709 iter_args(%arg3 = %arg1) -> (memref<?x10x10xf16>) {
// change2: replace following line with "%2016 = llvm.add %1, %1 : i64"
%2016 = llvm.add %1, %1668 : i64
%subview = memref.subview %1953[%arg0, %arg2, %c1] [%c1, %c1, %c1] [%c1, %c1, %c1] : memref<?x10x10xf16> to memref<?x?x?xf16, strided<[?, ?, ?], offset: ?>>
%2020 = builtin.unrealized_conversion_cast %subview : memref<?x?x?xf16, strided<[?, ?, ?], offset: ?>> to !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
%2050 = builtin.unrealized_conversion_cast %51 : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> to memref<?x10x10xf16>
%2068 = llvm.mlir.constant(1 : index) : i64
%2069 = llvm.alloca %2068 x !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> : (i64) -> !llvm.ptr
llvm.store %2020, %2069 : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr
scf.yield %2050 : memref<?x10x10xf16>
}
scf.yield %2012 : memref<?x10x10xf16>
}
return
}
```
trace1:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin1/llvm-project/build/bin/mlir-opt --scf-for-loop-peeling a.mlir
#0 0x00005652678ca3ff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin1/llvm-project/build/bin/mlir-opt+0x16573ff)
#1 0x00005652678c7454 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f3e7083a420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x0000565269022685 peelForLoop(mlir::RewriterBase&, mlir::scf::ForOp, mlir::scf::ForOp&, mlir::Value&) (.constprop.0) LoopSpecialization.cpp:0:0
#4 0x0000565269022f7e mlir::scf::peelForLoopAndSimplifyBounds(mlir::RewriterBase&, mlir::scf::ForOp, mlir::scf::ForOp&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x2daff7e)
#5 0x00005652690237d9 (anonymous namespace)::ForLoopPeelingPattern::matchAndRewrite(mlir::scf::ForOp, mlir::PatternRewriter&) const LoopSpecialization.cpp:0:0
#6 0x000056526d2c2348 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/data/bin1/llvm-project/build/bin/mlir-opt+0x704f348)
#7 0x000056526a620d5c (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#8 0x000056526a6251cb mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x43b21cb)
#9 0x000056526902044c (anonymous namespace)::ForLoopPeeling::runOnOperation() LoopSpecialization.cpp:0:0
#10 0x000056526a56b3ee mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42f83ee)
#11 0x000056526a56b8ca mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42f88ca)
#12 0x000056526a56c0f4 mlir::PassManager::run(mlir::Operation*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42f90f4)
#13 0x000056526a55ce63 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#14 0x000056526a55e334 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
#15 0x000056526a55e4e4 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
#16 0x000056526a65d7d4 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/bin1/llvm-project/build/bin/mlir-opt+0x43ea7d4)
#17 0x000056526a556d47 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42e3d47)
#18 0x000056526a55e631 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42eb631)
#19 0x000056526a55ea96 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42eba96)
#20 0x0000565267801a7b main (/data/bin1/llvm-project/build/bin/mlir-opt+0x158ea7b)
#21 0x00007f3e70306083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#22 0x000056526789a75e _start (/data/bin1/llvm-project/build/bin/mlir-opt+0x162775e)
Floating point exception (core dumped)
```
trace2:
```
LLVM ERROR: can't create Attribute 'mlir::ub::PoisonAttr' because storage uniquer isn't initialized: the dialect was likely not loaded, or the attribute wasn't added with addAttributes<...>() in the Dialect::initialize() method.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin1/llvm-project/build/bin/mlir-opt --scf-for-loop-peeling a.mlir
#0 0x000055a0b79133ff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin1/llvm-project/build/bin/mlir-opt+0x16573ff)
#1 0x000055a0b7910454 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f9ab787b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f9ab736600b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f9ab7345859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x000055a0b78212aa llvm::vfs::RedirectingFileSystem::create(llvm::ArrayRef<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, bool, llvm::vfs::FileSystem&) (.cold) VirtualFileSystem.cpp:0:0
#6 0x000055a0b79c79eb mlir::affine::AffineApplyOp::fold(mlir::affine::AffineApplyOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/data/bin1/llvm-project/build/bin/mlir-opt+0x170b9eb)
#7 0x000055a0b79c7acd mlir::LogicalResult llvm::detail::UniqueFunctionBase<mlir::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::affine::AffineApplyOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::IndexType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait>::getFoldHookFn()::'lambda'(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) const>(void*, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x170bacd)
#8 0x000055a0b7a18e46 mlir::RegisteredOperationName::Model<mlir::affine::AffineApplyOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x175ce46)
#9 0x000055a0ba7c0dd2 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x4504dd2)
#10 0x000055a0ba7c1118 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x4505118)
#11 0x000055a0ba6668e2 mlir::OperationFolder::tryToFold(mlir::Operation*, bool*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x43aa8e2)
#12 0x000055a0ba669cdd (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#13 0x000055a0ba66e1cb mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x43b21cb)
#14 0x000055a0b906944c (anonymous namespace)::ForLoopPeeling::runOnOperation() LoopSpecialization.cpp:0:0
#15 0x000055a0ba5b43ee mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42f83ee)
#16 0x000055a0ba5b48ca mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42f88ca)
#17 0x000055a0ba5b50f4 mlir::PassManager::run(mlir::Operation*) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42f90f4)
#18 0x000055a0ba5a5e63 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x000055a0ba5a7334 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
#20 0x000055a0ba5a74e4 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
#21 0x000055a0ba6a67d4 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/bin1/llvm-project/build/bin/mlir-opt+0x43ea7d4)
#22 0x000055a0ba59fd47 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42e3d47)
#23 0x000055a0ba5a7631 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42eb631)
#24 0x000055a0ba5a7a96 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin1/llvm-project/build/bin/mlir-opt+0x42eba96)
#25 0x000055a0b784aa7b main (/data/bin1/llvm-project/build/bin/mlir-opt+0x158ea7b)
#26 0x00007f9ab7347083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#27 0x000055a0b78e375e _start (/data/bin1/llvm-project/build/bin/mlir-opt+0x162775e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs