LinalgDependenceGraph was not updated after successful producer-consumer fusion for linalg ops. In this patch it is fixed by reconstructing LinalgDependenceGraph on every iteration. This is very ineffective and should be improved by updating LDGraph only when it is necessary.
Details
- Reviewers
nicolasvasilache
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@nicolasvasilache This is not the best way of doing this update, I just wanted you to check if the idea is correct.
Unit tests: pass. 62094 tests passed, 0 failed and 785 were skipped.
clang-tidy: unknown.
clang-format: pass.
Build artifacts: diff.json, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp | ||
---|---|---|
345 | llvm::find(linalgOps, originalOp)? |
Please split out the NFC changes in a separate diff.
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp | ||
---|---|---|
340 | Well that is a really dirty "fix" :) Let's let this fly for now but please adda big TODO that the graph needs to support mutation. | |
mlir/test/Dialect/Linalg/fusion.mlir | ||
27 | please avoid mixing in NFC formatting changes in the flow and send a separate CL for that. |
Unit tests: fail. 62343 tests passed, 1 failed and 839 were skipped.
failed: libc++.std/containers/sequences/array/array_creation/to_array.fail.cpp
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.
Approved conditioned on beefing up the test and having no reordering surprises.
mlir/test/Dialect/Linalg/fusion.mlir | ||
---|---|---|
265 | Sorry for being annoying but there is a risk of bad ordering here and I cannot tell whether this is correct. In the end we can only have: linalg.matmul(%A, %B, %C) linalg.matmul(%C, %B, %D) linalg.matmul(%5, %7, %8) i.e. we need to make sure that there is no bypass. Thanks! |
@nicolasvasilache No problem, I captured the indices. But please, check if the fusion is correct.
Unit tests: pass. 62414 tests passed, 0 failed and 839 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.
The syntactic order of statements is good.
The fusion rules are too lenient and we end up recomputing things too many times.
This is a know current issue that I need to fix, filing a bug for it.
The TL;DR is do not count on fusion with reductions to compute the correct value atm.
Well that is a really dirty "fix" :)
It's true however that it is a problem with the current LinalgDependenceGraph impl that does not know how to update itself.
Still that problem already existed because the graph is recreated at each pattern invocation.
Let's let this fly for now but please adda big TODO that the graph needs to support mutation.