Page MenuHomePhabricator

Add patterns to lower vector.multi_reduction into a sequence of vector.reduction
ClosedPublic

Authored by asaadaldien on Apr 29 2021, 2:16 PM.

Details

Summary

Three patterns are added to convert into vector.multi_reduction into a sequence of vector.reduction as the following:

  • Transpose the inputs so inner most dimensions are always reduction.
  • Reduce rank of vector.multi_reduction into 2d with inner most reduction dim (get the 2d canical form)
  • 2D canonical form is converted into a sequence of vector.reduction.

There are two things we might worth in a follow up diff:

  • An scf.for (maybe optionally) around vector.reduction instead of unrolling it.
  • Breakdown the vector.reduction into a sequence of vector.reduction

(e.g tree-based reduction) instead of relying on how downstream dialects
handle it. Note: this will requires passing target-vector-length

Diff Detail

Event Timeline

asaadaldien created this revision.Apr 29 2021, 2:16 PM
asaadaldien requested review of this revision.Apr 29 2021, 2:16 PM
asaadaldien edited the summary of this revision. (Show Details)

Looks good, thanks @asaadaldien !

This revision is now accepted and ready to land.Apr 30 2021, 12:35 AM

rebase & fix transpose indexing bug

This revision was landed with ongoing or failed builds.Apr 30 2021, 10:53 AM
This revision was automatically updated to reflect the committed changes.