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

Hal Finkel hfinkel at anl.gov
Thu Oct 24 01:24:45 PDT 2013


----- Original Message -----
> Arnold Schwaighofer wrote:
> > +; void foo(long n, long m, long o, int 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[2*i+3][3*j-4][5*k+7] = 1;
> > 
> > A[][0][5*k+7] is going to ?overflow? the lowest dimension into the
> > next row
> > A[][1][...] at 'k == o/5-6' or so. I believe you can?t treat these
> > indices as
> > separate in this example for the purpose of dependence checks? Is
> > the client
> > assumed to conduct checks that guarantee that this is not going to
> > happen?
> 
> Right.  It looks like the data dependence analysis needs more code to
> support
> the contiguous memory semantics.
> 
> This test-case is a bit artificial and most likely undefined (it has
> out of
> bounds accesses for all dimensions): I built this test to have more
> complex
> access functions than A[i][j][k].  I can probably adjust the loop
> bounds or the
> array dimensions to avoid undefined-ness.

Verifying the bounds is something that I had yet to do in my implementation, but certainly something that should be done

A related issue, and my main motivation for making an actual analysis pass for this (aside from wanting to cache the results), is to ensure commensurate sizes on all array accesses. On the other hand, since you're always doing the delinearization pairwise, maybe it does not matter that all accesses to some array delinearize in the same way. Nevertheless, I think that the checking could be helpful, because you could 'fixup' sizes that turned out as multiples of each other after the fact. For example, if in the array, we have some access that looks like a[i][j] and another that looks like a[i][2*j], would we want to use the first to readjust the size determined for the second so that they'd be the same? That having been said, we could do that pairwise as well I assume.

Thanks again,
Hal

> 
> Sebastian
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list