Talk About Network

Google





Electronic Equipment > PC Hardware Chips > Re: compiler an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 2676 of 2812
Post > Topic >>

Re: compiler and locality and cache write through policy

by Terje Mathisen <terje.mathisen@[EMAIL PROTECTED] > Dec 8, 2007 at 07:27 PM

ThierryBingo@[EMAIL PROTECTED]
 wrote:
> hey,
> 
> I have two questions regarding the cache and code optimisation and
> woul appreciate your help :)
> 
> 1- Do current compilers interchange nested loops order to minimise
> page fault as well as cache fault? for instance if the arrays are
> stored in row order, the following code
> 
> for (i = 0; i < 100; i++)
>    for (j = 0; j < 100; j++)
>       x[i][j] = x[i][j]+3;
> 
> will perform much better than
> 
> for (j = 0; j < 100; j++)
>    for (i = 0; i < 100; i++)
>          x[i][j] = x[i][j]+3;
> 
> do the current widely used compilers (c++, java) perform such
> optimisation automatically?

Some compilers do, depending upon exactly how the arrays have been 
declared/allocated.

In particular, SUN/Sparc blew away one of the SPECint 2000 benchmarks by 
determining such a convoluted set of prerequisites for doing this 
particular optimization on dynamically allocated arrays that they 
effectively only work on the benchmark code.

Terje

-- 
- <Terje.Mathisen@[EMAIL PROTECTED]
>
"almost all programming can be viewed as an exercise in caching"
 




 2 Posts in Topic:
compiler and locality and cache write through policy
ThierryBingo@[EMAIL PROTE  2007-12-08 09:52:04 
Re: compiler and locality and cache write through policy
Terje Mathisen <terje.  2007-12-08 19:27:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 16:14:08 PST 2009.