[mlir][scf] -scf-forall-to-for crashes in PatternMatch.cpp:295: virtual void mlir::RewriterBase::inlineBlockBefore(Block *, Block *, Block::iterator, ValueRange): Assertion `argValues.size() == source->getNumArguments() && "incorrect # of argument replacement values"' failed. #108164
Description
git version: 761bf33
system: Ubuntu 18.04.6 LTS
reproduce with: mlir-opt -scf-forall-to-for a.mlir
a.mlir:
module {
func.func @parallel_insert_slice(%arg0: tensor<100xf32>, %arg1: index) -> tensor<100xf32> {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c100 = arith.constant 100 : index
%0 = scf.forall (%arg2) in (%c100) shared_outs(%arg3 = %arg0) -> (tensor<100xf32>) {
%1 = "test.foo"() : () -> tensor<100xf32>
scf.forall.in_parallel {
tensor.parallel_insert_slice %1 into %arg3[%arg2] [100] [1] : tensor<100xf32> into tensor<100xf32>
}
}
return %0 : tensor<100xf32>
}
}
stack trace:
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/IR/PatternMatch.cpp:295: virtual void mlir::RewriterBase::inlineBlockBefore(Block *, Block *, Block::iterator, ValueRange): Assertion `argValues.size() == source->getNumArguments() && "incorrect # of argument replacement values"' 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/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -scf-forall-to-for a.mlir
#0 0x0000562efa2c7128 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d7128)
#1 0x0000562efa2c4c3e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d4c3e)
#2 0x0000562efa2c7abd SignalHandler(int) Signals.cpp:0:0
#3 0x00007f3e8aa50420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f3e8a08d00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007f3e8a06c859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007f3e8a06c729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007f3e8a06c729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007f3e8a07dfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x0000562efd56e140 mlir::RewriterBase::inlineBlockBefore(mlir::Block*, mlir::Block*, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false, void>, false, false>, mlir::ValueRange) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x437e140)
#10 0x0000562efbefeea0 mlir::scf::forallToForLoop(mlir::RewriterBase&, mlir::scf::ForallOp, llvm::SmallVectorImpl<mlir::Operation*>*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x2d0eea0)
#11 0x0000562efbeff58a void llvm::function_ref<void (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::scf::ForallOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<void, void>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::ForallToForLoop::runOnOperation()::'lambda'(mlir::scf::ForallOp), mlir::scf::ForallOp, void>(mlir::Operation*, (anonymous namespace)::ForallToForLoop::runOnOperation()::'lambda'(mlir::scf::ForallOp)&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) ForallToFor.cpp:0:0
#12 0x0000562efa3cb24e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11db24e)
#13 0x0000562efa3cb24e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11db24e)
#14 0x0000562efbeff44b (anonymous namespace)::ForallToForLoop::runOnOperation() ForallToFor.cpp:0:0
#15 0x0000562efd3b92d6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c92d6)
#16 0x0000562efd3b9c40 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c9c40)
#17 0x0000562efd3bc282 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41cc282)
#18 0x0000562efd3b4ab1 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x0000562efd3b470b 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&) MlirOptMain.cpp:0:0
#20 0x0000562efd4613a5 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-release/llvm-project/build/bin/mlir-opt+0x42713a5)
#21 0x0000562efd3afb35 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfb35)
#22 0x0000562efd3afddf mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfddf)
#23 0x0000562efd3b010e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c010e)
#24 0x0000562efa2a7d67 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b7d67)
#25 0x00007f3e8a06e083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#26 0x0000562efa2a78ee _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b78ee)