llvm / llvm/llvm-project

[mlir][affine](affine-loop-unroll) mlir-opt crashes at Affine/Utils/LoopUtils.cpp:1001 with assertion `unrollFactor > 0 && "unroll factor should be positive"' failed.

Open
#220,458 2 comments 0 reactions 1 assignee Claimed by @CoTinker View on GitHub
crash mlir:affine
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

git version: 42f2cd0c980cc1a924619ecaeaa51ca7b55164ab

MLIR Program:
```mlir
module {
func.func @m() {
affine.for %arg0 = 0 to 1 step 4 {
affine.for %arg1 = 0 to 0 {
}
}
return
}
}
```

Reproduce Command: `mlir-opt '-pass-pipeline=builtin.module(func.func(affine-loop-unroll{unroll-up-to-factor=true}))' a.mlir`

StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp:1001: llvm::LogicalResult mlir::affine::loopUnrollByFactor(mlir::affine::AffineForOp, uint64_t, mlir::function_ref, bool): Assertion `unrollFactor > 0 && "unroll factor should be positive"' 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: mlir-opt -pass-pipeline=builtin.module(func.func(affine-loop-unroll{unroll-up-to-factor=true})) a.mlir
#0 0x000055811db51aff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20adaff)
#1 0x000055811db4e65c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20aa65c)
#2 0x000055811db4e803 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fbc1798a420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fbc1747500b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fbc17454859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fbc17454729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fbc17465fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x000055812545e057 mlir::affine::loopUnrollByFactor(mlir::affine::AffineForOp, unsigned long, llvm::function_ref, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x99ba057)
#9 0x000055812545e1bc mlir::affine::loopUnrollUpToFactor(mlir::affine::AffineForOp, unsigned long) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x99ba1bc)
#10 0x000055812540f28d (anonymous namespace)::LoopUnroll::runOnOperation() LoopUnroll.cpp:0:0
#11 0x0000558127093f81 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5eff81)
#12 0x0000558127094310 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+0xb5f0310)
#13 0x0000558127094bee mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda12'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#14 0x0000558127092f7c mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5eef7c)
#15 0x0000558127093e5b mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5efe5b)
#16 0x0000558127094310 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+0xb5f0310)
#17 0x00005581270963c4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f23c4)
#18 0x0000558127097491 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f3491)
#19 0x000055811dc17f7b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x000055811dc18abf processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#21 0x000055811dc18ceb 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
#22 0x000055812747be55 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+0xb9d7e55)
#23 0x000055811dc0ed34 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#24 0x000055811dc19207 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175207)
#25 0x000055811dc19443 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175443)
#26 0x000055811dab89e7 main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20149e7)
#27 0x00007fbc17456083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#28 0x000055811db2e48e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x208a48e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.