This is an archive of the discontinued LLVM Phabricator instance.

[VPlan] Perform tail folding as VPlan transform. (WIP)
Needs ReviewPublic

Authored by fhahn on Aug 11 2023, 7:02 AM.

Details

Summary

This patch splits off the tail-folding logic from general mask handling
to it's own transform, which

  • introduces the required mask to the VPlan
  • updates existing masks to be the AND of the existing mask and the mask for the header block,
  • adds masks to recipes that require masks with tail-folding.

This moves tail folding to be part of the gradual lowering & refinement
of a VPlan. Moving tail-folding to a VPlan2VPlan transform makes it
independent of the underlying IR and allows it to be applied to generic
VPlans.

NOTE: there are a few remaining test failures due to slightly different ordering of instructions computing the mask. I will fix them once we converge on the review. I wanted to share this early.

Depends on D157037.
Depends on D157443.

Diff Detail

Event Timeline

fhahn created this revision.Aug 11 2023, 7:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 7:03 AM
fhahn requested review of this revision.Aug 11 2023, 7:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2023, 7:03 AM
Herald added subscribers: wangpc, vkmr. · View Herald Transcript
ssinad added a subscriber: ssinad.Aug 11 2023, 3:06 PM
ABataev added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8184

What about float point division?

8259–8261

Drop braces here for one line sub-block

8262

Add assertion message

8271

for (unsigned I = 0, E = Blend->getNumIncomingValues(); I < E; ++I)

8280–8281

Add braces here

Matt added a subscriber: Matt.Aug 15 2023, 8:16 AM
fhahn added a comment.Aug 24 2023, 2:11 PM

Thanks for the initial comments. This patch adds a number of complexities and a simpler (conceptually) first step would be to instead just split off active-lane-mask introduction as optimization: D158779. EVL should be able to be introduced in a similar, modular fashion.