[PATCH] Matrix Flattening and Transposing optimizations

Razya Ladelsky RAZYA@il.ibm.com
Wed Mar 28 12:23:00 GMT 2007


"Richard Guenther" <richard.guenther@gmail.com> wrote on 27/03/2007 
23:25:16:

> On 3/27/07, Richard Henderson <rth@redhat.com> wrote:
> > 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?
> 
> Of course they do.  Like for 456.hmmer or a CFD code I know of, even
> for three dimensions(!) (no, not tramp3d ;))
> 
> Richard.

Actually I've looked at tramp3d...
In tramp3d centering_table_m is a global 3 dimensional 
matrix, allocated this way:
 
 centering_table_m = new Centering<Dim>**[CellType+1];
    for (int i = 0; i <= CellType; ++i) {
      centering_table_m[i] = new Centering<Dim>*[2];
      for (int j = 0; j < 2; ++j)
        centering_table_m[i][j] = new Centering<Dim>[1<<Dim];

So I guess this could also be a candidate for matrix 
optimizations.

Razya



More information about the Gcc-patches mailing list