Closed

Description
git version: 3a3b84b
system: Ubuntu 20.04.6 LTS (Focal Fossa)
reproduced with: mlir-opt --tosa-to-scf a.mlir
a.mlir
:
func.func nested @func1() {
%57 = tensor.empty() : tensor<4x31x31xf32>
%58 = tensor.empty() : tensor<1x1xi32>
%11 = tensor.empty() : tensor<4x31x31xf32>
%30 = tosa.slice %11 {size = array<i64>, start = array<i64>} : (tensor<4x31x31xf32>) -> tensor<*xf32>
%59 = tosa.scatter %30, %58, %57 : (tensor<*xf32>, tensor<1x1xi32>, tensor<4x31x31xf32>) -> tensor<4x31x31xf32>
return
}
trace:
mlir-opt: /data/bin/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = mlir::detail::TypedValue<mlir::RankedTensorType>; From = mlir::OpResult]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' 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 --tosa-to-scf a.mlir
#0 0x000056176627c33f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x159633f)
#1 0x00005617662793d4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f053960e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f05390f900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f05390d8859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f05390d8729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f05390e9fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000561768677a72 (anonymous namespace)::ScatterOpConverter::matchAndRewrite(mlir::tosa::ScatterOp, mlir::PatternRewriter&) const::'lambda'(mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange)::operator()(mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange) const TosaToSCF.cpp:0:0
#8 0x0000561768677b2a llvm::SmallVector<mlir::Value, 6u> llvm::function_ref<llvm::SmallVector<mlir::Value, 6u> (mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange)>::callback_fn<(anonymous namespace)::ScatterOpConverter::matchAndRewrite(mlir::tosa::ScatterOp, mlir::PatternRewriter&) const::'lambda'(mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange)>(long, mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange) TosaToSCF.cpp:0:0
#9 0x000056176780f18c mlir::scf::buildLoopNest(mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange, mlir::ValueRange, mlir::ValueRange, llvm::function_ref<llvm::SmallVector<mlir::Value, 6u> (mlir::OpBuilder&, mlir::Location, mlir::ValueRange, mlir::ValueRange)>) (/data/bin/llvm-project/build/bin/mlir-opt+0x2b2918c)
#10 0x0000561768674c1e (anonymous namespace)::ScatterOpConverter::matchAndRewrite(mlir::tosa::ScatterOp, mlir::PatternRewriter&) const TosaToSCF.cpp:0:0
#11 0x000056176b9c8038 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/bin/llvm-project/build/bin/mlir-opt+0x6ce2038)
#12 0x0000561768dabc59 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#13 0x0000561768dac5e7 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) DialectConversion.cpp:0:0
#14 0x0000561768daea54 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) (/data/bin/llvm-project/build/bin/mlir-opt+0x40c8a54)
#15 0x00005617686739f8 (anonymous namespace)::TosaToSCF::runOnOperation() TosaToSCFPass.cpp:0:0
#16 0x0000561768d03e1e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x401de1e)
#17 0x0000561768d042fa 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+0x401e2fa)
#18 0x0000561768d04b24 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x401eb24)
#19 0x0000561768cf53eb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x0000561768cf68a4 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
#21 0x0000561768cf6a54 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
#22 0x0000561768df4ce4 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+0x410ece4)
#23 0x0000561768cefd27 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+0x4009d27)
#24 0x0000561768cf6d7b mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4010d7b)
#25 0x00005617661b523b main (/data/bin/llvm-project/build/bin/mlir-opt+0x14cf23b)
#26 0x00007f05390da083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#27 0x000056176624cede _start (/data/bin/llvm-project/build/bin/mlir-opt+0x1566ede)
Aborted (core dumped)