[PATCH] D49281: [Unroll/UnrollAndJam/Vectorizer/Distribute] Add followup loop attributes.

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 15 17:34:11 PDT 2018


hsaito added inline comments.


================
Comment at: docs/LangRef.rst:5154
 
+'``llvm.loop.vectorize.followup_vectorized``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------
I understand that the RST file update should talk about what happens today, but for the sake of code review,  it's good to discuss what could happen in reasonably foreseeable future so that we don't under-design things. 

I think we should be thinking ahead about
1) vectorizer peeling the loop, for example, for alignment optimization. Such peeled loop could be fully unrolled if the trip count is known, or vectorized with mask.
2) main vector loop could be fully unrolled
3) there may be more than one remainder loop, e.g., vectorized remainder followed by scalar remainder.
4) remainder loop may be fully unrolled.

All those situations could happen w/o programmer knowing it'll happen that way.

Some of the questions we want to think before the real need arises:
   Will the loop attribute get dropped if the "loop" is fully unrolled?
   How do we designate more than one remainder loop?
   Will the loop attribute applicable for vectorized peel/remainder?
   Should we have a way to designate runtime-DD non-vectorizable loop separately from remainder?



================
Comment at: docs/LangRef.rst:5251
+
+'``llvm.loop.unroll.followup_remainder``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------
Remainder here may be unrolled again or fully unrolled (see the comments on vectorize metadata). What do we do for that?



================
Comment at: docs/LangRef.rst:5311
 
+'``llvm.loop.unroll_and_jam.followup_outer``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------
Is there an assumption of unroll_and_jam operating only on a double loop and/or a perfect loop? Technically speaking, we can unroll_and_jam a loop if we can legally outerloop-vectorize. So, there can be multiple inner loops. 


================
Comment at: docs/LangRef.rst:5380
 
+'``llvm.loop.distribute.followup_noncyclic``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------
Looks rather centric to distribute-for-vectorization.

Loop distribution can happen for many reasons (and it may be more than one reasons). Are we going to define followup_ Metadata for each of those reasons? What'll happen if a loop matches the characteristics of more than one Metadata?


Repository:
  rL LLVM

https://reviews.llvm.org/D49281





More information about the llvm-commits mailing list