[MLIR] Fix affine fusion bug/efficiency issue / enable more fusion
The list of destination load ops while evaluating producer-consumer fusion wasn't being maintained as a set, and as such, duplicate load ops were being added to it. Although this is harmless correctness-wise, it's a killer efficiency-wise and it prevents interesting/useful fusions (including for eg. reshapes into a matmul). The reason the latter fusions would be missed is that a slice union would be unnecessarily needed due to the duplicate load ops on a memref added to the 'dst loads' list. Since slice union is unimplemented for the local var case, a single destination load op that leads to local vars (like a floordiv / mod producing fusion), a common case, would not get fused due to an unnecessary union being tried with itself. (The union would actually be the same thing but we would bail out.) Besides the above, this would also significantly speed up fusion as all the unnecessary slice computations / unions, checks, etc. due to the duplicates go away. Differential Revision: https://reviews.llvm.org/D79547
Loading
Please register or sign in to comment