Issue 239594
Summary [MLIR]Crash in `memref.dealloc` lowering with `unranked memref` during SPIR-V CPU runner pipeline
Labels mlir
Assignees
Reporter frida-albrecht
    The `--test-convert-to-spirv --test-spirv-cpu-runner-pipeline` crashes with an assertion failure when lowering `memref.dealloc` on an unranked memref.


test commit: [4fb8315](https://github.com/llvm/llvm-project/commit/4fb83151289b8c9f5255d7e899d11ea94374c394)

test case:
```
module {
  func.func @main(%arg0: memref<*xcomplex<f16>>, %arg1: memref<*xf32>, %arg2: i64) -> memref<*xcomplex<f16>> {
    memref.dealloc %arg1 : memref<*xf32>
    return %arg0 : memref<*xcomplex<f16>>
 }
}

```



Step to reproduce:
```
mlir-opt test.mlir --test-convert-to-spirv --test-spirv-cpu-runner-pipeline
```

Crash backtrace:
```
mlir-opt: /home/llvm-project/llvm-project-latest/mlir/lib/IR/BuiltinTypes.cpp:632: unsigned int mlir::detail::getMemorySpaceAsInt(mlir::Attribute): Assertion `llvm::isa<IntegerAttr>(memorySpace) && "Using `getMemorySpaceInteger` with non-Integer attribute"' 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: /home/llvm-project/llvm-project-latest/build/bin/mlir-opt /home/llvm-project/results/verify_test/213.mlir --test-convert-to-spirv --test-spirv-cpu-runner-pipeline
 #0 0x000055d80d405139 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fdb139)
 #1 0x000055d80d40193c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fd793c)
 #2 0x000055d80d401aa6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007fb5016e6520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007fb50173a9bc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969bc)
 #5 0x00007fb5016e6476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007fb5016cc7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007fb5016cc71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007fb5016dde96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x000055d815eb4238 mlir::detail::getMemorySpaceAsInt(mlir::Attribute) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xaa8a238)
#10 0x000055d812d82014 (anonymous namespace)::DeallocOpLowering::matchAndRewrite(mlir::memref::DeallocOp, mlir::memref::DeallocOpAdaptor, mlir::ConversionPatternRewriter&) const MemRefToLLVM.cpp:0:0
#11 0x000055d812d8bac7 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1<mlir::ConvertOpToLLVMPattern<mlir::memref::DeallocOp, false>, mlir::memref::DeallocOp>(mlir::ConvertOpToLLVMPattern<mlir::memref::DeallocOp, false> const&, mlir::memref::DeallocOp, mlir::memref::DeallocOp::GenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x7961ac7)
#12 0x000055d812d8bca1 mlir::ConvertOpToLLVMPattern<mlir::memref::DeallocOp, false>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x7961ca1)
#13 0x000055d815b5878f mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa72e78f)
#14 0x000055d815ba638c 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
#15 0x000055d815ba7a6a 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)
#16 0x000055d815b524bb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#17 0x000055d815b52974 mlir::OperationConverter::convert(mlir::Operation*, bool) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa728974)
#18 0x000055d815b5ce56 mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa732e56)
#19 0x000055d815b5e48f applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#20 0x000055d815b5e646 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa734646)
#21 0x000055d811df60e7 (anonymous namespace)::LowerHostCodeToLLVM::runOnOperation() ConvertLaunchFuncToLLVMCalls.cpp:0:0
#22 0x000055d815c0e3b9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e43b9)
#23 0x000055d815c0e694 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)
#24 0x000055d815c102e2 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e62e2)
#25 0x000055d815c112b9 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e72b9)
#26 0x000055d80d4cf696 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#27 0x000055d80d4d0c4e 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
#28 0x000055d80d4d0e91 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
#29 0x000055d815f844cd 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)
#30 0x000055d80d4cab8a 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
#31 0x000055d80d4d14d1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a74d1)
#32 0x000055d80d4d1724 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a7724)
#33 0x000055d80d3a6d5c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f7cd5c)
#34 0x00007fb5016cdd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x00007fb5016cde40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x000055d80d3e49d5 _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

Reply via email to