Loading...
Searching...
No Matches
prefetch.h File Reference

Memory prefetch. More...

+ Include dependency graph for prefetch.h:

Go to the source code of this file.

Enumerations

enum class  ArchPrefetchAccess { Read = 0 , Write = 1 }
 The kind of access a prefetch is preparing for. More...
 
enum class  ArchPrefetchLocality { None = 0 , L3 = 1 , L2 = 2 , L1 = 3 }
 How much temporal locality you expect on the address after the fetch. More...
 

Functions

template<size_t Size = 1, size_t Align = 1, ArchPrefetchAccess Access = ArchPrefetchAccess::Read, ArchPrefetchLocality Locality = ArchPrefetchLocality::L2>
void ArchPrefetch (void const *addr) noexcept
 Prefetch the cache lines that [addr, addr+Size) occupy.
 
template<ArchPrefetchAccess Access = ArchPrefetchAccess::Read, ArchPrefetchLocality Locality = ArchPrefetchLocality::L2>
void ArchPrefetchRange (void const *addr, size_t numBytes) noexcept
 Prefetch the cache lines that [addr, addr+numBytes) occupy, where numBytes is a runtime value.
 
template<ArchPrefetchAccess Access = ArchPrefetchAccess::Read, ArchPrefetchLocality Locality = ArchPrefetchLocality::L2, class T >
void ArchPrefetchRange (T const *addr, size_t count) noexcept
 Prefetch the cache lines that the count objects of type T starting at addr occupy, as in ArchPrefetchRange(vec.data(), vec.size()).
 
template<ArchPrefetchLocality Locality = ArchPrefetchLocality::L2, class T >
void ArchPrefetchRead (T const *addr) noexcept
 Prefetch for reading the object at addr with given locality.
 
template<ArchPrefetchLocality Locality = ArchPrefetchLocality::L2, class T >
void ArchPrefetchWrite (T const *addr) noexcept
 Prefetch for writing the object at addr with given locality.
 

Detailed Description

Memory prefetch.

Use these to hide latency when you know you're likely going to read/write an address soon but have the ability to spend the latency cycles doing independent work.

Definition in file prefetch.h.