From: Tobias Oed <tobias@physics.odu.edu>
Subject: Re: Optimal use of the L2 cache
Date: Sat, 16 Jun 2001 16:50:05 -0400 [thread overview]
Message-ID: <3B2BC67D.719769CB@physics.odu.edu> (raw)
In-Reply-To: 9gg5po$mri$1@netnews.upenn.edu
Paul Hughett wrote:
>
> Tobias Oed <tobias@physics.odu.edu> wrote:
>
> : for(i=0;i<N_FORMFACTORS;i++){
> : recontri=redeno*contri[i];
> : imcontri=imdeno*contri[i];
> : for(j=0;j<N_ISOSPIN;j++){
> : iso_ff[i][j][RE]+=recontri*iso_coefs[j];
> : iso_ff[i][j][IM]+=imcontri*iso_coefs[j];
> : }
> : }
>
> Not related to your cache question, but I see a few other improvements
> that you could make:
>
> (1) About half of your contri[i] values are set to zero just above this
> code. Add a test to avoid doing the inner loop at all when this is true.
There are 9 non zero ones.
> (2) Similarly, many of iso_coefs[j] values are zero. Unroll the
> N_ISOSPIN loop by hand and omit those calculations.
There are 4 non zero ones.
Since redeno is zero as well, out of the 16*6*2=192 iso_ff only 9*4=36
will have a contribution. The assembly shows exactly 36 stt $fxx,yy($18)
(as well as 36 ldt $fxx,yy($18). So I think that the compiler was smart
enough to do all that for me.
> (3) Look at the assembly code to see if your compiler optimizes
> iso_ff[i][j][IM] into something reasonable. If not, convert iso_ff into
> a single-dimensional array and do the address calculations by hand.
>
> Paul Hughett
Thanks for the idea, Tobias.
prev parent reply other threads:[~2001-06-16 20:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-15 20:48 Optimal use of the L2 cache Tobias Oed
2001-06-15 22:22 ` Hoff Hoffman
2001-06-15 23:23 ` Tobias Oed
2001-06-16 1:23 ` Hoff Hoffman
2001-06-16 17:42 ` Paul Hughett
2001-06-16 20:50 ` Tobias Oed [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox