Issue 76281
Summary [mlir] --affine-loop-fusion causes the Segmentation Fault.
Labels
Assignees
Reporter anonymousMCS
    git version: 31aa7d2de018693a6b45c9056a67229c54461b8f

system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```

reproduced with: ```mlir-opt --affine-loop-fusion a.mlir```

a.mlir:

```
#map1 = affine_map<(d0) -> (d0)>
#map4 = affine_map<(d0) -> (d0 + ((-d0 + 3) floordiv 4) * 4)>
func.func @func1(%arg0: memref<22x3xi1>, %arg1: vector<22x3xf32>) {
  %c0 = arith.constant 0 : index
  %f11 = arith.constant 1.1 : f16
  %192 = tensor.empty() : tensor<f16>
  %193 = bufferization.to_memref %192 : memref<f16>
  %alloc_66 = memref.alloc() : memref<f16, 1>
  %alloc_68 = memref.alloc() : memref<1xi32>
 affine.for %arg2 = 4 to 6 {
    affine.for %arg3 = #map1(%arg2) to #map4(%arg2) step 4 {
      %272 = arith.addf %f11, %f11 : f16
 affine.store %272, %alloc_66[] : memref<f16, 1>
    }
    affine.for %arg3 = #map4(%arg2) to 3 {
      %252 = affine.load %alloc_66[] : memref<f16, 1>
    }
  }
  affine.dma_start %alloc_66[], %193[], %alloc_68[%c0], %c0 : memref<f16, 1>, memref<f16>, memref<1xi32>
 return
}
```

trace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --affine-loop-fusion a.mlir
 #0 0x000055d1cefa5b2f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x167fb2f)
 #1 0x000055d1cefa2b84 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f5c196b2420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x000055d1cf0d8990 isEscapingMemref(mlir::Value, mlir::Block*) LoopFusion.cpp:0:0
 #4 0x000055d1cf0da490 (anonymous namespace)::GreedyFusion::performFusionsIntoDest(unsigned int, unsigned int) LoopFusion.cpp:0:0
 #5 0x000055d1cf0de6b9 (anonymous namespace)::LoopFusion::runOnOperation()::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const (.isra.0) LoopFusion.cpp:0:0
 #6 0x000055d1cf0cf3cc void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (.constprop.2) LoopFusion.cpp:0:0
 #7 0x000055d1cf0df1d1 (anonymous namespace)::LoopFusion::runOnOperation() LoopFusion.cpp:0:0
 #8 0x000055d1d1c8f72e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x436972e)
 #9 0x000055d1d1c8fc0a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4369c0a)
#10 0x000055d1d1c903d4 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x436a3d4)
#11 0x000055d1d1c812b3 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#12 0x000055d1d1c82784 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
#13 0x000055d1d1c82934 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
#14 0x000055d1d1d7e7e4 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) (/data/bin/llvm-project/build/bin/mlir-opt+0x44587e4)
#15 0x000055d1d1c7b197 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4355197)
#16 0x000055d1d1c82a81 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x435ca81)
#17 0x000055d1d1c82ee6 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x435cee6)
#18 0x000055d1ceedc5e3 main (/data/bin/llvm-project/build/bin/mlir-opt+0x15b65e3)
#19 0x00007f5c1917e083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000055d1cef7562e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x164f62e)
Segmentation fault (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to