Commit 32c106bf authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

update prefetch (should check intel compiler)

parent a0d98bea
......@@ -233,9 +233,8 @@ public:
/** To gotoNext on the list */
void gotoNext(){
if( hasNotFinished() ){
// TODO bug! printf("%s %p to %p\n",((*iter) != 0?"Not null":"Null"), *iter, &((*iter)->next));
iter = &((*iter)->next);
if( (*iter)->next ) Prefetch_Write( (*iter)->next->next);
if( (*iter)->next ) Prefetch_Write0( (*iter)->next->next);
}
}
......@@ -310,7 +309,7 @@ public:
void gotoNext(){
if(this->iter){
this->iter = this->iter->next;
if(this->iter) Prefetch_Read(this->iter->next);
if(this->iter) Prefetch_Read0(this->iter->next);
}
}
......
......@@ -76,21 +76,37 @@ typedef long long MortonIndex;
///////////////////////////////////////////////////////
#ifdef __GNUC__
#define Prefetch_Read(X) __builtin_prefetch(X)
#define Prefetch_Write(X) __builtin_prefetch(X,1,1)
#define Prefetch_Read0(X) __builtin_prefetch(X,0,2)
#define Prefetch_Write0(X) __builtin_prefetch(X,1,2)
#define Prefetch_Read1(X) __builtin_prefetch(X,0,2)
#define Prefetch_Write1(X) __builtin_prefetch(X,1,2)
#define Prefetch_Read2(X) __builtin_prefetch(X,0,2)
#define Prefetch_Write2(X) __builtin_prefetch(X,1,2)
#else
#ifdef __INTEL_COMPILER
#ifdef ScalFMM_USE_AVX2
#define Prefetch_Read(X) _mm512_prefetch(X,_MM_HINT_T0)
#define Prefetch_Write(X) _mm512_prefetch(X,_MM_HINT_T0)
#ifdef SCALFMM_USE_AVX2
#define Prefetch_Read0(X) _mm512_prefetch(X,_MM_HINT_T0)
#define Prefetch_Write0(X) _mm512_prefetch(X,_MM_HINT_T0)
#define Prefetch_Read1(X) _mm512_prefetch(X,_MM_HINT_T1)
#define Prefetch_Write1(X) _mm512_prefetch(X,_MM_HINT_T1)
#define Prefetch_Read2(X) _mm512_prefetch(X,_MM_HINT_T2)
#define Prefetch_Write2(X) _mm512_prefetch(X,_MM_HINT_T2)
#else
#define Prefetch_Read(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Write(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Read0(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Write0(X) _mm_prefetch(X,_MM_HINT_T0)
#define Prefetch_Read1(X) _mm_prefetch(X,_MM_HINT_T1)
#define Prefetch_Write1(X) _mm_prefetch(X,_MM_HINT_T1)
#define Prefetch_Read2(X) _mm_prefetch(X,_MM_HINT_T2)
#define Prefetch_Write2(X) _mm_prefetch(X,_MM_HINT_T2)
#endif
#else
#warning compiler is not defined
#define Prefetch_Read(X)
#define Prefetch_Write(X)
#define Prefetch_Read0(X)
#define Prefetch_Write0(X)
#define Prefetch_Read1(X)
#define Prefetch_Write1(X)
#define Prefetch_Read2(X)
#define Prefetch_Write2(X)
#endif
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment