diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 2331562d4a3bd..7c5cfee61116f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1587,6 +1587,13 @@ set(VERSION_STRING "Internal Build" CACHE STRING "String representation of if (WIN32) list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SYS_PATH_LIB}) list(APPEND onnxruntime_EXTERNAL_LIBRARIES debug Dbghelp) + # In a onecore build the umbrella libs already contains references to the APIs in advapi32, so in onecore build we do not need to link to advapi32 + # In a non-onecore build, usually we also do not need to link to advapi32 because VC++ by default should have provide everything we need, except when the build target is Windows ARM32. + # In the future we will add a build option to allow users disabling all API uses from advapi32 because some Windows environments do not have these APIs. For example, some Windows do not have + # Windows Registry so we cannot query Registry values. + if(onnxruntime_target_platform STREQUAL "ARM" AND CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib) + list(APPEND onnxruntime_EXTERNAL_LIBRARIES advapi32) + endif() else() list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp) list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${ICONV_LIB} ${CMAKE_DL_LIBS} Threads::Threads) diff --git a/onnxruntime/core/common/cpuid_info.cc b/onnxruntime/core/common/cpuid_info.cc index 655d5014f3d60..fcf9c2b03dea5 100644 --- a/onnxruntime/core/common/cpuid_info.cc +++ b/onnxruntime/core/common/cpuid_info.cc @@ -183,7 +183,8 @@ void CPUIDInfo::ArmLinuxInit() { #elif defined(_WIN32) void CPUIDInfo::ArmWindowsInit() { - +// ARM32 certainly doesn't have fp16, so we will skip the logic to avoid using RegGetValueA Windows API +#ifndef _M_ARM #pragma region Application Family or OneCore Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) // Read MIDR from windows registry @@ -270,6 +271,9 @@ void CPUIDInfo::ArmWindowsInit() { #endif /* Application Family or OneCore Family */ has_arm_neon_dot_ = (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) != 0); +#else + has_arm_neon_dot_ = false; +#endif has_fp16_ |= has_arm_neon_dot_; /* TODO: implement them when hw+sw is available for testing these features */ has_arm_neon_i8mm_ = false;