[all-commits] [llvm/llvm-project] cf9b77: [mlir][bufferization] Fix bug in bufferization of ...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Mon Jul 1 10:00:42 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cf9b77a636e0e92b1f4cafd99aaff394f4773f08
https://github.com/llvm/llvm-project/commit/cf9b77a636e0e92b1f4cafd99aaff394f4773f08
Author: Matthias Springer <me at m-sp.org>
Date: 2024-07-01 (Mon, 01 Jul 2024)
Changed paths:
M mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
M mlir/test/Dialect/Linalg/one-shot-bufferize-analysis.mlir
Log Message:
-----------
[mlir][bufferization] Fix bug in bufferization of elementwise ops (#97209)
There is an optimization in One-Shot Bufferize wrt. ops that bufferize
to elementwise access. A copy can sometimes be avoided. E.g.:
```
%0 = tensor.empty()
%1 = tensor.fill ...
%2 = linalg.map ins(%1, ...) outs(%1)
```
In the above example, a buffer copy is not needed for %1, even though
the same buffer is read/written by two different operands (of the same
op). That's because the op bufferizes to elementwise access.
```c++
// Two equivalent operands of the same op are not conflicting if the op
// bufferizes to element-wise access. I.e., all loads at a position
// happen before all stores to the same position.
```
This optimization cannot be applied when op dominance cannot be used to
rule out conflicts. E.g., when the `linalg.map` is inside of a loop. In
such a case, the reads/writes happen multiple times and it is not
guaranteed that "all loads at a position happen before all stores to the
same position."
Fixes #90019.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list