This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Fold one-element reduction into extract
ClosedPublic

Authored by antiagainst on Apr 20 2022, 2:31 PM.

Details

Summary

If there is only one single element in the vector, then we can
just extract the element as the result for the reduction.

Diff Detail

Event Timeline

antiagainst created this revision.Apr 20 2022, 2:31 PM
Herald added a project: Restricted Project. · View Herald Transcript
antiagainst requested review of this revision.Apr 20 2022, 2:31 PM
mravishankar requested changes to this revision.Apr 21 2022, 12:48 PM

Just a small question.

mlir/test/Dialect/Vector/canonicalize.mlir
1581

Couldnt you just make this vector.extract -> addf ?

This revision now requires changes to proceed.Apr 21 2022, 12:48 PM

Address comments

antiagainst marked an inline comment as done.Apr 22 2022, 6:18 AM
antiagainst added inline comments.
mlir/test/Dialect/Vector/canonicalize.mlir
1581

Sure. Implemented this case too.

mravishankar accepted this revision.Apr 22 2022, 9:27 AM

Awesome!

This revision is now accepted and ready to land.Apr 22 2022, 9:27 AM
This revision was automatically updated to reflect the committed changes.
antiagainst marked an inline comment as done.