update default affinity for macOS (#17080)

This commit is contained in:
Wanglei Shen
2023-04-20 19:50:04 +08:00
committed by GitHub
parent 77a5d1aa03
commit 70e0eed075

View File

@@ -28,24 +28,28 @@ using namespace dnnl::impl::cpu::x64;
Config::Config() {
// this is default mode
#if defined(__APPLE__) || defined(_WIN32)
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NONE;
#else
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::CORES;
#endif
// for the TBB code-path, additional configuration depending on the OS and CPU types
#if (IE_THREAD == IE_THREAD_TBB || IE_THREAD == IE_THREAD_TBB_AUTO)
#if defined(__APPLE__) || defined(_WIN32)
// 'CORES' is not implemented for Win/MacOS; so the 'NONE' or 'NUMA' is default
auto numaNodes = getAvailableNUMANodes();
if (numaNodes.size() > 1) {
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NUMA;
} else {
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NONE;
}
#endif
// for the TBB code-path, additional configuration depending on the OS and CPU types
#if (IE_THREAD == IE_THREAD_TBB || IE_THREAD == IE_THREAD_TBB_AUTO)
# if defined(__APPLE__) || defined(_WIN32)
// 'CORES' is not implemented for Win/MacOS; so the 'NONE' or 'NUMA' is default
auto numaNodes = getAvailableNUMANodes();
if (numaNodes.size() > 1) {
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NUMA;
} else {
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::NONE;
}
# endif
if (getAvailableCoresTypes().size() > 1 /*Hybrid CPU*/) {
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::HYBRID_AWARE;
}
#endif
if (getAvailableCoresTypes().size() > 1 /*Hybrid CPU*/) {
streamExecutorConfig._threadBindingType = InferenceEngine::IStreamsExecutor::HYBRID_AWARE;
}
#endif
if (!mayiuse(avx512_core_bf16))
enforceBF16 = false;