ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Prefetch.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File Prefetch.h -----------------------------*/
3/*--------------------------------------------------------------------------*/
38/*--------------------------------------------------------------------------*/
39/*----------------------------- DEFINITIONS --------------------------------*/
40/*--------------------------------------------------------------------------*/
41
42#ifndef __ADS_Prefetch
43 #define __ADS_Prefetch
44/* self-identification: #endif constant */
45
46/*--------------------------------------------------------------------------*/
47/*------------------------------ INCLUDES ----------------------------------*/
48/*--------------------------------------------------------------------------*/
49
50#ifdef ADS_WITH_HIGHWAY
51 #include <hwy/cache_control.h>
52#endif
53
54/*--------------------------------------------------------------------------*/
55/*--------------------------- NAMESPACE ------------------------------------*/
56/*--------------------------------------------------------------------------*/
57
58namespace ADS
59{
60
64enum class Locality : int { None = 0 , Low = 1 , Moderate = 2 , High = 3 };
65
66namespace detail
67{
68
72inline void prefetchLine( const void * p ,
73 Locality l = Locality::High ) noexcept
74{
75 ( void )l;
76#ifdef ADS_WITH_HIGHWAY
77 hwy::Prefetch( static_cast< const unsigned char * >( p ) );
78#else
79 ( void )p;
80#endif
81 }
83
84} // end( namespace detail )
85
86/*--------------------------------------------------------------------------*/
87
88} // end( namespace ADS )
89
90/*--------------------------------------------------------------------------*/
91
92// the customization point ADS::prefetch, whose forms prefetch( p ) and
93// prefetch( p , l ) call prefetchLine()
94#include "ADS/Capabilities.h"
95
96/*--------------------------------------------------------------------------*/
97
98#endif /* Prefetch.h included */
99
100/*--------------------------------------------------------------------------*/
101/*-------------------------- End File Prefetch.h ---------------------------*/
102/*--------------------------------------------------------------------------*/
The capabilities of the structures, beyond the book: what an algorithm may ask of its argument to cho...
Locality
how soon and how often a prefetched line is read again: None once (keep it out of the caches it would...
Definition Prefetch.h:64
@ Moderate
Definition Prefetch.h:64
@ Low
Definition Prefetch.h:64
@ High
Definition Prefetch.h:64
@ None
Definition Prefetch.h:64
Definition ADT.h:96