Skip to content

[mlir][arith] -convert-arith-to-llvm crashes in BuiltinAttributes.cpp:1349: static DenseElementsAttr mlir::DenseIntOrFPElementsAttr::getRaw(ShapedType, ArrayRef<char>): Assertion `type.hasStaticShape() && "type must have static shape"' failed. #108156

@anonymoususer-12

Description

@anonymoususer-12

git version: 761bf33

system: Ubuntu 18.04.6 LTS

reproduce with: mlir-opt -convert-arith-to-llvm a.mlir

a.mlir:

func.func @test_subi(%A : tensor<?x32xi32>, %B : tensor<?x32xi32>, %C : tensor<?x?xi32>) {
  %0 = arith.subi %A, %B : tensor<?x32xi32>
  %1 = arith.subi %C, %C : tensor<?x?xi32>
  return
}

stack trace:

mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/IR/BuiltinAttributes.cpp:1349: static DenseElementsAttr mlir::DenseIntOrFPElementsAttr::getRaw(ShapedType, ArrayRef<char>): Assertion `type.hasStaticShape() && "type must have static shape"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -convert-arith-to-llvm a.mlir
 #0 0x00005603dd277128 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d7128)
 #1 0x00005603dd274c3e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d4c3e)
 #2 0x00005603dd277abd SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fc82ad2e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fc82a36b00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007fc82a34a859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007fc82a34a729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007fc82a34a729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007fc82a35bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x00005603e045baba mlir::DenseIntOrFPElementsAttr::getRaw(mlir::ShapedType, llvm::ArrayRef<char>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42bbaba)
#10 0x00005603e045a8d5 mlir::DenseElementsAttr::get(mlir::ShapedType, llvm::ArrayRef<mlir::Attribute>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42ba8d5)
#11 0x00005603e044dc31 mlir::Builder::getZeroAttr(mlir::Type) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42adc31)
#12 0x00005603dd451078 mlir::arith::SubIOp::fold(mlir::arith::SubIOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x12b1078)
#13 0x00005603dd533bde llvm::LogicalResult mlir::Op<mlir::arith::SubIOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::Type>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::NOperands<2u>::Impl, mlir::OpTrait::OpInvariants, mlir::BytecodeOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait, mlir::InferIntRangeInterface::Trait, mlir::arith::ArithIntegerOverflowFlagsInterface::Trait, mlir::OpTrait::SameOperandsAndResultType, mlir::VectorUnrollOpInterface::Trait, mlir::OpTrait::Elementwise, mlir::OpTrait::Scalarizable, mlir::OpTrait::Vectorizable, mlir::OpTrait::Tensorizable, mlir::InferTypeOpInterface::Trait>::foldSingleResultHook<mlir::arith::SubIOp>(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1393bde)
#14 0x00005603dd532010 mlir::RegisteredOperationName::Model<mlir::arith::SubIOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1392010)
#15 0x00005603e050c4fd mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x436c4fd)
#16 0x00005603e050c8a3 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x436c8a3)
#17 0x00005603e044e9ca mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42ae9ca)
#18 0x00005603e03c87dc (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#19 0x00005603e03c7bb7 mlir::OperationConverter::convert(mlir::ConversionPatternRewriter&, mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4227bb7)
#20 0x00005603e03c8d7f mlir::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4228d7f)
#21 0x00005603e03d096b mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x423096b)
#22 0x00005603df9d01de (anonymous namespace)::ArithToLLVMConversionPass::runOnOperation() ArithToLLVM.cpp:0:0
#23 0x00005603e03692d6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c92d6)
#24 0x00005603e0369c40 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c9c40)
#25 0x00005603e036c282 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41cc282)
#26 0x00005603e0364ab1 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#27 0x00005603e036470b 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
#28 0x00005603e04113a5 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) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42713a5)
#29 0x00005603e035fb35 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfb35)
#30 0x00005603e035fddf mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41bfddf)
#31 0x00005603e036010e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41c010e)
#32 0x00005603dd257d67 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b7d67)
#33 0x00007fc82a34c083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#34 0x00005603dd2578ee _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10b78ee)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]mlir:arith

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions