This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Matrix Flattening and Transposing optimizations
- From: Razya Ladelsky <RAZYA at il dot ibm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: dberlin at dberlin dot org, dnovillo at redhat dot com, gcc-patches at gcc dot gnu dot org, richard dot guenther at gmail dot com
- Date: Wed, 28 Mar 2007 11:07:25 +0200
- Subject: Re: [PATCH] Matrix Flattening and Transposing optimizations
Richard Henderson <rth@redhat.com> wrote on 27/03/2007 23:16:16:
> On Sun, Mar 25, 2007 at 01:21:32PM +0200, Razya Ladelsky wrote:
> > a = (int **) malloc(dim1 * sizeof(int *));
> > for (i=0; i<dim1; i++)
> > a[i] = (int *) malloc (dim2 * sizeof(int));
>
> Do people really do this...
>
> > a = (int *) malloc (dim1 * dim2 *sizeof(int));
>
> ... as opposed to this?
>
> In what sorts of contexts do you expect this to trigger?
>
>
> r~
Yes. We can see these patterns in SPEC2000: for example in art and
equake a few matrices are allocated this way, and
and some variations of it in vpr.
However, even if the allocation itself is already done as in your example,
matrix flattening would change the access a[i][j] to an access to
a[i*dim2+j], eliminating one level of indirection for this access.
Furthermore, matrix transposing may also be applied to such matrices.
At the moment matrix flattening does not recognize these patterns, but
it could be extended to do so.
Thanks,
Razya