[llvm-commits] [PATCH] Multidimensional Array Index Delinearization Analysis

Tobias Grosser tobias at grosser.es
Mon Sep 24 23:09:16 PDT 2012


Adding Sameer. He is also interested in that topic.

On 09/24/2012 06:57 AM, Hal Finkel wrote:
> Hello,
>
> I've attached an initial version of an analysis pass for
> delinearization of multidimensional array accesses. Specifically, this
> means the following:

Hi Hal,

I did not fully review this patch yet, but I am already positively 
impressed. All my Polly test cases are already working, I will comment 
on the rest of this message soon.

>
> Given some function that looks like:
> void foo(long n, long m, long o, double A[n][m][o]) {
>    for (long i = 0; i < n; i++)
>      for (long j = 0; j < m; j++)
>        for (long k = 0; k < o; k++)
>          A[i][j][k] = 1.0;
> }
>
> The GEP instruction associated with the array access depends on the
> expression k + o*(j + m*i). From this expression, we recover:
>          size: o index: k
>          size: m index: j
>          size: 1 index: i
>
> In general, the index expression can be polynomials in both
> loop-dependent and loop-invariant variables, the sizes must be
> loop-invariant polynomials, and this pass attempts to handle these
> more-complicated expressions. Furthermore, the current implementation
> uses a specialized polynomial factoring algorithm, and so does not
> depend strongly on the form of the input expression.
>
> I would specifically like feedback on two issues (other comments, of
> course, are also welcome)	:
>
> 1. Do I need the custom polynomial class, or can I, and if so,
> should I, build the polynomial factoring on top of SCEV directly?
>
> 2. I attempted to use SE to "confirm" the decomposition by verifying
> that the expression isolated as the 'index' is never greater than the
> 'size' within the loop. Unfortunately, this does not work (the
> corresponding boolean is always false) and I'm not sure why. I would
> appreciate some assistance. To see what I've tried, see lines 1331-1333
> of lib/Analysis/Delinearization.cpp.
>
> To be clear: The attached code has not been widely tested. As of right
> now, I've tested it only on the test cases in the patch. If people like
> the approach, then I'll clean it up, do more testing, and make it ready
> for an in-depth review.
>
> Additional test cases will also be helpful.
>
> Thanks again,
> Hal
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Delinearization-20120923.patch
Type: text/x-patch
Size: 62455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120925/415ef669/attachment.bin>


More information about the llvm-commits mailing list