| Issue |
203812
|
| Summary |
[mlir][memref](bubble-down-memory-space-casts) mlir-opt crashes at Casting.h:560 with assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
Aran-414
|
git version: cc613052fd6afe2e3522c18234e382588069441d
MLIR Program:
```mlir
module {
func.func @dim_of_memref_reshape_undominated(%arg0: memref<*xf32>, %arg1: memref<?xindex>, %arg2: index) -> index {
%c4 = arith.constant 4 : index
%reshape = memref.reshape %arg0(%arg1) : (memref<*xf32>, memref<?xindex>) -> memref<*xf32>
%0 = arith.muli %arg2, %c4 : index
%dim = memref.dim %reshape, %0 : memref<*xf32>
return %dim : index
}
}
```
Reproduce Command: `mlir-opt -bubble-down-memory-space-casts a.mlir`
StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/llvm/include/llvm/Support/Casting.h:560: decltype(auto) llvm::cast(const From&) [with To = mlir::MemRefType; From = mlir::BaseMemRefType]: 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 and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /data2/dependency/dev/llvm-project/build/bin/mlir-opt -bubble-down-memory-space-casts a.mlir
#0 0x0000558d8996271f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25e871f)
#1 0x0000558d8995edec llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25e4dec)
#2 0x0000558d8995ef87 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f95e764f420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f95e713a00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f95e7119859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f95e7119729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f95e712afd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000558d923c29fa llvm::FailureOr<std::optional<llvm::SmallVector<mlir::Value, 6u>>> bubbleDownCastsPassthroughOpImpl<mlir::memref::ReshapeOp>(mlir::memref::ReshapeOp, mlir::OpBuilder&, mlir::OpOperand&) MemRefOps.cpp:0:0
#9 0x0000558d923c2a76 mlir::memref::ReshapeOp::bubbleDownCasts(mlir::OpBuilder&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb048a76)
#10 0x0000558d923263dc mlir::detail::MemorySpaceCastConsumerOpInterfaceInterfaceTraits::Model<mlir::memref::ReshapeOp>::bubbleDownCasts(mlir::detail::MemorySpaceCastConsumerOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::OpBuilder&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafac3dc)
#11 0x0000558d9265543c mlir::MemorySpaceCastConsumerOpInterface::bubbleDownCasts(mlir::OpBuilder&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2db43c)
#12 0x0000558d925fe1c8 mlir::detail::OpOrInterfaceRewritePatternBase<mlir::MemorySpaceCastConsumerOpInterface>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2841c8)
#13 0x0000558d926d77b2 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&)>)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#14 0x0000558d926d8ca8 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&)>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb35eca8)
#15 0x0000558d926a2e77 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#16 0x0000558d926a7186 mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb32d186)
#17 0x0000558d925fde87 (anonymous namespace)::BubbleDownMemorySpaceCasts::runOnOperation() BubbleDownMemorySpaceCasts.cpp:0:0
#18 0x0000558d92743901 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3c9901)
#19 0x0000558d92743c90 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3c9c90)
#20 0x0000558d92745d44 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3cbd44)
#21 0x0000558d92746dd1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3ccdd1)
#22 0x0000558d89a290ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x0000558d89a29b53 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#24 0x0000558d89a29ddb llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, 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::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#25 0x0000558d92b206e5 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7a66e5)
#26 0x0000558d89a1fa84 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#27 0x0000558d89a2a2f7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26b02f7)
#28 0x0000558d89a2a533 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26b0533)
#29 0x0000558d89862a9c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24e8a9c)
#30 0x00007f95e711b083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#31 0x0000558d8993ec1e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c4c1e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs