<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107804>107804</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] [tosa] -tosa-infer-shapes crashes in reference llvm::SmallVectorTemplateCommon<long>::operator[](size_type) [T = long]: Assertion `idx < size()' failed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
axeabc
</td>
</tr>
</table>
<pre>
git version: 0f5033053a3d4
system: `Ubuntu 18.04.6 LTS`
reproduce with: `mlir-opt -tosa-infer-shapes a.mlir`
a.mlir:
```
module {
func.func @transpose_conv2d_dyn_input(%arg0: memref<2x16x14 x3xf32>, %arg1: memref<3x1x1x3xf32>, %arg2 : memref<3xf32>) {
%0 = bufferization.to_tensor %arg2 : memref<3xf32>
%1 = bufferization.to_tensor %arg1 : memref<3x1x1x3xf32>
%2 = bufferization.to_tensor %arg0 : memref<2x16x14 x3xf32>
%3 = tosa.transpose_conv2d %2, %1, %0 {out_pad = array<i64: 0, 0, 0, 0>, out_shape = array<i64: -1, -1>, stride = array<i64: 1, 1>} : (tensor<2x16x14 x3xf32>, tensor<3x1x1x3xf32>, tensor<3xf32>) -> tensor<2x?x?x3xf32>
return
}
}
```
stack trace:
```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/llvm/include/llvm/ADT/SmallVector.h:291: reference llvm::SmallVectorTemplateCommon<long>::operator[](size_type) [T = long]: Assertion `idx < size()' 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 -tosa-infer-shapes /data/szy/MLIR/seed/seed29/tmp.vLgGpXsySf.mlir
#0 0x0000560251e96ff8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d3ff8)
#1 0x0000560251e94b0e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d1b0e)
#2 0x0000560251e9798d SignalHandler(int) Signals.cpp:0:0
#3 0x00007fa1a8888420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fa1a7ec500b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fa1a7ea4859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fa1a7ea4729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fa1a7ea4729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fa1a7eb5fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x00005602541d5b52 mlir::tosa::TransposeConv2DOp::inferReturnTypeComponents(mlir::MLIRContext*, std::optional<mlir::Location>, mlir::tosa::TransposeConv2DOpAdaptor, llvm::SmallVectorImpl<mlir::ShapedTypeComponents>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x3412b52)
#10 0x00005602542a13d3 mlir::detail::InferShapedTypeOpInterfaceInterfaceTraits::Model<mlir::tosa::TransposeConv2DOp>::inferReturnTypeComponents(mlir::MLIRContext*, std::optional<mlir::Location>, mlir::ValueShapeRange, mlir::DictionaryAttr, mlir::OpaqueProperties, mlir::RegionRange, llvm::SmallVectorImpl<mlir::ShapedTypeComponents>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x34de3d3)
#11 0x00005602542decd3 (anonymous namespace)::propagateShapesInRegion(mlir::Region&, (anonymous namespace)::TypeModificationState&) TosaInferShapes.cpp:0:0
#12 0x00005602542dcb25 (anonymous namespace)::TosaInferShapes::runOnOperation() TosaInferShapes.cpp:0:0
#13 0x0000560254f83e26 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c0e26)
#14 0x0000560254f84790 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+0x41c1790)
#15 0x0000560254f89b4e mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#16 0x0000560254f85e6b mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c2e6b)
#17 0x0000560254f83f78 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c0f78)
#18 0x0000560254f84790 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+0x41c1790)
#19 0x0000560254f86dd2 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c3dd2)
#20 0x0000560254f7f601 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x0000560254f7f25b 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
#22 0x000056025502bef5 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+0x4268ef5)
#23 0x0000560254f7a685 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+0x41b7685)
#24 0x0000560254f7a92f mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41b792f)
#25 0x0000560254f7ac5e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41b7c5e)
#26 0x0000560251e77c37 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b4c37)
#27 0x00007fa1a7ea6083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#28 0x0000560251e777be _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b47be)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.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