| View previous topic :: View next topic |
| Author |
Message |
Daniel Shawul
Joined: 14 Mar 2006 Posts: 2187 Location: Ethiopia
|
Post subject: Re: cache alignment of tt Posted: Sun Mar 11, 2012 11:06 pm |
|
|
| Quote: |
Posted: Sun Mar 11, 2012 10:39 pm Post subject: Re: cache alignment of tt
Are you sure the alignment works on Windows? Whether your appliation runs faster is a CPU matter, and should not be affected by what OS you use.
I guess even a non-aligned malloc would be aligned on a 16-byte boundary, so that you dannot see an effect on the eval cache would be logical.
|
Yes it works. The alignment returned by malloc/new gurantees aligned access for the largest member variables (hashkey 8 byte), so I get multiples of 8. When I do alignement the remainder is 0 always. Also declaring some big tables like zobrist keys array and history table as cache aligned makes things slower on windows. I do not have a profiler there so I can not measure performance accurately.
| Code: |
template<typename T>
void aligned_reserve(T*& mem,const size_t& size) {
if((sizeof(T) & (sizeof(T) - 1)) == 0) {
#ifdef _MSC_VER
mem = (T*)_aligned_recalloc(mem,size,sizeof(T),CACHE_LINE_SIZE);
#else
if(mem) free(mem);
posix_memalign((void**)&mem,CACHE_LINE_SIZE,size * sizeof(T));
memset(mem,0,size * sizeof(T));
#endif
} else {
if(mem) free(mem);
mem = (T*) calloc(size,sizeof(T));
}
print("address %d remainder %d\n",(uintptr_t)mem,(uintptr_t)mem % 64);
}
|
After alignment for main & eval cache. Pawn cache has a size of 24 so I do not align it even though doing so should not hurt I think.
| Code: |
feature done=0
address 40697920 remainder 0
address 74317888 remainder 0
address 82772000 remainder 32
ht 1048576 X 64 = 64MB
eht 524288 X 16 = 8MB
pht 349525 X 24 = 7MB
|
_________________ https://sites.google.com/site/dshawul/
https://github.com/dshawul |
|
| Back to top |
|
 |
|
| Subject |
Author |
Date/Time |
cache alignment of tt |
Daniel Shawul |
Sun Mar 11, 2012 10:22 pm |
Re: cache alignment of tt |
H.G.Muller |
Sun Mar 11, 2012 10:39 pm |
Re: cache alignment of tt |
Daniel Shawul |
Sun Mar 11, 2012 11:06 pm |
Re: cache alignment of tt |
Jon Dart |
Mon Mar 12, 2012 12:43 am |
Re: cache alignment of tt |
Daniel Shawul |
Mon Mar 12, 2012 2:53 am |
Re: cache alignment of tt |
Vincent Diepeveen |
Thu Mar 15, 2012 8:12 pm |
Re: cache alignment of tt |
Robert Purves |
Mon Mar 12, 2012 4:10 am |
Re: cache alignment of tt |
Daniel Shawul |
Mon Mar 12, 2012 4:49 am |
Re: cache alignment of tt |
Robert Hyatt |
Mon Mar 12, 2012 5:21 am |
Re: cache alignment of tt |
Ricardo Barreira |
Mon Mar 12, 2012 8:25 am |
Re: cache alignment of tt |
Robert Hyatt |
Mon Mar 12, 2012 3:54 pm |
Re: cache alignment of tt |
Alvaro Cardoso |
Tue Mar 13, 2012 12:33 am |
Re: cache alignment of tt |
Robert Hyatt |
Thu Mar 15, 2012 2:15 pm |
Re: cache alignment of tt |
Rémi Coulom |
Thu Mar 15, 2012 4:42 pm |
Re: cache alignment of tt |
Robert Hyatt |
Thu Mar 15, 2012 5:03 pm |
Re: cache alignment of tt |
Daniel Shawul |
Thu Mar 15, 2012 5:08 pm |
Re: cache alignment of tt |
Daniel Shawul |
Mon Mar 12, 2012 12:49 pm |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|