| Issue |
239609
|
| Summary |
[MLIR]Crash in `linalg::vectorizeCopy` on `memref.copy` with unranked memrefs
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
frida-albrecht
|
The --test-linalg-transform-patterns=test-patterns pass crashes with an assertion failure when vectorizing memref.copy with unranked memrefs.
test commit: [4fb8315](https://github.com/llvm/llvm-project/commit/4fb83151289b8c9f5255d7e899d11ea94374c394)
test case:
```mlir
module {
func.func private @func_76010(%arg0: tensor<complex<f16>>, %arg1: memref<*xcomplex<f16>, #spirv.storage_class<StorageBuffer>>) -> (tensor<complex<f16>>, memref<*xcomplex<f16>, #spirv.storage_class<StorageBuffer>>) {
memref.copy %arg1, %arg1 : memref<*xcomplex<f16>, #spirv.storage_class<StorageBuffer>> to memref<*xcomplex<f16>, #spirv.storage_class<StorageBuffer>>
return %arg0, %arg1 : tensor<complex<f16>>, memref<*xcomplex<f16>, #spirv.storage_class<StorageBuffer>>
}
}
```
Step to reproduce:
```
mlir-opt test.mlir --test-linalg-transform-patterns=test-patterns
```
Crash backtrace:
```
mlir-opt: /home/llvm-project/llvm-project-latest/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: mlir-opt test.mlir --test-linalg-transform-patterns=test-patterns
#0 0x00005633b1c84139 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fdb139)
#1 0x00005633b1c8093c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fd793c)
#2 0x00005633b1c80aa6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f552da37520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f552da8b9bc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969bc)
#5 0x00007f552da37476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007f552da1d7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007f552da1d71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007f552da2ee96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00005633b8619d4a mlir::linalg::vectorizeCopy(mlir::RewriterBase&, mlir::memref::CopyOp) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x8970d4a)
#10 0x00005633ba42538c 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
#11 0x00005633ba426a6a 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&)>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa77da6a)
#12 0x00005633ba3ec30d (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#13 0x00005633ba3eddc7 mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa744dc7)
#14 0x00005633b1db3887 (anonymous namespace)::TestLinalgTransforms::runOnOperation() TestLinalgTransforms.cpp:0:0
#15 0x00005633ba48d3b9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e43b9)
#16 0x00005633ba48d694 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e4694)
#17 0x00005633ba48c2a4 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e32a4)
#18 0x00005633ba48d291 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e4291)
#19 0x00005633ba48d694 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e4694)
#20 0x00005633ba48f2e2 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e62e2)
#21 0x00005633ba4902b9 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e72b9)
#22 0x00005633b1d4e696 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x00005633b1d4fc4e 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 0x00005633b1d4fe91 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 0x00005633ba8034cd 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) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xab5a4cd)
#26 0x00005633b1d49b8a 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 0x00005633b1d504d1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a74d1)
#28 0x00005633b1d50724 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a7724)
#29 0x00005633b1c25d5c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f7cd5c)
#30 0x00007f552da1ed90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#31 0x00007f552da1ee40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#32 0x00005633b1c639d5 _start (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fba9d5)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs