This is an archive of the discontinued LLVM Phabricator instance.

[mlir][vector] Add folding for extract + extract/insert_strided
ClosedPublic

Authored by ThomasRaoux on Jan 6 2022, 6:45 PM.

Diff Detail

Event Timeline

ThomasRaoux created this revision.Jan 6 2022, 6:45 PM
ThomasRaoux requested review of this revision.Jan 6 2022, 6:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2022, 6:45 PM
antiagainst added inline comments.Jan 10 2022, 11:26 AM
mlir/lib/Dialect/Vector/VectorOps.cpp
1214

I've seen such checks so many places. Might worth having a method directly on the extract_strided_slice op itself. Not requesting change in this patch though. Can do a clean up later.

1229

Nit:

c++
int64_t destinationRank = 0;
if (auto vecType = extractOp.getType().dyn_cast<VectorType>())
  destinationRank = vecType.getRank();

?

mlir/test/Dialect/Vector/canonicalize.mlir
1178

Hmm, shouldn't this be insert.. %a, %0 and then vector.extract %1? Right now %1 is dead code.

antiagainst requested changes to this revision.Jan 10 2022, 11:26 AM

Thanks Thomas! LGTM in general, but I think the test needs to be updated.

This revision now requires changes to proceed.Jan 10 2022, 11:26 AM

Address review comments

ThomasRaoux marked 2 inline comments as done.Jan 11 2022, 10:46 AM
ThomasRaoux added inline comments.
mlir/test/Dialect/Vector/canonicalize.mlir
1178

Yes, good catch, thanks!

antiagainst accepted this revision.Jan 11 2022, 10:48 AM
This revision is now accepted and ready to land.Jan 11 2022, 10:48 AM