| Issue |
177817
|
| Summary |
mlir-opt --convert-complex-to-libm crashes when folding tensor.from_elements with non-numeric element type
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Subway2023
|
# Description
Running mlir-opt --convert-complex-to-libm on a module containing tensor.from_elements with a non-numeric element type (!smt.bool) causes an assertion failure in DenseElementsAttr::get
# Reproduce
mlir-opt version: 22.1.0-rc1
location: If the **tensor.from_elements** is commented out, the crash no longer occurs.
```mlir
module {
func.func @main() {
%0 = gpu.grid_dim x
%1 = mpi.comm_world : !mpi.comm
%2 = smt.constant true
%3 = tensor.from_elements %2 : tensor<1x!smt.bool>
return
}
}
```
```
module {
func.func @main() {
%0 = gpu.grid_dim x
%1 = mpi.comm_world : !mpi.comm
%2 = smt.constant true
%3 = tensor.from_elements %2 : tensor<1x!smt.bool>
return
}
}
```
```
mlir-opt --convert-complex-to-libm test.mlir
```
```
mlir-opt: /mnt/sdd1/sbw/mlir/tool/llvm-project-llvmorg-22.1.0-rc1/mlir/lib/IR/BuiltinAttributes.cpp:955: static mlir::DenseElementsAttr mlir::DenseElementsAttr::get(mlir::ShapedType, llvm::ArrayRef<mlir::Attribute>): Assertion `llvm::isa<StringAttr>(attr) && "expected string value for non integer/index/float element"' 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: /mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt --bufferization-lower-deallocations /mnt/sdd1/sbw/mlir/data/genProgram_0123/232149_bf1c/mlir_steps/232149_bf1c_5.mlir
#0 0x0000603ca5154e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
#1 0x0000603ca51515af llvm::sys::RunSignalHandlers() (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
#2 0x0000603ca51516fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007e6855045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007e685509eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007e685509eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007e685509eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007e685504527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007e68550288ff abort ./stdlib/abort.c:81:7
#9 0x00007e685502881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007e685503b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#11 0x0000603cacccf4dd mlir::DenseElementsAttr::get(mlir::ShapedType, llvm::ArrayRef<mlir::Attribute>) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0xa0aa4dd)
#12 0x0000603cac59620e mlir::tensor::FromElementsOp::fold(mlir::tensor::FromElementsOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x997120e)
#13 0x0000603cac542ab2 llvm::LogicalResult llvm::detail::UniqueFunctionBase<llvm::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::tensor::FromElementsOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::RankedTensorType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::VariadicOperands, mlir::OpTrait::OpInvariants, mlir::OpAsmOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait>::getFoldHookFn()::'lambda'(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) const>(void*, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x991dab2)
#14 0x0000603cac54f071 mlir::RegisteredOperationName::Model<mlir::tensor::FromElementsOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x992a071)
#15 0x0000603cacd6a074 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0xa145074)
#16 0x0000603cacd6a4e3 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0xa1454e3)
#17 0x0000603cacca0951 mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<mlir::Operation*>*) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0xa07b951)
#18 0x0000603cac92c9b0 (anonymous namespace)::OperationLegalizer::legalizeWithFold(mlir::Operation*) DialectConversion.cpp:0:0
#19 0x0000603cac92d4cb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#20 0x0000603cac92d944 mlir::OperationConverter::convert(mlir::Operation*, bool) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d08944)
#21 0x0000603cac936b16 mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d11b16)
#22 0x0000603cac9392ab applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#23 0x0000603cac93944f mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9d1444f)
#24 0x0000603cab4983d3 (anonymous namespace)::LowerDeallocationsPass::runOnOperation() LowerDeallocations.cpp:0:0
#25 0x0000603cac9f4756 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dcf756)
#26 0x0000603cac9f4a8e mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dcfa8e)
#27 0x0000603cac9f51e2 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dd01e2)
#28 0x0000603cac9f6400 mlir::PassManager::run(mlir::Operation*) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x9dd1400)
#29 0x0000603ca521b767 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#30 0x0000603ca521c4ea 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
#31 0x0000603cacdc4731 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) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0xa19f731)
#32 0x0000603ca52138d0 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
#33 0x0000603ca521cb70 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x25f7b70)
#34 0x0000603ca521cda9 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x25f7da9)
#35 0x0000603ca504e023 main (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x2429023)
#36 0x00007e685502a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#37 0x00007e685502a28b call_init ./csu/../csu/libc-start.c:128:20
#38 0x00007e685502a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#39 0x0000603ca5133405 _start (/mnt/sdd1/sbw/mlir/tool/llvmorg-22.1.0-install/bin/mlir-opt+0x250e405)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs