patternMinor
Is PREFETCH an asynchronous operation?
Viewed 0 times
asynchronousprefetchoperation
Problem
I often hear Prefetching as a technique for speeding up, for example, sequential memory access pattern. The prefetch should occur sufficiently far ahead in time to mitigate the latency of memory access, for example in a loop traversing memory linearly.
According to the famous "What Every Programmer Should Know About Memory" paper by Ulrich Drepper, it is written:
This prefetching would remove some
of the costs of accessing main memory since it happens
asynchronously with respect to the execution of the program
(emphasis mine)
I could not find references on Google or Wikipedia corroborating or proving this. Does anyone know where I can find if this is true?
The only reasoning I can think of is rhetorical: it must be asynchronous b/c otherwise prefetching offers no benefit to sequential access... unless the execution time of prefetching a cache line is less than bypassing prefetch and placing the same cache line from RAM directly into cache.
According to the famous "What Every Programmer Should Know About Memory" paper by Ulrich Drepper, it is written:
This prefetching would remove some
of the costs of accessing main memory since it happens
asynchronously with respect to the execution of the program
(emphasis mine)
I could not find references on Google or Wikipedia corroborating or proving this. Does anyone know where I can find if this is true?
The only reasoning I can think of is rhetorical: it must be asynchronous b/c otherwise prefetching offers no benefit to sequential access... unless the execution time of prefetching a cache line is less than bypassing prefetch and placing the same cache line from RAM directly into cache.
Solution
If it is implemented in hardware, prefetching is typically done asynchronously.
It's also possible for a compiler to insert extra prefetch instructions into the code. Thus, the initiation of the fetch is done synchronously, but then the memory access continues asynchronously.
See https://en.wikipedia.org/wiki/Cache_prefetching.
It's also possible for a compiler to insert extra prefetch instructions into the code. Thus, the initiation of the fetch is done synchronously, but then the memory access continues asynchronously.
See https://en.wikipedia.org/wiki/Cache_prefetching.
Context
StackExchange Computer Science Q#118651, answer score: 3
Revisions (0)
No revisions yet.