This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Vector] Support masking for more contraction flavors
ClosedPublic

Authored by dcaballe on Feb 16 2023, 6:44 PM.

Details

Summary

This patch adds masking support for more contraction flavors including those
with any combiner operation (add, mul, min, max, and, or, etc.) and
regular matmul contractions.

Combiner operations that are performing vertical reductions (and,
therefore, they are not represented with a horizontal reduction
operation) can be executed unmasked. However, the previous value of
the accumulator must be propagated for lanes that shouldn't accumulate.
We achieve this goal by introducing a select operation after the
accumulator to choose between the combined and the previous accumulator
value. This design decision is made to avoid introducing masking support
to all the arithmetic and logical operations in the Arith dialect. VP
intrinsics do not support pass-thru values either so we would have to
generate the same sequence when lowering to LLVM. The op + select
pattern is peepholed by some backend with native masking support for those
operations.

Consequently, this patch removes masking support from the vector.fma
operation to follow the same approach for all the combiner operations.

Diff Detail

Event Timeline

dcaballe created this revision.Feb 16 2023, 6:44 PM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
dcaballe requested review of this revision.Feb 16 2023, 6:44 PM
This revision is now accepted and ready to land.Feb 21 2023, 11:54 AM
This revision was landed with ongoing or failed builds.Feb 21 2023, 5:52 PM
This revision was automatically updated to reflect the committed changes.