Issue 64321
Summary [mlir] `affine-loop-unroll` Pass crashed when assigning a 0 unroll factor
Labels
Assignees
Reporter Colloportus0
    MLIR built at commit  b4c54b20
Reproduced with:  
` mlir-opt "--affine-loop-unroll=unroll-factor=0" temp.mlir`

temp.mlir:
``` milr 
  func.func @func2(%arg0: index, %arg1: vector<32xi32>)  {
 %c761048054_i32 = arith.constant 761048054 : i32
    %c2 = arith.constant 2 : index
    %c13 = arith.constant 13 : index 
    %1 = tensor.empty(%c13) : tensor<?xi32>
    %4 = tensor.empty() : tensor<32x30xi32>
    %57 = vector.broadcast %c761048054_i32 : i32 to vector<30xi32>
    %91 = affine.for %arg2 = 0 to 49 iter_args(%arg3 = %1) -> (tensor<?xi32>) {
      %126 = tensor.empty(%c2) : tensor<?xi32>
 affine.yield %126 : tensor<?xi32>
    } 
    return 
 }
```
 
trace:
```console
Assertion failed: (unrollFactor > 0 && "unroll factor should be positive"), function loopUnrollByFactor, file LoopUtils.cpp, line 1019.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: mlir-opt --affine-loop-unroll=unroll-factor=0 temp.mlir
 #0 0x0000000101218548 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workspace/build/bin/mlir-opt+0x1002f8548)
 #1 0x00000001012167e4 llvm::sys::RunSignalHandlers() (/workspace/build/bin/mlir-opt+0x1002f67e4)
 #2 0x0000000101218bf4 SignalHandler(int) (/workspace/build/bin/mlir-opt+0x1002f8bf4)
 #3 0x00000001a46cd4c4 (/usr/lib/system/libsystem_platform.dylib+0x1803414c4)
 #4 0x00000001a46b5ee0 (/usr/lib/system/libsystem_pthread.dylib+0x180329ee0)
 #5 0x00000001a45f0340 (/usr/lib/system/libsystem_c.dylib+0x180264340)
 #6 0x00000001a45ef754 (/usr/lib/system/libsystem_c.dylib+0x180263754)
 #7 0x000000010505d264 mlir::affine::loopUnrollByFactor(mlir::affine::AffineForOp, unsigned long long, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>, bool) (.cold.2) (/workspace/build/bin/mlir-opt+0x10413d264)
 #8 0x0000000101306b74 mlir::affine::loopUnrollByFactor(mlir::affine::AffineForOp, unsigned long long, llvm::function_ref<void (unsigned int, mlir::Operation*, mlir::OpBuilder)>, bool) (/workspace/build/bin/mlir-opt+0x1003e6b74)
 #9 0x00000001012e713c (anonymous namespace)::LoopUnroll::runOnOperation() (/workspace/build/bin/mlir-opt+0x1003c713c)
#10 0x00000001038a1e34 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x102981e34)
#11 0x00000001038a2524 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102982524)
#12 0x00000001038a35d8 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/workspace/build/bin/mlir-opt+0x1029835d8)
#13 0x00000001038a1f90 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/workspace/build/bin/mlir-opt+0x102981f90)
#14 0x00000001038a2524 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/workspace/build/bin/mlir-opt+0x102982524)
#15 0x00000001038a43bc mlir::PassManager::run(mlir::Operation*) (/workspace/build/bin/mlir-opt+0x1029843bc)
#16 0x000000010389c808 performActions(llvm::raw_ostream&, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x10297c808)
#17 0x000000010389bd30 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_1>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) (/workspace/build/bin/mlir-opt+0x10297bd30)
#18 0x000000010391abe0 mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/workspace/build/bin/mlir-opt+0x1029fabe0)
#19 0x00000001038966e4 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/workspace/build/bin/mlir-opt+0x1029766e4)
#20 0x0000000103896b54 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/workspace/build/bin/mlir-opt+0x102976b54)
#21 0x0000000100f2358c main (/workspace/build/bin/mlir-opt+0x10000358c)
#22 0x000000010c565088 

``` 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to