[mlir] Assertion `type.hasStaticShape() && "type must have static shape"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 81a8c66fdc96a7bf6927bf3f88d4b2e24a5c71e7
system: `Ubuntu 18.04.6 LTS`
reproduce with: `mlir-opt -gpu-to-llvm a.mlir`
a.mlir:
```mlir
module {
func.func @test_negative_ceildivui_tensor(%arg0: tensor<8x4x?xi64>) -> (tensor<8x4x?xi64>, tensor<8x4x?xi64>) {
%0 = arith.ceildivui %arg0, %arg0 : tensor<8x4x?xi64>
return %0, %0 : tensor<8x4x?xi64>, tensor<8x4x?xi64>
}
}
```
stack trace:
```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/IR/BuiltinAttributes.cpp:1219: static DenseElementsAttr mlir::DenseTypedElementsAttr::getRaw(ShapedType, ArrayRef): 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 and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -gpu-to-llvm 85.mlir
#0 0x0000556beedb60c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20360c8)
#1 0x0000556beedb2f61 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x2032f61)
#2 0x0000556beedb71e6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fe1e4720420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fe1e3d5d00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fe1e3d3c859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fe1e3d3c729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fe1e3d3c729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fe1e3d4dfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x0000556bf79ff736 mlir::DenseTypedElementsAttr::getRaw(mlir::ShapedType, llvm::ArrayRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xac7f736)
#10 0x0000556bf79ff2ac mlir::DenseElementsAttr::get(mlir::ShapedType, llvm::ArrayRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xac7f2ac)
#11 0x0000556bf5dc3b3a createConst(mlir::Location, mlir::Type, int, mlir::PatternRewriter&) ExpandOps.cpp:0:0
#12 0x0000556bf5dc3dc0 (anonymous namespace)::CeilDivUIOpConverter::matchAndRewrite(mlir::arith::CeilDivUIOp, mlir::PatternRewriter&) const ExpandOps.cpp:0:0
#13 0x0000556bf774327d void llvm::function_ref::callback_fn, llvm::function_ref, llvm::function_ref)::$_0>(long) PatternApplicator.cpp:0:0
#14 0x0000556bf773fbda mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref, llvm::function_ref, llvm::function_ref) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa9bfbda)
#15 0x0000556bf76f6f5a (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#16 0x0000556bf76f671c mlir::OperationConverter::convert(mlir::Operation*, bool) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa97671c)
#17 0x0000556bf76f7a80 mlir::OperationConverter::applyConversion(llvm::ArrayRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa977a80)
#18 0x0000556bf7705d69 void llvm::function_ref::callback_fn, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode)::$_0>(long) DialectConversion.cpp:0:0
#19 0x0000556bf76fce97 applyConversion(llvm::ArrayRef, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#20 0x0000556bf76fcf7b mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa97cf7b)
#21 0x0000556bf0a0c951 (anonymous namespace)::GpuToLLVMConversionPass::runOnOperation() GPUToLLVMConversion.cpp:0:0
#22 0x0000556bf779e662 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa1e662)
#23 0x0000556bf779f4a4 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+0xaa1f4a4)
#24 0x0000556bf77a63ba mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa263ba)
#25 0x0000556bf77a5cef mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa25cef)
#26 0x0000556beee653c0 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#27 0x0000556beee645f6 llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#28 0x0000556bf7af1e55 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad71e55)
#29 0x0000556beee5b656 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20db656)
#30 0x0000556beee5ba35 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20dba35)
#31 0x0000556beee5bd95 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20dbd95)
#32 0x0000556beed9bb52 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x201bb52)
#33 0x00007fe1e3d3e083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#34 0x0000556beed9b68e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x201b68e)
Aborted (core dumped)
```
Contributor guide
Research direction
Start with the reported mlir-opt -gpu-to-llvm reproducer and inspect ExpandOps.cpp, especially createConst and CeilDivUIOpConverter::matchAndRewrite, where the stack trace reaches the failed assertion. Verify the behavior with the supplied a.mlir input and ensure the reproducer no longer aborts on the dynamic-shape tensor.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100