Issue |
131439
|
Summary |
[MLIR] crashed on `allocateBuffer` when using `-finalize-memref-to-llvm`
|
Labels |
|
Assignees |
|
Reporter |
sweead
|
test commit: [bbd1bb4](https://github.com/llvm/llvm-project/commit/bbd1bb40573dd5a36dc04af4ad307d6e16456f89)
step to reproduce:
```
mlir-opt test.mlir --finalize-memref-to-llvm
```
test case:
```
module {
func.func private @main() -> tensor<4x1xf32> {
%alloca = memref.alloca() {alignment = 64 : i64} : memref<4xf32, #spirv.storage_class<StorageBuffer>>
%expand_shape = memref.expand_shape %alloca [[0, 1]] output_shape [4, 1] : memref<4xf32, #spirv.storage_class<StorageBuffer>> into memref<4x1xf32, #spirv.storage_class<StorageBuffer>>
%1 = bufferization.to_tensor %expand_shape : memref<4x1xf32, #spirv.storage_class<StorageBuffer>> to tensor<4x1xf32>
return %1 : tensor<4x1xf32>
}
}
```
Crash backtrace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/workdir/llvm-project/build/bin/./mlir-opt test.mlir --finalize-memref-to-llvm
#0 0x000056028373c158 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12d3158)
#1 0x0000560283739c7e llvm::sys::RunSignalHandlers() (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12d0c7e)
#2 0x000056028373cb61 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f4e3c584520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f4e3c5d89fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007f4e3c584476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007f4e3c56a7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x0000560283728ecf (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12bfecf)
#8 0x00005602865ecb95 (anonymous namespace)::AllocaOpLowering::allocateBuffer(mlir::ConversionPatternRewriter&, mlir::Location, mlir::Value, mlir::Operation*) const MemRefToLLVM.cpp:0:0
#9 0x00005602865ff0e2 mlir::AllocLikeOpLLVMLowering::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::Value>, mlir::ConversionPatternRewriter&) const (/home/workdir/llvm-project/build/bin/./mlir-opt+0x41960e2)
#10 0x0000560283a4c954 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/home/workdir/llvm-project/build/bin/./mlir-opt+0x15e3954)
#11 0x0000560286896596 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/home/workdir/llvm-project/build/bin/./mlir-opt+0x442d596)
#12 0x0000560288fe5622 void llvm::function_ref<void ()>::callback_fn<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&)>)::$_0>(long) PatternApplicator.cpp:0:0
#13 0x0000560288fe231f 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/workdir/llvm-project/build/bin/./mlir-opt+0x6b7931f)
#14 0x000056028689760d (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#15 0x00005602868966a7 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x442d6a7)
#16 0x000056028689784f mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x442e84f)
#17 0x000056028689da9b mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x4434a9b)
#18 0x00005602865ec5eb (anonymous namespace)::FinalizeMemRefToLLVMConversionPass::runOnOperation() MemRefToLLVM.cpp:0:0
#19 0x00005602868358a3 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cc8a3)
#20 0x0000560286836142 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cd142)
#21 0x000056028683891e mlir::PassManager::run(mlir::Operation*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cf91e)
#22 0x0000560286830e9b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x0000560286830af3 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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#24 0x00005602868dc065 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) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x4473065)
#25 0x000056028682a752 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1752)
#26 0x000056028682aa03 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1a03)
#27 0x000056028682ac12 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1c12)
#28 0x000056028371b8df main (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12b28df)
#29 0x00007f4e3c56bd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x00007f4e3c56be40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x000056028371b435 _start (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12b2435)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs