Issue |
131442
|
Summary |
[MLIR] crashed on `-convert-scf-to-emitc` with error: `!emitc.lvalue` must wrap supported emitc type, but got 'vector<4xf32>'
|
Labels |
mlir
|
Assignees |
|
Reporter |
sweead
|
test commit: [bbd1bb4](https://github.com/llvm/llvm-project/commit/bbd1bb40573dd5a36dc04af4ad307d6e16456f89)
step to reproduce:
```
mlir-opt test.mlir -convert-scf-to-emitc
```
test case:
```
module attributes {llvm.data_layout = "p:32:32:32"} {
func.func @main(%arg0: tensor<1x8x16xf32>, %arg1: tensor<1x3x4xf32>, %arg2: tensor<1x4x5xf32>, %arg3: tensor<4x4xf32>, %arg4: tensor<4x4xf32>, %arg5: tensor<8x8xf32>) {
%cst_0 = arith.constant dense<0.000000e+00> : vector<4xf32>
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c3 = arith.constant 3 : index
%c4 = arith.constant 4 : index
%1 = bufferization.to_memref %arg1 : tensor<1x3x4xf32> to memref<1x3x4xf32, strided<[?, ?, ?], offset: ?>>
scf.for %arg6 = %c0 to %c3 step %c1 {
%21 = scf.for %arg7 = %c0 to %c4 step %c1 iter_args(%arg8 = %cst_0) -> (vector<4xf32>) {
%22 = memref.load %1[%c0, %arg6, %arg7] : memref<1x3x4xf32, strided<[?, ?, ?], offset: ?>>
%23 = vector.insertelement %22, %arg8[%arg7 : index] : vector<4xf32>
scf.yield %23 : vector<4xf32>
}
}
return
}
}
```
Crash backtrace:
```
<unknown>:0: error: !emitc.lvalue must wrap supported emitc type, but got 'vector<4xf32>'
mlir-opt: /home/workdir/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:180: static ConcreteT mlir::detail::StorageUserBase<mlir::emitc::LValueType, mlir::Type, mlir::emitc::detail::LValueTypeStorage, mlir::detail::TypeUniquer>::get(MLIRContext *, Args &&...) [ConcreteT = mlir::emitc::LValueType, BaseT = mlir::Type, StorageT = mlir::emitc::detail::LValueTypeStorage, UniquerT = mlir::detail::TypeUniquer, Traits = <>, Args = <mlir::Type &>]: Assertion `succeeded( ConcreteT::verifyInvariants(getDefaultDiagnosticEmitFn(ctx), args...))' failed.
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 -convert-scf-to-emitc
#0 0x000055c47e395158 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12d3158)
#1 0x000055c47e392c7e llvm::sys::RunSignalHandlers() (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12d0c7e)
#2 0x000055c47e395b61 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f056ec3d520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f056ec919fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007f056ec3d476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007f056ec237f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007f056ec2371b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007f056ec34e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000055c47e9dd747 (/home/workdir/llvm-project/build/bin/./mlir-opt+0x191b747)
#10 0x000055c47e9dd682 mlir::emitc::LValueType::get(mlir::Type) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x191b682)
#11 0x000055c4812e86fc (anonymous namespace)::ForLowering::matchAndRewrite(mlir::scf::ForOp, mlir::scf::ForOpAdaptor, mlir::ConversionPatternRewriter&) const SCFToEmitC.cpp:0:0
#12 0x000055c4812e900b mlir::OpConversionPattern<mlir::scf::ForOp>::matchAndRewrite(mlir::scf::ForOp, mlir::scf::ForOpGenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) const (/home/workdir/llvm-project/build/bin/./mlir-opt+0x422700b)
#13 0x000055c48040e5ea mlir::OpConversionPattern<mlir::scf::ForOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/home/workdir/llvm-project/build/bin/./mlir-opt+0x334c5ea)
#14 0x000055c4814ef596 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/home/workdir/llvm-project/build/bin/./mlir-opt+0x442d596)
#15 0x000055c483c3e622 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
#16 0x000055c483c3b31f 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)
#17 0x000055c4814f060d (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#18 0x000055c4814ef6a7 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x442d6a7)
#19 0x000055c4814f084f mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x442e84f)
#20 0x000055c4814f6a9b mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x4434a9b)
#21 0x000055c4812e816b (anonymous namespace)::SCFToEmitCPass::runOnOperation() SCFToEmitC.cpp:0:0
#22 0x000055c48148e8a3 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cc8a3)
#23 0x000055c48148f142 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)
#24 0x000055c48149191e mlir::PassManager::run(mlir::Operation*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cf91e)
#25 0x000055c481489e9b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#26 0x000055c481489af3 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
#27 0x000055c481535065 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)
#28 0x000055c481483752 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)
#29 0x000055c481483a03 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1a03)
#30 0x000055c481483c12 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1c12)
#31 0x000055c47e3748df main (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12b28df)
#32 0x00007f056ec24d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#33 0x00007f056ec24e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#34 0x000055c47e374435 _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