llvm / llvm/llvm-project

[mlir] Assertion `castSrcLastDim % castDstLastDim == 0' failed.

Open
#206,090 1 comment 0 reactions 0 assignees View on GitHub
crash mlir
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 -test-vector-break-down-bitcast a.mlir`

a.mlir:

```mlir
module {
func.func @f2(%arg0: vector<16xi16>) -> vector<3xi16> {
%0 = arith.trunci %arg0 : vector<16xi16> to vector<16xi3>
%1 = vector.bitcast %0 : vector<16xi3> to vector<3xi16>
return %1 : vector<3xi16>
}
}

```

stack trace:

```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp:932: virtual LogicalResult (anonymous namespace)::BreakDownVectorBitCast::matchAndRewrite(vector::BitCastOp, PatternRewriter &) const: Assertion `castSrcLastDim % castDstLastDim == 0' 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 -test-vector-break-down-bitcast 84.mlir
#0 0x000055a4a0b080c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20360c8)
#1 0x000055a4a0b04f61 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x2032f61)
#2 0x000055a4a0b091e6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fe9a1f3e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fe9a157b00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fe9a155a859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fe9a155a729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fe9a155a729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fe9a156bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x000055a4a75a26ee (anonymous namespace)::BreakDownVectorBitCast::matchAndRewrite(mlir::vector::BitCastOp, mlir::PatternRewriter&) const VectorTransforms.cpp:0:0
#10 0x000055a4a949527d void llvm::function_ref::callback_fn, llvm::function_ref, llvm::function_ref)::$_0>(long) PatternApplicator.cpp:0:0
#11 0x000055a4a9491bda 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)
#12 0x000055a4a946a4b4 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#13 0x000055a4a9469532 void llvm::function_ref::callback_fn<(anonymous namespace)::RegionPatternRewriteDriver::simplify(bool*) &&::$_2>(long) GreedyPatternRewriteDriver.cpp:0:0
#14 0x000055a4a946651b mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xa99451b)
#15 0x000055a4a1358455 (anonymous namespace)::TestVectorBreakDownBitCast::runOnOperation() TestVectorTransforms.cpp:0:0
#16 0x000055a4a94f0662 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)
#17 0x000055a4a94f14a4 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)
#18 0x000055a4a94fc02e auto void mlir::parallelForEach<__gnu_cxx::__normal_iterator>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_12>(mlir::MLIRContext*, __gnu_cxx::__normal_iterator>>, __gnu_cxx::__normal_iterator>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_12&&)::'lambda'(__gnu_cxx::__normal_iterator>>&&)::operator()(__gnu_cxx::__normal_iterator>>&&) const Pass.cpp:0:0
#19 0x000055a4a94f4158 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa22158)
#20 0x000055a4a94f0847 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa1e847)
#21 0x000055a4a94f14a4 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)
#22 0x000055a4a94f83ba mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa263ba)
#23 0x000055a4a94f7cef mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaa25cef)
#24 0x000055a4a0bb73c0 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x000055a4a0bb65f6 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
#26 0x000055a4a9843e55 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)
#27 0x000055a4a0bad656 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)
#28 0x000055a4a0bada35 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20dba35)
#29 0x000055a4a0badd95 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20dbd95)
#30 0x000055a4a0aedb52 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x201bb52)
#31 0x00007fe9a155c083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#32 0x000055a4a0aed68e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x201b68e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Start with the assertion in mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp and the TestVectorBreakDownBitCast entry point mentioned in the stack trace. Run mlir-opt -test-vector-break-down-bitcast on the provided a.mlir input; done means the input no longer aborts at the assertion and the regression behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.