This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Linalg] Fuse-into-containing handle fully overlapped consumers
AbandonedPublic

Authored by kaitingwang on Jun 1 2023, 6:36 PM.

Details

Summary

When fuse-into-containing a fill producer which has multiple fully overlapped extract_slice consumers, we can fuse and fill a single extracted slice for the first consumer and reuse the same filled slice for the other fully overlapped consumers. Fully overlapped is defined as having the same offset, size, stride parameters.

Diff Detail

Event Timeline

kaitingwang created this revision.Jun 1 2023, 6:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2023, 6:36 PM
kaitingwang requested review of this revision.Jun 1 2023, 6:36 PM

Hello @ftynse @springerm @nicolasvasilache would really appreciate your feedback on this PR. Thank you!

Thanks @kaitingwang, quick question, couldn't you achieve what you are doing here automatically with cse instead of extending the capabilities of fusion?
I would expect it to be the case and if not I would like to understand whether something is missing?

Thanks @kaitingwang, quick question, couldn't you achieve what you are doing here automatically with cse instead of extending the capabilities of fusion?
I would expect it to be the case and if not I would like to understand whether something is missing?

@nicolasvasilache Thank you for the reminder! I looked into our pipeline and we indeed use -cse. However, we had missed running -canonicalize before -cse (we mistakenly ran canonicalize after cse). After switching the order of the flags, cse is indeed able to remove the duplicated computation. I'll close the PR!

kaitingwang abandoned this revision.Jun 10 2023, 7:54 AM