Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
- Copyright (C) 2015-2018 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
+ Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#endif
-void prefetch2(void* addr) {
-
- prefetch(addr);
- prefetch((uint8_t*)addr + 64);
-}
-
namespace WinProcGroup {
#ifndef _WIN32
#else
-/// get_group() retrieves logical processor information using Windows specific
+/// best_group() retrieves logical processor information using Windows specific
/// API and returns the best group id for the thread with index idx. Original
/// code from Texel by Peter Ă–sterlund.
-int get_group(size_t idx) {
+int best_group(size_t idx) {
int threads = 0;
int nodes = 0;
return -1;
}
- while (ptr->Size > 0 && byteOffset + ptr->Size <= returnLength)
+ while (byteOffset < returnLength)
{
if (ptr->Relationship == RelationNumaNode)
nodes++;
threads += (ptr->Processor.Flags == LTP_PC_SMT) ? 2 : 1;
}
+ assert(ptr->Size);
byteOffset += ptr->Size;
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((char*)ptr) + ptr->Size);
}
void bindThisThread(size_t idx) {
// Use only local variables to be thread-safe
- int group = get_group(idx);
+ int group = best_group(idx);
if (group == -1)
return;