NASA Logo

NTRS

NTRS - NASA Technical Reports Server

Back to Results
Efficacy of Code Optimization on Cache-based ProcessorsThe current common wisdom in the U.S. is that the powerful, cost-effective supercomputers of tomorrow will be based on commodity (RISC) micro-processors with cache memories. Already, most distributed systems in the world use such hardware as building blocks. This shift away from vector supercomputers and towards cache-based systems has brought about a change in programming paradigm, even when ignoring issues of parallelism. Vector machines require inner-loop independence and regular, non-pathological memory strides (usually this means: non-power-of-two strides) to allow efficient vectorization of array operations. Cache-based systems require spatial and temporal locality of data, so that data once read from main memory and stored in high-speed cache memory is used optimally before being written back to main memory. This means that the most cache-friendly array operations are those that feature zero or unit stride, so that each unit of data read from main memory (a cache line) contains information for the next iteration in the loop. Moreover, loops ought to be 'fat', meaning that as many operations as possible are performed on cache data-provided instruction caches do not overflow and enough registers are available. If unit stride is not possible, for example because of some data dependency, then care must be taken to avoid pathological strides, just ads on vector computers. For cache-based systems the issues are more complex, due to the effects of associativity and of non-unit block (cache line) size. But there is more to the story. Most modern micro-processors are superscalar, which means that they can issue several (arithmetic) instructions per clock cycle, provided that there are enough independent instructions in the loop body. This is another argument for providing fat loop bodies. With these restrictions, it appears fairly straightforward to produce code that will run efficiently on any cache-based system. It can be argued that although some of the important computational algorithms employed at NASA Ames require different programming styles on vector machines and cache-based machines, respectively, neither architecture class appeared to be favored by particular algorithms in principle. Practice tells us that the situation is more complicated. This report presents observations and some analysis of performance tuning for cache-based systems. We point out several counterintuitive results that serve as a cautionary reminder that memory accesses are not the only factors that determine performance, and that within the class of cache-based systems, significant differences exist.
Document ID
20020045219
Acquisition Source
Ames Research Center
Document Type
Preprint (Draft being sent to journal)
Authors
VanderWijngaart, Rob F.
(MRJ Technology Solutions, Inc. Moffett Field, CA United States)
Chancellor, Marisa K.
Date Acquired
September 7, 2013
Publication Date
April 10, 1997
Subject Category
Computer Programming And Software
Report/Patent Number
NAS-97-012
Report Number: NAS-97-012
Funding Number(s)
CONTRACT_GRANT: NAS2-14303
Distribution Limits
Public
Copyright
Work of the US Gov. Public Use Permitted.
No Preview Available