Hi Tobi,<br><br>Thanks for looking into this!<br><br><div class="gmail_quote">2013/2/4 Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In any case, you seemed to have in some way convinced Polly to accept this code. Would you mind to share what you did?<br></blockquote><div><br>Sure. Aliasing is simply ignored. Instead we have substituted pointers and sizes for arrays and a special pass that converts memory accesses from every scop statement into ISL general form. Sorry, we are quite far from standard polly invocation process, maybe I should prepare some simplified plugin for testing purposes...<br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Regarding your problem. As far as I understand, the problem is that the following code:<br>
<br>
for (i<br>
  A[i] = 0<br>
  for (j<br>
      A[i] +=<br>
  ... = A[i]<br>
<br>
is changed by gcc (and other optimizations) to:<br>
<br>
for (i<br>
  A[i] = 0<br>
  tmp = A[i]<br>
<br>
  for (j<br>
      tmp +=<br>
<br>
  A[i] = tmp<br>
  ... = A[i]<br></blockquote><div><br>Yes, exactly!<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
This is a common optimization that unfortunately introduces a lot of dependences on tmp that block any direct parallelization. To parallelize the loop anyway we would need to expand the memory of tmp, such that each parallel thread has a private copy of 'tmp'. Deciding where and how to expand memory to enable further transformations is in general difficult such that I would normally run Polly before such optimizations are performed. Tough, in your case it may still be possible to parallelize the loop. To do this, you would need to ignore all dependences that can be removed by creating thread private copies of 'tmp'. If you are interested in having this implemented either open a bug report or give it a try yourself. I am happy to assist.<br>
</blockquote><div><br>Hm, how to create thread-private copies of tmp at that point and how useful could it be? The problem is that platform-dependent view of threads only steps into the process, once the loop is proved to be parallel. Before that, as far as I know, Polly/CLooG/ISL can't be aware of such things. I thought more about pushing AllocaInst-s down closer to the nested array header - would that work?<br>
<br>Thanks,<br>- D.<br></div></div>