mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Fix MSVC NUMA compile issues
closes https://github.com/official-stockfish/Stockfish/pull/5298 No functional change
This commit is contained in:
parent
c14297a483
commit
a2f4e988aa
2 changed files with 7 additions and 4 deletions
|
@ -77,6 +77,8 @@ using AlignedPtr = std::unique_ptr<T, AlignedDeleter<T>>;
|
|||
template<typename T>
|
||||
using LargePagePtr = std::unique_ptr<T, LargePageDeleter<T>>;
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
struct PipeDeleter {
|
||||
void operator()(FILE* file) const {
|
||||
if (file != nullptr)
|
||||
|
@ -86,8 +88,6 @@ struct PipeDeleter {
|
|||
}
|
||||
};
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
inline std::optional<std::string> get_system_command_output(const std::string& command) {
|
||||
std::unique_ptr<FILE, PipeDeleter> pipe(popen(command.c_str(), "r"));
|
||||
if (!pipe)
|
||||
|
|
|
@ -51,6 +51,9 @@ static constexpr size_t WIN_PROCESSOR_GROUP_SIZE = 64;
|
|||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#if defined small
|
||||
#undef small
|
||||
#endif
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadselectedcpusetmasks
|
||||
using SetThreadSelectedCpuSetMasks_t = BOOL (*)(HANDLE, PGROUP_AFFINITY, USHORT);
|
||||
|
@ -561,8 +564,8 @@ class NumaConfig {
|
|||
if (SetThreadSelectedCpuSetMasks_f != nullptr)
|
||||
{
|
||||
// Only available on Windows 11 and Windows Server 2022 onwards.
|
||||
const USHORT numProcGroups =
|
||||
((highestCpuIndex + 1) + WIN_PROCESSOR_GROUP_SIZE - 1) / WIN_PROCESSOR_GROUP_SIZE;
|
||||
const USHORT numProcGroups = USHORT(
|
||||
((highestCpuIndex + 1) + WIN_PROCESSOR_GROUP_SIZE - 1) / WIN_PROCESSOR_GROUP_SIZE);
|
||||
auto groupAffinities = std::make_unique<GROUP_AFFINITY[]>(numProcGroups);
|
||||
std::memset(groupAffinities.get(), 0, sizeof(GROUP_AFFINITY) * numProcGroups);
|
||||
for (WORD i = 0; i < numProcGroups; ++i)
|
||||
|
|
Loading…
Add table
Reference in a new issue