mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Exclude cpuid.h from Mac non x86 arch (#7166)
* add ifdef to exclude inclusion from non x86 arch * exclude calling of __cpuid_count Co-authored-by: Randy Shuai <rashuai@microsoft.com>
This commit is contained in:
parent
0ccfe6c86a
commit
d880578537
1 changed files with 6 additions and 0 deletions
|
|
@ -27,7 +27,9 @@ limitations under the License.
|
|||
#include <codecvt>
|
||||
#include <locale>
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
|
@ -122,11 +124,13 @@ void ThreadPoolProfiler::MainThreadStat::LogCore() {
|
|||
#ifdef _WIN32
|
||||
core_ = GetCurrentProcessorNumber();
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
uint32_t CPUInfo[4];
|
||||
__cpuid_count(1, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||
if ((CPUInfo[3] & (1 << 9)) != 0) {
|
||||
core_ = (unsigned)CPUInfo[1] >> 24;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
core_ = sched_getcpu();
|
||||
#endif
|
||||
|
|
@ -200,11 +204,13 @@ void ThreadPoolProfiler::LogRun(int thread_idx) {
|
|||
#ifdef _WIN32
|
||||
child_thread_stats_[thread_idx].core_ = GetCurrentProcessorNumber();
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
uint32_t CPUInfo[4];
|
||||
__cpuid_count(1, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||
if ((CPUInfo[3] & (1 << 9)) != 0) {
|
||||
child_thread_stats_[thread_idx].core_ = (unsigned)CPUInfo[1] >> 24;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
child_thread_stats_[thread_idx].core_ = sched_getcpu();
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue