Issue 103086
Summary [mlir] Crash when using --pass-pipeline="builtin.module(func.func(tosa-to-linalg))"
Labels mlir
Assignees
Reporter wangyongj1a
    I have the following MLIR program:
test.mlir:
```
module{
 func.func @func1() {
        %c1 = arith.constant 1 : index
 %arg0 = tensor.empty(%c1) : tensor<?x100xi8>
        %arg1 = tensor.empty() : tensor<51xi1>
        %10 = tosa.table %arg0, %arg1 : (tensor<?x100xi8>, tensor<51xi1>)  -> tensor<110x1x1x?xi8>
 return
    }
}
```
The above MLIR program will cause a crash when using the following command:
```
mlir-opt --pass-pipeline="builtin.module(func.func(tosa-to-linalg))" test.mlir
```
And the crash backtrace is:
```
mlir-opt: /data/tmp/v0813/llvm-project/build/tools/mlir/include/mlir/IR/BuiltinTypeInterfaces.h.inc:171: bool mlir::ShapedType::isDynamicDim(unsigned int) const: Assertion `idx < getRank() && "invalid index for shaped 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/tmp/v0813/llvm-project/build/bin/mlir-opt --pass-pipeline=builtin.module(func.func(tosa-to-linalg)) test.mlir
 #0 0x000055cc3e6a302f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x151902f)
 #1 0x000055cc3e6a00a4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f3f25773420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f3f2524000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007f3f2521f859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007f3f2521f729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007f3f25230fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x000055cc41092d6a (anonymous namespace)::TableConverter::matchAndRewrite(mlir::tosa::TableOp, mlir::PatternRewriter&) const TosaToLinalg.cpp:0:0
 #8 0x000055cc4107c26f mlir::detail::OpOrInterfaceRewritePatternBase<mlir::tosa::TableOp>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x3ef226f)
 #9 0x000055cc4492e670 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x77a4670)
#10 0x000055cc4189129b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#11 0x000055cc4189297e mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x470897e)
#12 0x000055cc418958fb mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x470b8fb)
#13 0x000055cc41895f4d mlir::applyFullConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x470bf4d)
#14 0x000055cc41068cf3 (anonymous namespace)::TosaToLinalg::runOnOperation() TosaToLinalgPass.cpp:0:0
#15 0x000055cc417eae41 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4660e41)
#16 0x000055cc417eb219 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4661219)
#17 0x000055cc417eb58c mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#18 0x000055cc417ea395 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4660395)
#19 0x000055cc417eabc6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4660bc6)
#20 0x000055cc417eb219 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4661219)
#21 0x000055cc417ec344 mlir::PassManager::run(mlir::Operation*) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4662344)
#22 0x000055cc417dcfdb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x000055cc417dd9a4 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#24 0x000055cc417ddb54 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&)::'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
#25 0x000055cc418e65ae 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/tmp/v0813/llvm-project/build/bin/mlir-opt+0x475c5ae)
#26 0x000055cc417d53f9 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x464b3f9)
#27 0x000055cc417ddcc1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4653cc1)
#28 0x000055cc417de186 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x4654186)
#29 0x000055cc3e5bb5ab main (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x14315ab)
#30 0x00007f3f25221083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#31 0x000055cc3e6764ce _start (/data/tmp/v0813/llvm-project/build/bin/mlir-opt+0x14ec4ce)
Aborted (core dumped)
```
My git version is ed7ad0a1a0584f90a211ca5a87bc46968e169e5d.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to