Skip to content

Add pattern to do affine.min canonicalization after tile and distribute - #5251

Merged
ThomasRaoux merged 2 commits into
iree-org:mainfrom
ThomasRaoux:affinmin_canonicalization
Mar 30, 2021
Merged

ThomasRaoux merged 2 commits into
iree-org:mainfrom
ThomasRaoux:affinmin_canonicalization

Conversation

@ThomasRaoux

Copy link
Copy Markdown
Contributor

No description provided.

@ThomasRaoux
ThomasRaoux force-pushed the affinmin_canonicalization branch from 49d8578 to c4129e5 Compare March 30, 2021 17:08
/// With N a compile time constant. This operations can be replace by
/// `%cN = constant N : index` if we can prove that %lb, %step and %ub are
/// divisible by N.
struct AffineMinDistributedSCFCanonicalizationPattern

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not expose the struct directly, but rather use an "populateAffineMinSCFCanonicalizationPattern" method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, I moved the structure into the cpp file

@ThomasRaoux
ThomasRaoux force-pushed the affinmin_canonicalization branch from 0405342 to 4ba1158 Compare March 30, 2021 17:56
/// scf.for %iv = %lb to %ub step %step
/// %affine.min affine_map<(d0, d1) -> (N, d0 - d1)>(%ub, %iv)
/// ```
static bool affineMinOpDivisible(AffineMinOp minOp, int64_t dividend) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit about name: This sounds like the affine_min is divisible by tile size :) . If you cant think of anything better, I cant either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it does mean the result of the affine_min is divisible by tile size. We check that both side of the min are divisible to prove that the result is divisible. If it wasn't we couldn't do the transformation. Maybe I misunderstood your comment.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a minor nit. I already approved. My read was that "affine min is divisible" which to me is a strange name. I didnt parse it the same as "result of affine min is divisible".
Like I said, very minor issue. You can ignore it if this makes no sense to you.

@ThomasRaoux
ThomasRaoux merged commit c86ad78 into iree-org:main Mar 30, 2021
@KoolJBlack KoolJBlack mentioned this pull request Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants