This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Fix getVectorReductionOp
ClosedPublic

Authored by ayzhuang on Oct 21 2021, 10:57 AM.

Details

Summary

Combining kind min/max of Vector reduction op has been changed to minf/maxf, minsi/maxsi, and minui/maxui. Modify getVectorReductionOp accordingly.
Add min/max to supported reductions.

Diff Detail

Event Timeline

ayzhuang created this revision.Oct 21 2021, 10:57 AM
ayzhuang requested review of this revision.Oct 21 2021, 10:57 AM
This revision is now accepted and ready to land.Oct 21 2021, 11:39 AM

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

dcaballe accepted this revision.Oct 21 2021, 1:16 PM

LGTM! Thanks for addressing this, Amy.

Can you add tests?

ayzhuang updated this revision to Diff 381650.Oct 22 2021, 2:09 PM
ayzhuang edited the summary of this revision. (Show Details)

Address review comment to add one unit test. Modify getReductionOp and add min/max to supported reduction.

Sorry, I thought we already had tests for this. Thanks, River!
Thanks for adding the test, Amy. Some comments below.

mlir/test/Dialect/Affine/SuperVectorize/vectorize_reduction.mlir
33

I think if we follow the other tests, this should be the identity value, i.e., +inf (see 0x7F800000 below).

57

Is this operation only generated for min/max? It should be generated for all the reduction ops but I don't see it in the other tests... You don't have to address this problem in this review but there seems to be something off here.

62

Could you please add a test for maxf and the signed/unsigned variants as well?

ayzhuang updated this revision to Diff 381698.Oct 22 2021, 7:37 PM
ayzhuang marked 2 inline comments as done.

Address review comments to add more tests.

mlir/test/Dialect/Affine/SuperVectorize/vectorize_reduction.mlir
57

This is because the initial value is 0, not +inf. I have changed the initial value and this op is no longer generated.

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

This revision was automatically updated to reflect the committed changes.

Thanks for adding the tests! LGTM