This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Introduce the MaskingOpInterface
ClosedPublic

Authored by dcaballe on Oct 25 2022, 9:48 PM.

Details

Summary

This MaskingOpInterface provides masking cababilitites to those
operations that implement it. For only is only implemented by the vector.mask
operation and it's used to break the dependency between the Vector
dialect (where the vector.mask op lives) and operations implementing
the MaskableOpInterface.

This is part of masking proposal described in
https://discourse.llvm.org/t/rfc-vector-masking-representation-in-mlir/64964.

Diff Detail

Event Timeline

dcaballe created this revision.Oct 25 2022, 9:48 PM
dcaballe requested review of this revision.Oct 25 2022, 9:48 PM
jsetoain added inline comments.
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
2150–2152

...operation that predicates...

2154–2155

Why only one? Isn't it the point of vector.mask to simplify the handling of blocks of masked operations? Or are you trying to say that a *maskable* operation can be masked only by one vector.mask operation at a time?

dcaballe marked an inline comment as done.Oct 26 2022, 10:02 AM
dcaballe added inline comments.
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
2154–2155

It's the former. A vector.mask can only mask a single operation. We started with the latter approach and things got complicated quickly, especially during the lowering because we had to split or extract ops from the vector.mask operation and rewire all the U-D chain. Also different masked ops may need different passthru values (and, in the future, vector length values) so there is also a semantic reason to mask only one op.

nicolasvasilache accepted this revision.Oct 27 2022, 9:17 AM

Great to see this taking shape, thanks Diego!

mlir/include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.td
28

nit: bit more indentation to make this less monolithic and easier to parse?

mlir/include/mlir/Dialect/Vector/Interfaces/MaskingOpInterface.td
27

nit: bit more indentation to make this less monolithic and easier to parse?

This revision is now accepted and ready to land.Oct 27 2022, 9:17 AM
dcaballe marked 2 inline comments as done.Oct 27 2022, 3:55 PM
This revision was automatically updated to reflect the committed changes.
mlir/include/mlir/Dialect/Vector/Interfaces/MaskableOpInterface.td