llvm-project
llvm-project copied to clipboard
[MLIR]`-test-loop-unrolling` pass: `mlir::loopUnrollByFactor` leads to assertion `upperBoundUnrolledCst <= ubCst'
Test commit: https://github.com/llvm/llvm-project/commit/c3440e213ca02c2fcd91f3f8cf65774a2b1a9e6f
Steps to reproduce:
mlir-opt test.mlir -test-loop-unrolling=unroll-factor=2
Test case:
#map = affine_map<(d0)[s0] -> (2, -d0 + s0)>
module {
func.func @main(%arg0: memref<i64>) {
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
%c4 = arith.constant 4 : index
scf.for %arg1 = %c1 to %c4 step %c2 {
%0 = affine.min #map(%arg1)[%c4]
}
return
}
}
crash trace:
mlir-opt: /home/ty/llvm-project/mlir/lib/Dialect/SCF/Utils/Utils.cpp:498: mlir::LogicalResult mlir::loopUnrollByFactor(mlir::scf::ForOp, uint64_t, mlir::function_ref<void(unsigned int, mlir::Operation*, mlir::OpBuilder)>): Assertion `upperBoundUnrolledCst <= ubCst' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/ty/llvm-project/build/bin/mlir-opt test.mlir "-test-loop-unrolling=unroll-factor=2 "
#0 0x000055b9d54880da llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ty/llvm-project/build/bin/mlir-opt+0x22b0da)
#1 0x000055b9d548536c SignalHandler(int) Signals.cpp:0:0
#2 0x00007f12c455d980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#3 0x00007f12c320ee87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#4 0x00007f12c32107f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
#5 0x00007f12c32003fa __assert_fail_base /build/glibc-CVJwZb/glibc-2.27/assert/assert.c:89:0
#6 0x00007f12c3200472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
#7 0x000055b9d603824f mlir::loopUnrollByFactor(mlir::scf::ForOp, unsigned long, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>) (/home/ty/llvm-project/build/bin/mlir-opt+0xddb24f)
#8 0x000055b9d6a14e8f (anonymous namespace)::TestLoopUnrollingPass::runOnOperation() TestLoopUnrolling.cpp:0:0
#9 0x000055b9d6da2bee mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/ty/llvm-project/build/bin/mlir-opt+0x1b45bee)
#10 0x000055b9d6da3a43 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (.constprop.510) Pass.cpp:0:0
#11 0x000055b9d6da40cd mlir::PassManager::run(mlir::Operation*) (/home/ty/llvm-project/build/bin/mlir-opt+0x1b470cd)
#12 0x000055b9d6d98043 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#13 0x000055b9d6d98711 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#14 0x000055b9d6d98901 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#15 0x000055b9d6e6a810 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/home/ty/llvm-project/build/bin/mlir-opt+0x1c0d810)
#16 0x000055b9d6d93a23 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/home/ty/llvm-project/build/bin/mlir-opt+0x1b36a23)
#17 0x000055b9d6d9624e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (/home/ty/llvm-project/build/bin/mlir-opt+0x1b3924e)
#18 0x000055b9d54540c0 main (/home/ty/llvm-project/build/bin/mlir-opt+0x1f70c0)
#19 0x00007f12c31f1c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x000055b9d5466f2a _start (/home/ty/llvm-project/build/bin/mlir-opt+0x209f2a)
Aborted (core dumped)
@llvm/issue-subscribers-mlir