[all-commits] [llvm/llvm-project] b91cc9: [mlir][bufferization] Fix bug in bufferization of ...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Sun Jun 30 04:55:34 PDT 2024
Branch: refs/heads/users/matthias-springer/fix_elementwise_bufferization
Home: https://github.com/llvm/llvm-project
Commit: b91cc91f918e61adc9e55276fa43261c1ccceb23
https://github.com/llvm/llvm-project/commit/b91cc91f918e61adc9e55276fa43261c1ccceb23
Author: Matthias Springer <mspringer at nvidia.com>
Date: 2024-06-30 (Sun, 30 Jun 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
There is an optimization in One-Shot Bufferize wrt. ops that bufferize to elementwise access. In such cases, 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 operand. 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