[all-commits] [llvm/llvm-project] b16301: [mlir][bufferization] Add "bottom-up from terminat...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Wed Mar 20 22:15:19 PDT 2024
Branch: refs/heads/users/matthias-springer/bufferization_heuristic
Home: https://github.com/llvm/llvm-project
Commit: b16301f68e309527947fe26d38d9783a7369ec30
https://github.com/llvm/llvm-project/commit/b16301f68e309527947fe26d38d9783a7369ec30
Author: Matthias Springer <springerm at google.com>
Date: 2024-03-21 (Thu, 21 Mar 2024)
Changed paths:
M mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
M mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h
M mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
M mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
M mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
M mlir/test/Dialect/Arith/one-shot-bufferize.mlir
M mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-allow-return-allocs.mlir
A mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-analysis-bottom-up-from-terminators.mlir
M mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-partial.mlir
M mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize.mlir
M mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-allow-return-allocs.mlir
M mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-analysis.mlir
M mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
M mlir/test/Dialect/Linalg/one-shot-bufferize.mlir
M mlir/test/Dialect/SCF/one-shot-bufferize-analysis.mlir
M mlir/test/Dialect/SCF/one-shot-bufferize.mlir
M mlir/test/Dialect/Tensor/one-shot-bufferize.mlir
Log Message:
-----------
[mlir][bufferization] Add "bottom-up from terminators" analysis heuristic
One-Shot Bufferize currently does not support loops where a yielded value bufferizes to a buffer that is different from the buffer of the region iter_arg. In such a case, the bufferization fails with an error such as:
```
Yield operand #0 is not equivalent to the corresponding iter bbArg
scf.yield %0 : tensor<5xf32>
```
One common reason for non-equivalent buffers is that an op on the path from the region iter_arg to the terminator bufferizes out-of-place. Ops that are analyzed earlier are more likely to bufferize in-place.
This commit adds a new heuristic that gives preference to ops that are reachable on the reverse SSA use-def chain from a region terminator and are within the parent region of the terminator. This is expected to work better than the existing heuristics for loops where an iter_arg is written to multiple times within a loop, but only one write is fed into the terminator.
Current users of One-Shot Bufferize are not affected by this change. "Bottom-up" is still the default heuristic. Users can switch to the new heuristic manually.
This commit also turns the "fuzzer" pass option into a heuristic, cleaning up the code a bit.
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