<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70884>70884</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir][vector] --async-func-to-async-runtime crashed with assertion failure "idx < size()"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anonymousMCS
</td>
</tr>
</table>
<pre>
git version: 604eff60abfce09f956c3b0b1414f8d0d04b5d47
system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```
reproduced with: ```mlir-opt --async-func-to-async-runtime a.mlir```
a.mlir:
```
func.func @func1() {
%c26 = arith.constant 26 : index
%cst_2 = arith.constant 1.60215309E+9 : f32
%cst_20 = arith.constant dense<1.60215309E+9> : vector<1xf32>
%46 = vector.insertelement %cst_2, %cst_20[%c26 : index] : vector<1xf32>
return
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/llvm/include/llvm/ADT/SmallVector.h:294: T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type) [with T = mlir::Attribute; <template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::reference = mlir::Attribute&; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type = long unsigned int]: 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/bin/llvm-project/build/bin/mlir-opt --async-func-to-async-runtime a.mlir
#0 0x0000556e5169d81f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x15d981f)
#1 0x0000556e5169a8b4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f10deaa5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f10de59000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f10de56f859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f10de56f729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f10de580fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000556e53657ffc (/data/bin/llvm-project/build/bin/mlir-opt+0x3593ffc)
#8 0x0000556e536580c6 mlir::LogicalResult llvm::detail::UniqueFunctionBase<mlir::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::vector::InsertElementOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::VectorType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::AtLeastNOperands<2u>::Impl, mlir::OpTrait::OpInvariants, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait, mlir::InferTypeOpInterface::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/bin/llvm-project/build/bin/mlir-opt+0x35940c6)
#9 0x0000556e53695156 mlir::RegisteredOperationName::Model<mlir::vector::InsertElementOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x35d1156)
#10 0x0000556e54411102 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x434d102)
#11 0x0000556e54411448 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x434d448)
#12 0x0000556e5434223a mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x427e23a)
#13 0x0000556e542ad49b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#14 0x0000556e542adf57 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) DialectConversion.cpp:0:0
#15 0x0000556e542b03c4 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+0x41ec3c4)
#16 0x0000556e51afa268 (anonymous namespace)::AsyncFuncToAsyncRuntimePass::runOnOperation() AsyncToAsyncRuntime.cpp:0:0
#17 0x0000556e54207b2e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x4143b2e)
#18 0x0000556e5420800a 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+0x414400a)
#19 0x0000556e54208834 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4144834)
#20 0x0000556e541f95bb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x0000556e541faa74 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
#22 0x0000556e541fac24 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
#23 0x0000556e542f7174 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+0x4233174)
#24 0x0000556e541f36d7 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+0x412f6d7)
#25 0x0000556e541fad71 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4136d71)
#26 0x0000556e541fb1d6 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x41371d6)
#27 0x0000556e515d4d9b main (/data/bin/llvm-project/build/bin/mlir-opt+0x1510d9b)
#28 0x00007f10de571083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x0000556e5166df8e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15a9f8e)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWl9z4ygS_zTKCxUXQv8f8uDYcW2qJpvUxLsP9-JCAjncINABmon301-BZFsoTsazye7O3daOY0zT3b_-QzdIWGu2FZReBcl1kCwvcGeepLrCQopdIzt9t3i8KCXZXW2ZAV-p0kyKIJqDFMa0rlOIy7qisKiLJK2iEpZhHMZ1TiCBcZmQOAvgMoDz_lPvtKGNXR2ksP__t7ITpgMIzmA8S8Gn9SMIUL6SFeZgJbXGASoOxGNeirZKkq6iBHxj5slj2nCmLmVrwOUl1jtRXdadqC6NHEaqE4Y1FOCZJTzJfZiKhuGExrKb2Q8QxND-DQOUB6gAQXbdUwAQoKRCKQiiJcCKmadZJYU2WBjgfp0DJgh9HlNrs0Gn6MNZClGYRLC4CdB14RbXEZouhafWEio0DaLFhEcQ3Tg2X2llpLLzz5ZjdDNiGvfK9yQzJjRVhnLaUGEOMgO0OMq3AbQHvYeXLN-Wo6jplBiMnC1PWrv_NApX9DWH7B3uogCtCDY4QKuSiQCtOP_aXLZK_ptWZhgGaMVExTtCjz_Ml-sArR4bzPnvPWQbU6iILc91gFLgCKN5EM1HVGvatBwbupBNYxNjsXY2iRZmmLhsscINNVRdhpeoN_xNz0a2VGFrF5d5Aco_XIJmf9CN2bXUBWdybTMFrJ1f9_EdzefGKFZ2hgbR9ff4LsFXyYgl_HBdFa2poqKir6qH0r9E8MFITjCXYgs64TZFApgw1jXRHMy1TQAmhd1mGHm2zIFd2qd-gDJQY8YpmfUh-fDpZv54A3RXNswADMpuCxRtpTLASPBkTKuteLQK0GrLzFNXzirZHONxErZM647qAK0AFlYtF73APFFQKayfQImrLy5FBvGPBldfAOma9pAzcAbcfw9KbhVuAFbbzmazPiNryo5xcpj8sf21T_UARRDAZwghTJKUJmFakDys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