This is an archive of the discontinued LLVM Phabricator instance.

Reland "[MLIR]Extend vector.gather to support n-D result"
ClosedPublic

Authored by pzread on Aug 23 2022, 3:10 PM.

Details

Summary

This relands the D131905, which is reverted by rGde54bcc54c6147d90f11f70b6b53f84e62b1e74a.
The vectorOperands passed to handleMultidimensionalVectors is now properly allocated to fix the crash.

Currently vector.gather only supports reading memory into a 1-D result vector.
This patch extends it to support an n-D result vector with the indices, masks,
and passthroughs in n-D vectors.

As we are trying to vectorize tensor.extract with vector.gather
(https://github.com/iree-org/iree/issues/9198), it will need to gather the
elements into an n-D vector. Having vector.gather with n-D results allows us
to avoid flatten and reshape at the vectorization stage. The backends can then
decide the optimal ways to lower the vector.gather op.

Note that this is different from n-D gathering, which is about reading n-D
memory with the n-D indices. The indices here are still only 1-D offsets on
the base.

Diff Detail

Event Timeline

pzread created this revision.Aug 23 2022, 3:10 PM
pzread edited the summary of this revision. (Show Details)Aug 23 2022, 3:15 PM
pzread added a reviewer: dcaballe.
pzread retitled this revision from [MLIR]Extend vector.gather to support n-D result to Reland "[MLIR]Extend vector.gather to support n-D result".
pzread published this revision for review.Aug 23 2022, 6:27 PM
dcaballe accepted this revision.Aug 23 2022, 9:11 PM
This revision is now accepted and ready to land.Aug 23 2022, 9:11 PM

Thanks! Let me reland this again.

This revision was automatically updated to reflect the committed changes.

Thanks Mehdi and Diego's help!