[all-commits] [llvm/llvm-project] 441b67: [mlir] Fix block merging (#102038)
Giuseppe Rossini via All-commits
all-commits at lists.llvm.org
Wed Aug 7 01:10:23 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 441b672bbdc68ad88036f3e258759854c8283adb
https://github.com/llvm/llvm-project/commit/441b672bbdc68ad88036f3e258759854c8283adb
Author: Giuseppe Rossini <giuseppe.rossini at amd.com>
Date: 2024-08-07 (Wed, 07 Aug 2024)
Changed paths:
M mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
M mlir/lib/Transforms/Utils/RegionUtils.cpp
M mlir/test/Dialect/Bufferization/Transforms/OwnershipBasedBufferDeallocation/dealloc-branchop-interface.mlir
M mlir/test/Dialect/Linalg/detensorize_entry_block.mlir
M mlir/test/Dialect/Linalg/detensorize_if.mlir
M mlir/test/Dialect/Linalg/detensorize_while.mlir
M mlir/test/Dialect/Linalg/detensorize_while_impure_cf.mlir
M mlir/test/Dialect/Linalg/detensorize_while_pure_cf.mlir
M mlir/test/Transforms/canonicalize-block-merge.mlir
M mlir/test/Transforms/canonicalize-dce.mlir
M mlir/test/Transforms/make-isolated-from-above.mlir
A mlir/test/Transforms/test-canonicalize-merge-large-blocks.mlir
Log Message:
-----------
[mlir] Fix block merging (#102038)
With this PR I am trying to address:
https://github.com/llvm/llvm-project/issues/63230.
What changed:
- While merging identical blocks, don't add a block argument if it is
"identical" to another block argument. I.e., if the two block arguments
refer to the same `Value`. The operations operands in the block will
point to the argument we already inserted. This needs to happen to all
the arguments we pass to the different successors of the parent block
- After merged the blocks, get rid of "unnecessary" arguments. I.e., if
all the predecessors pass the same block argument, there is no need to
pass it as an argument.
- This last simplification clashed with
`BufferDeallocationSimplification`. The reason, I think, is that the two
simplifications are clashing. I.e., `BufferDeallocationSimplification`
contains an analysis based on the block structure. If we simplify the
block structure (by merging and/or dropping block arguments) the
analysis is invalid . The solution I found is to do a more prudent
simplification when running that pass.
**Note-1**: I ran all the integration tests
(`-DMLIR_INCLUDE_INTEGRATION_TESTS=ON`) and they passed.
**Note-2**: I fixed a bug found by @Dinistro in #97697 . The issue was
that, when looking for redundant arguments, I was not considering that
the block might have already some arguments. So the index (in the block
args list) of the i-th `newArgument` is `i+numOfOldArguments`.
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