I think we should do two things:<div><ol><li>We should write code to automatically delinearize where ever possible, and</li><li>We should change the IR (extend the GEP instruction) so that Clang doesn't have to linearize all multi-dimensional array references.</li>


</ol>I think we need (1) because much existing code is already linearized. I think we need (2) because delinearization isn't able to handle all subscripts and we'll lose information. In particular, delinearization can't handle couple subscripts (I believe), things like:<br>

<br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><b style="font-family:'courier new',monospace">  for (i = 0; i < m; i++) {</b></div>
<div><font face="courier new, monospace"><b>    for (j = 0; j < n; j++) {</b></font></div><div><font face="courier new, monospace"><b>      A[i][j] = ...</b></font></div><div><font face="courier new, monospace"><b>      ... = A[j][i];</b></font></div>


<div><font face="courier new, monospace"><b>    }</b></font></div><div><font face="courier new, monospace"><b>  }</b></font></div><div><br></div></blockquote><div>Of course, we can begin with delinearization, extending the GEP later. My thought would be to build delinearization into the dependence analyzer, using it to attack MIV subscripts only.</div>
<div><br></div><div>I'll reread Maslov (Wolfe's book also discusses the topic in Section 7.2.4) and see if I can get back up to speed.</div><div><br></div><div>To extend the GEP, it seems like we need to provide 2 fields for every dimension: size and subscript, where size is loop invariant.</div>
<div><br></div><div>Preston</div><div><br></div>
<div><br></div><div><br></div><div><br>
On Mon, Sep 24, 2012 at 2:15 PM, Sebastian Pop <<a href="mailto:spop@codeaurora.org" target="_blank">spop@codeaurora.org</a>> wrote:<br>> Hi Preston,<br>><br>> +// In addition, the implementation depends on the GEP instruction to<br>


> +// differentiate subscripts. Unfortunately, since Clang linearizes subscripts<br>> +// for most arrays, this will be inadequate. We trust that the GEP instruction<br>> +// will eventually be extended.<br>> +//<br>


> +// In the meantime, we should explore Maslov's ideas about delinearization.<br>><br>> I haven't had the chance to discuss with you about the linearized<br>> multi-dimensional<br>> array problem, and Tobias Grosser was also interested to know your point of view<br>


> on reconstructing the higher level representation based on the linear form.<br>><br>> Could you please provide more details on what should be done to address this<br>> problem in LLVM or Clang?<br>><br>> Thanks,<br>


> Sebastian<br>> --<br>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,<br>> hosted by The Linux Foundation<br><br></div>