llvm / llvm/llvm-project

[mlir](convert-to-llvm) mlir-opt crashes with convert-to-llvm=allow-pattern-rollback=0

Open
#205,702 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: 6a15e2d75623860436271e52513cc2ca43991e70

MLIR Program:
```mlir
module {
func.func @m0() {
%0 = shape.const_shape [1, 2] : !shape.shape
%1 = shape.cstr_eq %0 : !shape.shape
return
}
}
```

Reproduce Command: `mlir-opt -convert-to-llvm=allow-pattern-rollback=0 a.mlir`

StackTrace:
```
LLVM ERROR: op 'shape.cstr_eq' folder rollback of IR modifications requested
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: /data2/dependency/dev/llvm-project/build/bin/mlir-opt -convert-to-llvm=allow-pattern-rollback=0 a.mlir
#0 0x000055b5cb2c623f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25cf23f)
#1 0x000055b5cb2c29fc llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25cb9fc)
#2 0x000055b5cb2c2b97 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f1af5f85420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f1af5a7000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f1af5a4f859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x000055b5cb1ea705 (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24f3705)
#7 0x000055b5cb2a3294 (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25ac294)
#8 0x000055b5d404aea9 (anonymous namespace)::OperationLegalizer::legalizeWithFold(mlir::Operation*) DialectConversion.cpp:0:0
#9 0x000055b5d404b463 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#10 0x000055b5d404b8e6 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3548e6)
#11 0x000055b5d405681a mlir::OperationConverter::applyConversion(llvm::ArrayRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb35f81a)
#12 0x000055b5d40580f8 applyConversion(llvm::ArrayRef, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#13 0x000055b5d40582d6 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3612d6)
#14 0x000055b5cce96a5f (anonymous namespace)::StaticConvertToLLVM::transform(mlir::Operation*, mlir::AnalysisManager) const ConvertToLLVMPass.cpp:0:0
#15 0x000055b5cce956da (anonymous namespace)::ConvertToLLVMPass::runOnOperation() ConvertToLLVMPass.cpp:0:0
#16 0x000055b5d4103051 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb40c051)
#17 0x000055b5d41033e0 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb40c3e0)
#18 0x000055b5d4105494 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb40e494)
#19 0x000055b5d4106521 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb40f521)
#20 0x000055b5cb38c2db performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x000055b5cb38cd83 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#22 0x000055b5cb38d00b llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#23 0x000055b5d44dc515 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7e5515)
#24 0x000055b5cb383114 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#25 0x000055b5cb38d527 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2696527)
#26 0x000055b5cb38d763 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2696763)
#27 0x000055b5cb1f2b8c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24fbb8c)
#28 0x00007f1af5a51083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x000055b5cb2a292e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25ab92e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the supplied MLIR program and mlir-opt command, then trace the conversion through ConvertToLLVMPass.cpp and DialectConversion.cpp. Done means the allow-pattern-rollback=0 invocation handles shape.cstr_eq without aborting; add regression coverage where the existing MLIR conversion tests belong.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.