This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Add folding for vector.mask with all-true masks
ClosedPublic

Authored by dcaballe on May 16 2023, 5:54 PM.

Details

Summary

This patch removes vector.mask operations with all-true masks (i.e.,
all lanes enabled).

Diff Detail

Event Timeline

dcaballe created this revision.May 16 2023, 5:54 PM
Herald added a project: Restricted Project. · View Herald Transcript
dcaballe requested review of this revision.May 16 2023, 5:54 PM
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
5690

Should this just be a folding pattern or do you see particular reasons to not always apply this folding?

hanchung added inline comments.May 17 2023, 9:38 AM
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
5690

+1, it looks more like a folding pattern to me

dcaballe added inline comments.May 17 2023, 9:53 AM
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
5690

I tried that but the folding patters are pretty limited. I can't use a rewriter or move instructions around. I tried returning the maskable operations to replace the vector.mask one but it crashes as the maskable operation is nested within the operation to be replaced. Let me give it another try. Let me know if you have any suggestions in this regard.

dcaballe updated this revision to Diff 523214.May 17 2023, 4:15 PM

Move pattern to fold.

mlir/lib/Dialect/Vector/IR/VectorOps.cpp
5690

I figure it out :)

hanchung accepted this revision.May 17 2023, 4:33 PM
This revision is now accepted and ready to land.May 17 2023, 4:33 PM