Page MenuHomePhabricator

[mlir] [VectorOps] Implement vector.constant_mask lowering to LLVM IR
ClosedPublic

Authored by aartbik on May 12 2020, 3:25 PM.

Details

Summary

Makes this operation runnable on CPU by generating MLIR instructions
that are eventually folded into an LLVM IR constant for the mask.

Diff Detail

Event Timeline

aartbik created this revision.May 12 2020, 3:25 PM
ftynse accepted this revision.May 12 2020, 3:42 PM
ftynse added inline comments.
mlir/lib/Dialect/Vector/VectorTransforms.cpp
1223

There is some mechanism a pattern can tell the conversion infra it creates operations that the same pattern can match again, but this iteration is finite. I suppose it's worth using even if the pattern seems to work as is.

This revision is now accepted and ready to land.May 12 2020, 3:42 PM
aartbik marked an inline comment as done.May 12 2020, 4:34 PM
aartbik added inline comments.
mlir/lib/Dialect/Vector/VectorTransforms.cpp
1223

Thanks, yes, I saw the recent developments on that (hasBoundedRewriteRecursion() right?). For the vector->vector progressive lowering, we use "applyPatternsAndFoldGreedily" so that it does not really matter, yet (other than of course making sure that the iteration terminates, for most cases by stripping of a rank or so). But it does not hurt to add, although probably in a new CL for all the rules in this file so far.

aartbik updated this revision to Diff 263573.May 12 2020, 5:11 PM

adhered to camelCaseRestriction style

andydavis1 accepted this revision.May 12 2020, 5:56 PM
nicolasvasilache accepted this revision.May 12 2020, 5:57 PM

Thanks Aart!

This revision was automatically updated to reflect the committed changes.
ftynse added inline comments.May 13 2020, 1:51 AM
mlir/lib/Dialect/Vector/VectorTransforms.cpp
1223

Last time I looked at it applyPatternsAndFoldGreedily applied the same pattern no more than 10 times. We may want to remove or raise this bound if hasBoundedRewriteRecursion tells it's okay.

aartbik marked an inline comment as done.May 14 2020, 11:36 AM
aartbik added inline comments.
mlir/lib/Dialect/Vector/VectorTransforms.cpp
1223

Ah, thanks for that background!