Cache prefetching

Uses your system voice; voice and rate in settings.

Snapshot

≈ 3 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Cache prefetching is a technique used by central processing units (CPUs) to boost execution performance by fetching instructions or data from their primary or main storage in slower memory to a faster local memory before it is actually needed. Most modern CPUs have fast and local cache memory in which prefetched data is held until it is required. The source for the prefetch operation is usually main memory. Because of their design, accessing cache memories is typically much faster than accessing main memory. Prefetching can be done with non-blocking cache control instructions. Prefetching is based on the principle of data locality.

Cache prefetching is a technique used by central processing units (CPUs) to boost execution performance by fetching instructions or data from their primary or main storage in slower memory to a faster local memory before it is actually needed. Most modern CPUs have fast and local cache memory in which prefetched data is held until it is required. The source for the prefetch operation is usually main memory. Because of their design, accessing cache memories is typically much faster than accessing main memory. Prefetching can be done with non-blocking cache control instructions. Prefetching is based on the principle of data locality. for (size_t i = 0; i the th element of the array array1 is accessed. The system can prefetch the elements that are presumably accessed in future iterations by inserting a prefetch instruction as shown below: for (size_t i = 0; i Here, the prefetch stride, k depends on two factors, the cache miss penalty and the time it takes to execute a single iteration of the for-loop. For instance, if one iteration of the loop takes 7 cycles to execute, and the cache miss penalty is 49 cycles, then there should be k = 49/7 = 7 – which means that the system should prefetch 7 elements ahead. With the first iteration, i will be 0, so the system prefetches the 7th element. Now, with this arrangement, the first 7 accesses ( i = 0 → 6) will still be misses (under the simplifying assumption that each element of array1 is in a separate cache line of its own). The qualitative definition of timeliness is the amount of time elapsed from prefetch to the actual reference. For example: for prefetching to be useful in a for loop where each iteration takes three cycles to execute and the prefetch operation takes twelve cycles, the system must start the prefetch 12/3 = 4 iterations prior to its usage to maintain timeliness.

References

Text derived from https://en.wikipedia.org/w/index.php?oldid=1378609953 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

7 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.