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

Hal Finkel hfinkel at anl.gov
Sun Sep 23 21:57:40 PDT 2012


Hello,

I've attached an initial version of an analysis pass for
delinearization of multidimensional array accesses. Specifically, this
means the following:

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

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
-------------- 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/20120923/5f6c42ab/attachment.bin>


More information about the llvm-commits mailing list