<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi Tobias,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">         Thanks a lot for the detailed reply. I am working on several new optimizations for OpenCL kernels for a DSP architecture. The project itself has an NDA associated with it, so I cannot go into more details, but the source will be open to public after completion. One of the first steps is to serialize the work-items in a work-group (e.g., insert nested loops around REGIONs in between barriers). At this point, I thought I should implement a full-featured structural analysis, but some one in my team suggested to first explore what was already in the LLVM. That's what lead me to the RegionInfo class. If it's not much trouble, could you send the draft to my forum email? Also, are you aware of any plan on having the interval/structural analysis supported in LLVM. Thanks again.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">P.S. One thing I need to find out from reading the implementation is why <span style="color:rgb(68,68,68);font-weight:bold;line-height:14.654545783996582px">a sequence of basic blocks </span><span style="color:rgb(68,68,68);line-height:14.654545783996582px">do not get to form a region as a whole.</span></div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Best Regards,</div><div style="font-family:arial,sans-serif;font-size:13px">Paul</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Feb 6, 2014 at 10:07 AM, Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 02/06/2014 04:28 PM, Paul Vario wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi fellows,<br>
<br>
      I am writing to ask what is the algorithm implemented in LLVM's<br>
RegionInfo.h/cpp. In the header file "RegionInfo.h", it says "Calculates a<br>
program structure tree built out of single entry single exit regions<br>
(defined in a 1994 paper called "The Program Structure Tree"). ... ... The<br>
algorithm to calculate these data structures however is COMPLETELY<br>
DIFFERENT, as it takes advantage of existing information already available<br>
... ...". Does anyone know any papers talking about the exact<br>
implementation? Also, how is the RegionInfo class related to a general<br>
interval analysis? Thanks a lot.<br>
</blockquote>
<br></div></div>
Hi Paul,<br>
<br>
I should probably reply. I implemented this algorithm four years ago.<br>
<br>
Yes, this algorithm is on purpose different. I implemented it after investigating previous approaches. There are two main reasons for the difference:<br>
<br>
1) The Program Structure Tree does not access so-called refined regions<br>
<br>
Refined regions are program regions that do not have a single entry and a single exit edge, but can be transformed into such a region very easily. My experience was, that most programs have a large number of refined regions which we want to detect.<br>

<br>
2) Use of the dominator tree<br>
<br>
When I first came to the mailing list and asked for advice people (including Chris) strongly suggested to rely on existing analysis as much as possible. The RegionInfo pass does this by using the DominatorTree as well as a couple of other analysis. My measurements<br>

at that time have shown that building the RegionTree itself is in average twice as fast as building the dominator tree. The other necessary analysis have taken time comparable to a dominator tree construction. The use of DominanceFrontier in the RegionInfo tree has<br>

been a point criticized because this analysis is normally not used in LLVM (and needs to be built just for RegionInfo). Also the dominance frontier is in exceptional cases expensive to construct. On the other side, the analysis has shown useful not only for Polly, but a couple of other projects (R600 backend?, some OpenCL vectorizers?). Still, if we find a way to remove the reliance on the DomFrontier while still being able to detect refined regions, this would be very valuable.<br>

<br>
I never bothered to publish the Region Info paper, but I have an unfinished draft that I am happy to send you. Also, if the documentation<br>
in the source code is too sparse, please let me know and I add the missing information.<br>
<br>
Out of interest, why are you interested in the RegionInfo implementation?<br>
<br>
Cheers,<br>
Tobias<br>
<br>
</blockquote></div><br></div>