[all-commits] [llvm/llvm-project] 1e1a31: [mlir][bufferization] Privatize buffers for parall...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Sep 6 05:37:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e1a3112f123de010c58af08ad87ae1dee20ff05
      https://github.com/llvm/llvm-project/commit/1e1a3112f123de010c58af08ad87ae1dee20ff05
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-09-06 (Wed, 06 Sep 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
    M mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
    M mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
    M mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
    M mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
    M mlir/test/Dialect/SCF/one-shot-bufferize-analysis.mlir

  Log Message:
  -----------
  [mlir][bufferization] Privatize buffers for parallel regions

One-Shot Bufferize correctly handles RaW conflicts around repetitive regions (loops). Specical handling is needed for parallel regions. These are a special kind of repetitive regions that can have additional RaW conflicts that would not be present if the regions would be executed sequentially.

Example:
```
%0 = bufferization.alloc_tensor()
scf.forall ... {
  %1 = linalg.fill ins(...) outs(%0)
  ...
  scf.forall.in_parallel {
    tensor.parallel_insert_slice %1 into ...
  }
}
```

A separate (private) buffer must be allocated for each iteration of the `scf.forall` loop.

This change adds a new interface method to `BufferizableOpInterface` to detect parallel regions. By default, regions are assumed to be sequential.

A buffer is privatized if an OpOperand bufferizes to a memory read inside a parallel region that is different from the parallel region where operand's value is defined.

Differential Revision: https://reviews.llvm.org/D159286




More information about the All-commits mailing list