This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Fix pattern benefit sorting between operation specific and operation agnostic patterns.
ClosedPublic

Authored by Hardcode84 on Mar 12 2021, 8:11 AM.

Details

Summary

Previously low benefit op-specific patterns never had a chance to match
even if high benefit op-agnostic pattern failed to match.

Diff Detail

Event Timeline

Hardcode84 created this revision.Mar 12 2021, 8:11 AM
Hardcode84 requested review of this revision.Mar 12 2021, 8:11 AM
Hardcode84 retitled this revision from Fix pattern benefit sorting between operation specific and operation agnostic patterns. to [MLIR] Fix pattern benefit sorting between operation specific and operation agnostic patterns..Mar 12 2021, 8:12 AM
rriddle added inline comments.Mar 16 2021, 11:49 AM
mlir/unittests/Rewrite/PatternBenefit.cpp
64

Can you test PatternApplicator directly instead of testing a user of it? That would also remove the need to create a function above.

Use PatternApplicator directly instead of applyPatternsAndFoldGreedely

rriddle accepted this revision.Mar 17 2021, 1:59 PM

LGTM

mlir/unittests/Rewrite/PatternBenefit.cpp
22

Can you add a couple of general comments in this test?

This revision is now accepted and ready to land.Mar 17 2021, 1:59 PM

Added comment to test

I don't have commit access, can you please merge this

Can you rebase? There have been some changes recently in there.

It seems this was already fixed upstream, only test remained

OK! I'll land this later today, but feel free to ask for commit access: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

(If you get access before I land this, feel free to land it yourself!)