<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116367>116367</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR] Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xisang0
</td>
</tr>
</table>
<pre>
Test on commit: https://github.com/llvm/llvm-project/commit/6548b6354d1d990e1c98736f5e7c3de876bedc8e
steps to reproduce:
```
mlir-opt test.mlir --tosa-optional-decompositions
```
test case:
```
module {
func.func @main(%arg3: tensor<1xf32>, %arg4: tensor<?x?xf32>) -> () {
%213 = tosa.table %arg4, %arg3 : (tensor<?x?xf32>, tensor<1xf32>) -> tensor<*xf32>
return
}
}
```
crash trace:
```
mlir-opt: /home/llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = mlir::RankedTensorType, From = mlir::TensorType]: 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: build/bin/mlir-opt test.mlir
#0 0x0000000001119717 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build/bin/mlir-opt+0x1119717)
#1 0x000000000111726e llvm::sys::RunSignalHandlers() (build/bin/mlir-opt+0x111726e)
#2 0x000000000111a0ea SignalHandler(int) Signals.cpp:0:0
#3 0x000077e73a09a520 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000077e73a0ee9fc pthread_kill (/usr/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000077e73a09a476 gsignal (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000077e73a0807f3 abort (/usr/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000077e73a08071b (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000077e73a091e96 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00000000045cf204 (build/bin/mlir-opt+0x45cf204)
#10 0x000000000363303f mlir::tosa::TableOp::verify() (build/bin/mlir-opt+0x363303f)
#11 0x00000000036fd963 mlir::Op<mlir::tosa::TableOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::TensorType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::NOperands<2u>::Impl, mlir::OpTrait::OpInvariants, mlir::InferShapedTypeOpInterface::Trait, mlir::OpTrait::InferShapedTypeOpAdaptor, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait, mlir::tosa::TosaOp::Trait>::verifyInvariants(mlir::Operation*) (build/bin/mlir-opt+0x36fd963)
#12 0x00000000036fcd8f mlir::RegisteredOperationName::Model<mlir::tosa::TableOp>::verifyInvariants(mlir::Operation*) (build/bin/mlir-opt+0x36fcd8f)
#13 0x000000000466a37b (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#14 0x000000000466a4d0 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#15 0x000000000466a4d0 (anonymous namespace)::OperationVerifier::verifyOpAndDominance(mlir::Operation&) Verifier.cpp:0:0
#16 0x0000000004669a83 mlir::verify(mlir::Operation*, bool) (build/bin/mlir-opt+0x4669a83)
#17 0x00000000065f50ac mlir::parseAsmSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::AsmParserState*, mlir::AsmParserCodeCompleteContext*) (build/bin/mlir-opt+0x65f50ac)
#18 0x00000000044564cf mlir::parseSourceFile(std::shared_ptr<llvm::SourceMgr> const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (build/bin/mlir-opt+0x44564cf)
#19 0x0000000004454d8a performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x0000000004454aa4 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&)::$_2>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#21 0x0000000004543018 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) (build/bin/mlir-opt+0x4543018)
#22 0x000000000444fe4f mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (build/bin/mlir-opt+0x444fe4f)
#23 0x00000000044500ed mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (build/bin/mlir-opt+0x44500ed)
#24 0x00000000044504c7 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (build/bin/mlir-opt+0x44504c7)
#25 0x00000000010fb097 main (build/bin/mlir-opt+0x10fb097)
#26 0x000077e73a081d90 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x000077e73a081e40 __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x00000000010fac15 _start (build/bin/mlir-opt+0x10fac15)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWV9z4yj2_TTkhYpLAv198IPixPXrqu5JV5Kah9-LC4krm40EWkA9ybffQpId4cRxOtszO7upTseCy73nXM4FhJkxYisBlii-QvH1BevtTunlkzBMboOLUvHn5QMYi5XElWpbYREt8M7aziBaILJGZL0VdteXi0q1iKyb5sf-z2Wn1T-gsoisp6FkncRRViY0jnjI8zyAsMqzlCZ1DGlFOWRpUgKvMkDBNQoKY6Ez2CqsodOK9xW4oEMXSoLp3_DYNkJfqs5iC8Yu3BO-vLTKMNcolGTNJYdKtZ0ywj2bN724wbhi5nQYxfsGMEqvxmdc97JauP8wioKWCYlIhkjM9Ja6RFmQRmlEV-FTTQmiN4is8Ngfef2Irp_c794qx5eI3uDBWz6Lh0hMQooRvcaO3cKy0uGZPB6cOwtnnJ0MsHoL2xT1ZRAp9n1jeIyxBttruX9G6fWUqMMHP2OVZmaHrWbn526EvN6pFl4raNKVkFXTc3hpuO-7TmlnsWLGCrld7BAt4iRx3jhUjX3uAJGM9VY5gsMwWiBaVMxYRLJKSWPxWqsWI5IM2Y6vHtSQYodsNL5j8hH4w5CYh8Hjahrjmc0M4muHoDAGtBMcRkkgDEN09aCGXGe_s2aI5oImGBEyAKKrh-ex33Uyve1bkBarGgvp9MuscDM-sgoRIYikuGaiAb4Y0_n9601xf4NNX7bCYobLfuvqR2nrKumnS1cY04NBZI2Z5HjKP7Y7wOPUlqx6HKZ3Cn9vWfWIed92h_kOFnj4-a7VVrP2wMrhwGUvGo7IunS1s35dxwfh0wAHT8H-JwzDPA3T2XyaZzN--K6FtAOMh0F2JHsx0uyPjTJWA2uHxK-wkHachuxtJIhcBU9TNETyFzjhEZyUJPAWnLte3outZM3_Mckb0GZf1OciOodeRHIUkQXAsOcbkWziMzabRdW5eQiG34MjOjlKU0gpC3IWk2Bca9a90U4DokRk_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