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

Hal Finkel hfinkel at anl.gov
Tue Sep 25 06:36:38 PDT 2012


On Tue, 25 Sep 2012 08:09:16 +0200
Tobias Grosser <tobias at grosser.es> wrote:

> 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.

Thanks! I talked with Nick on IRC yesterday and he helped me see what
was going on with the SE parts I had asked about. I'll post an updated
version later today.

 -Hal

> 
> >
> > 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



More information about the llvm-commits mailing list