[PATCH] D63304: Ignore Singletons in statement domains

Sameer AbuAsal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 14:50:47 PDT 2019


sabuasal marked 5 inline comments as done.
sabuasal added a comment.

In D63304#1544199 <https://reviews.llvm.org/D63304#1544199>, @Meinersbur wrote:

> In D63304#1543859 <https://reviews.llvm.org/D63304#1543859>, @sabuasal wrote:
>
> > You can detect this simple loop domain directly by using quering "is_singleton" but with nested loops you'll need to project out to find singletons in one dimension out of all the loop nest dimensions.
>
>
> What I meant is NOT using isl at all for detecting the situation, but deriving it from the control flow graph (such as 'conditional branch found at the end of the loop instead of before'). Keep in mind this is only a [suggestion], not a requirement for me to accept this patch.


Oh I see, I only thought about this in terms of modeling in ISL instead of hacking something in ScopDetection\Info.  Thanks for the suggestion.

> In D63304#1543902 <https://reviews.llvm.org/D63304#1543902>, @sabuasal wrote:
> 
>> As for numbers, we observed code size saving of around 1 MB when compiling a version of android Q.
> 
> 
> What is 1 MB relative to?

This accounted for about 0.4% of code size of shared objects we compile in Android with our internal Polly enabled for vectorizetion. Hope that answers your question.
One extra benefit for this patch was the simplicity of the resulting AST for analysis too, which is certainly a big plus.



================
Comment at: include/polly/ScopInfo.h:69
   DELINEARIZATION,
+  UPPERBOUND,
 };
----------------
Meinersbur wrote:
> sabuasal wrote:
> > Meinersbur wrote:
> > > Can you use something more descriptive?
> > Hmm, I'll change to TRIPCOUNT , how does that sound?
> Better, but still does not describe what the assumption is.
I'll use AVOIDSINGLEITERATION :)


================
Comment at: lib/Analysis/ScopInfo.cpp:195
+static cl::opt<bool>
+    HandleDoWhile("polly-model-do-while",
+                  cl::desc("Prune exeution domain of statements to ignore"
----------------
Meinersbur wrote:
> sabuasal wrote:
> > Meinersbur wrote:
> > > Can you explain the why you chose the name `model-do-while`?
> > The problem with disjunction in domains is very common in *do while* style loops  where the domain of the statement has either one iteration (if the loop condition is false) or more than one. 
> > 
> > The idea in this patch is that if the loop condition is actually false we should really not try to run the transformed version of the loop anyway since it not beneficial for a loop of 1 iteration.
> > 
> > I am open t other names if you have suggestions :)
> The problem I see is that this does not only apply to do-while loops (which is a syntactical element), but e.g. to loop-rotated other loops as well.
> 
> [suggestion] `polly-avoid-singular-loops`, `polly-assume-multi-iteration-loops`, `polly-fallback-on-single-iteration-loops`, `-polly-expect-loops-to-loop`, `-polly-optimize-looping-loops-only`, ....
> 
> (in compiler lingo, 'assume' usually means the compiler is free to use the fact for optimization without requiring it to be verified, 'expect' that violating the fact must still result in correct code).
You are right, it does happen with rotated loops. It iis actually why it was significant enough that I figured we could model it in polly. I'll use polly-avoid-singular-loops.


Repository:
  rPLO Polly

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63304/new/

https://reviews.llvm.org/D63304





More information about the llvm-commits mailing list