llvm / llvm/llvm-project

[mlir] -remove-dead-values. Assertion `value' failed.

Open
#206,920 4 comments 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: 9e0aa61f75299f91b9e063ba46d2e33aa164cf7a

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt -remove-dead-values a.mlir`

a.mlir:

```mlir
module {
func.func private @fold_vector_transfer(%arg0: index, %arg1: memref, %arg2: index, %arg3: index) {
%cst = arith.constant 0.000000e+00 : f32
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c10 = arith.constant 10 : index
scf.for %arg4 = %c0 to %c10 step %c1 {
%0 = memref.load %arg1[%arg4] : memref
gpu.barrier
}
scf.for %arg4 = %c0 to %arg3 step %c1 {
%0 = memref.load %arg1[%arg4] : memref
gpu.barrier
}
return
}
}

```

stack trace:

```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/include/mlir/IR/Matchers.h:491: bool mlir::matchPattern(Value, const Pattern &) [Pattern = mlir::detail::constant_op_binder]: Assertion `value' 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 -remove-dead-values 105.mlir
#0 0x0000559ec694e7bb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x200d7bb)
#1 0x0000559ec694b621 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x200a621)
#2 0x0000559ec694f8e6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f9719be5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f971922200b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007f9719201859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007f9719201729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007f9719201729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007f9719212fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x0000559ecf9f53c6 mlir::Operation::fold(llvm::SmallVectorImpl&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xb0b43c6)
#10 0x0000559ecf6490bc (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#11 0x0000559ecf646822 mlir::applyOpPatternsGreedily(llvm::ArrayRef, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*, bool*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad05822)
#12 0x0000559ecf5e4898 (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#13 0x0000559ecf6ced58 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad8dd58)
#14 0x0000559ecf6cfd34 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+0xad8ed34)
#15 0x0000559ecf6d6dba mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad95dba)
#16 0x0000559ecf6d667f mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad9567f)
#17 0x0000559ec69fd7f0 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x0000559ec69fca26 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
#19 0x0000559ecfa36cd6 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+0xb0f5cd6)
#20 0x0000559ec69f3b76 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b2b76)
#21 0x0000559ec69f3f5a mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b2f5a)
#22 0x0000559ec69f42b5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b32b5)
#23 0x0000559ec69340c2 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff30c2)
#24 0x00007f9719203083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#25 0x0000559ec6933bfe _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff2bfe)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied a.mlir reproducer with the mlir-opt -remove-dead-values entry point. Inspect RemoveDeadValues.cpp and the failing matchPattern assertion in mlir/IR/Matchers.h to trace the invalid value. Done means the reproducer no longer aborts, with regression coverage for this input.

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
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.