llvm / llvm/llvm-project

[mlir] -test-written-to bug report

Open
#206,914 3 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 -test-written-to a.mlir`

a.mlir:

```mlir
module {
func.func @test(%arg0: memref<10xf32>) {
%c0 = arith.constant {tag = "zero"} 0 : index
%c1 = arith.constant {tag = "one"} 1 : index
%c10 = arith.constant {tag = "ten"} 10 : index
%0 = memref.load %arg0[%c1] : memref<10xf32>
%1 = memref.load %arg0[%c10] : memref<10xf32>
%2 = memref.load %arg0[%c0] : memref<10xf32>
%cst = arith.constant 8.000000e+00 : f32
%3 = memref.load %arg0[%c1] : memref<10xf32>
%4 = memref.load %arg0[%c10] : memref<10xf32>
memref.store %0, %arg0[%c1] : memref<10xf32>
memref.store %1, %arg0[%c10] : memref<10xf32>
memref.store %2, %arg0[%c0] : memref<10xf32>
return
}
}

```

stack trace:

```
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-written-to 91.mlir
#0 0x000055a3751207bb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x200d7bb)
#1 0x000055a37511d621 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x200a621)
#2 0x000055a3751218e6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fd251e1e420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x000055a37e10ced3 mlir::StringAttr::getValue() const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xaff9ed3)
#5 0x000055a375252f19 mlir::dataflow::Lattice<(anonymous namespace)::WrittenToLatticeValue>::print(llvm::raw_ostream&) const TestSparseBackwardDataFlowAnalysis.cpp:0:0
#6 0x000055a375253f7a void llvm::function_ref::callback_fn<(anonymous namespace)::TestWrittenToPass::runOnOperation()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) TestSparseBackwardDataFlowAnalysis.cpp:0:0
#7 0x000055a3751e21ae void mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20cf1ae)
#8 0x000055a3751e21ae void mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20cf1ae)
#9 0x000055a375251131 (anonymous namespace)::TestWrittenToPass::runOnOperation() TestSparseBackwardDataFlowAnalysis.cpp:0:0
#10 0x000055a37dea0d58 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)
#11 0x000055a37dea1d34 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)
#12 0x000055a37dea8dba mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad95dba)
#13 0x000055a37dea867f mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad9567f)
#14 0x000055a3751cf7f0 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#15 0x000055a3751cea26 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
#16 0x000055a37e208cd6 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)
#17 0x000055a3751c5b76 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)
#18 0x000055a3751c5f5a mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b2f5a)
#19 0x000055a3751c62b5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b32b5)
#20 0x000055a3751060c2 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff30c2)
#21 0x00007fd25143c083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#22 0x000055a375105bfe _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff2bfe)
Segmentation fault (core dumped)
test_tag: zero:
result #0: [```

Contributor guide

Open the contributing guide

Research direction

Start with the reproducer in a.mlir and run mlir-opt -test-written-to a.mlir. Then inspect TestSparseBackwardDataFlowAnalysis.cpp, especially WrittenToLatticeValue::print and the StringAttr::getValue call shown in the stack trace. Done means the command no longer segfaults on this input and regression coverage captures the failure.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.