This is an archive of the discontinued LLVM Phabricator instance.

[mlir][affine] Add canonicalization to merge affine min/max ops
ClosedPublic

Authored by antiagainst on Mar 20 2021, 7:37 AM.

Details

Summary

This identifies a pattern where the producer affine min/max op
is bound to a dimension/symbol that is used as a standalone
expression in the consumer affine op's map. In that case the
producer affine min/max op can be merged into its consumer.

For example, a pattern like the following:

%0 = affine.min affine_map<()[s0] -> (s0 + 16, s0 * 8)> ()[%sym1]
%1 = affine.min affine_map<(d0)[s0] -> (s0 + 4, d0)> (%0)[%sym2]

Can be turned into:

%1 = affine.min affine_map<
       ()[s0, s1] -> (s0 + 4, s1 + 16, s1 * 8)> ()[%sym2, %sym1]

Depends On D99015

Diff Detail

Event Timeline

antiagainst created this revision.Mar 20 2021, 7:37 AM
antiagainst requested review of this revision.Mar 20 2021, 7:37 AM
mravishankar accepted this revision.Mar 23 2021, 11:39 AM

Mostly looks fine to me, but probably someone with more context on these (like Nicolas or Uday) might have comments.

This revision is now accepted and ready to land.Mar 23 2021, 11:39 AM
This revision was landed with ongoing or failed builds.Mar 24 2021, 3:19 PM
This revision was automatically updated to reflect the committed changes.