1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

First touch only on CPU code

This commit is contained in:
Peter Boyle 2019-06-15 07:45:43 +01:00
parent d0d8dc8042
commit 339ea10cc7

View File

@ -177,6 +177,7 @@ public:
assert(0); assert(0);
} }
} }
assert( ptr != (_Tp *)NULL);
#else #else
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// 2MB align; could make option probably doesn't need configurability // 2MB align; could make option probably doesn't need configurability
@ -186,16 +187,16 @@ public:
#else #else
if ( ptr == (_Tp *) NULL ) ptr = (_Tp *) memalign(GRID_ALLOC_ALIGN,bytes); if ( ptr == (_Tp *) NULL ) ptr = (_Tp *) memalign(GRID_ALLOC_ALIGN,bytes);
#endif #endif
#endif
assert( ptr != (_Tp *)NULL); assert( ptr != (_Tp *)NULL);
///////////////////////////////////////// //////////////////////////////////////////////////
// First touch optimise in threaded loop // First touch optimise in threaded loop
///////////////////////////////////////// //////////////////////////////////////////////////
uint8_t *cp = (uint8_t *)ptr; uint64_t *cp = (uint64_t *)ptr;
thread_loop( (size_type n=0;n<bytes;n+=4096) , { thread_for(n,bytes/sizeof(uint64_t), { // need only one touch per page
cp[n]=0; cp[n]=0;
}); });
#endif
return ptr; return ptr;
} }