Adds affine loop fusion transformation function to LoopFusionUtils.
Updates TestLoopFusion utility to run loop fusion transformation until a fixed point is reached.
Adds unit tests to test the transformation.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Unit tests: pass. 62057 tests passed, 0 failed and 784 were skipped.
clang-tidy: unknown.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Thanks for working on this Andy! Some minor comments
mlir/test/Transforms/loop-fusion-transformation.mlir | ||
---|---|---|
4 | nit: remove this first ----- so that we don't process an empty chunk? | |
18 | nit: for all these tests, please remove unnecessary lhs (e.g., %{{.*}} =) for loads, addf, and other ops if we don't capture their output in a variable | |
mlir/test/lib/Transforms/TestLoopFusion.cpp | ||
180 | Trye -> Try | |
187 | Would it make sense to have only the fixed point optimization "mode"? Do we need to keep the old mode for some reason (other than, maybe, fixing some tests)? |
Adds affine loop fusion transformation function to LoopFusionUtils.
Can you clarify here if it's moving something as opposed to introducing something new?
thanks. Sending update ...
mlir/include/mlir/Transforms/LoopFusionUtils.h | ||
---|---|---|
56 | They are inter-dependent: each source slice is computed for a specific dest insertion point. | |
mlir/test/lib/Transforms/TestLoopFusion.cpp | ||
45 | That name collides with another flag name. Eventually, we'll be able to get rid of the other test modes and collapse things down to one flag, but probably too soon right now. | |
187 | Once things stabilize, we can move towards having a fixed point mode. For now, its nice to have specific tests that check slice computation and fusion dependence checks. |
Unit tests: pass. 62323 tests passed, 0 failed and 838 were skipped.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
LGTM. Just a minor suggestion.
mlir/test/lib/Transforms/TestLoopFusion.cpp | ||
---|---|---|
187 | Ok, it makes sense to me, thanks! I would still suggest moving the transformation part (i.e, the code under the if condition (lines 187-200) to its own pass within this file so that we don't have to use both flags to test the transformation flavor. That code seems independent from the rest of the test pass. |
Unit tests: unknown.
clang-tidy: pass.
clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.
Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
Reverted in 2724ada8d2ddfec8f1e3d39f1d02f8b5d5224f1b as this broke the ASAN checker for a use-after-free in mlir::canFuseLoops(mlir::AffineForOp, mlir::AffineForOp, unsigned int, mlir::ComputationSliceState*) lib/Transforms/Utils/LoopFusionUtils.cpp:202:41
A bit strange to have the destination insertion point stored in srcSlice! Separate arg?