This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]