This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Modify SuperVectorize to generate select op->combiner op
ClosedPublic

Authored by ayzhuang on Apr 19 2022, 3:17 PM.

Details

Summary

Insert the select op before the combiner op when vectorizing a
reduction loop that needs a mask, so the vectorized reduction loop
can pass isLoopParallel check and be transformed correctly in later
passes.

Diff Detail

Event Timeline

ayzhuang created this revision.Apr 19 2022, 3:17 PM
Herald added a project: Restricted Project. · View Herald Transcript
ayzhuang requested review of this revision.Apr 19 2022, 3:17 PM
dcaballe accepted this revision.Apr 19 2022, 3:38 PM

Thanks, Amy! In general, moving the select op before the operation makes more sense to me since the op might have side effects that would make the execution incorrect otherwise.
I hope we can replace all of this once we have the masking proposal in place.

mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
1447

I'm wondering if the matchReduction utility in SliceAnalysis.h could simplify part of this code. Would you mind giving it a try?

This revision is now accepted and ready to land.Apr 19 2022, 3:38 PM
ayzhuang updated this revision to Diff 423979.Apr 20 2022, 11:35 AM

Address review comments to use matchReduction.

ayzhuang marked an inline comment as done.Apr 20 2022, 11:36 AM
dcaballe accepted this revision.Apr 20 2022, 11:38 AM

Thanks!

@dcaballe Thank you for the review. I'll merge it tomorrow if there are no more comments.