Skip to content

Commit ab32074

Browse files
committed
Upgrade cpuinfo version. Update ARM64 Windows feature detection to use cpuinfo functions which are now implemented.
1 parent d55ade0 commit ab32074

File tree

4 files changed

+12
-29
lines changed

4 files changed

+12
-29
lines changed

cmake/deps.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protoc_mac_universal;https://github.com/protocolbuffers/protobuf/releases/downlo
4747
psimd;https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a900.zip;1f5454b01f06f9656b77e4a5e2e31d7422487013
4848
pthreadpool;https://github.com/google/pthreadpool/archive/dcc9f28589066af0dbd4555579281230abbf74dd.zip;533a77943203ef15ca608bcd9dbe2c94da7451d2
4949
pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.zip;f780292da9db273c8ef06ccf5fd4b623624143e9
50-
pytorch_cpuinfo;https://github.com/pytorch/cpuinfo/archive/877328f188a3c7d1fa855871a278eb48d530c4c0.zip;9152d4bf6b8bde9f19b116de3bd8a745097ed9df
50+
pytorch_cpuinfo;https://github.com/pytorch/cpuinfo/archive/f858c30bcb16f8effd5ff46996f0514539e17abc.zip;66a964eda7de60c925e2e26f71f9bbe31698997b
5151
re2;https://github.com/google/re2/archive/refs/tags/2024-07-02.zip;646e1728269cde7fcef990bf4a8e87b047882e88
5252
safeint;https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.28.zip;23f252040ff6cb9f1fd18575b32fa8fb5928daac
5353
tensorboard;https://github.com/tensorflow/tensorboard/archive/373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81.zip;67b833913605a4f3f499894ab11528a702c2b381

cmake/vcpkg-ports/cpuinfo/portfile.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ endif()
66
vcpkg_from_github(
77
OUT_SOURCE_PATH SOURCE_PATH
88
REPO pytorch/cpuinfo
9-
REF 877328f188a3c7d1fa855871a278eb48d530c4c0
10-
SHA512 b6d5a9ce9996eee3b2f09f39115f7ae178fe4d4814cc35b049a59d04a82228e268aa52d073c307ccb56a427428622940e1c77f004c99851dfca0d3a5d803658b
9+
REF f858c30bcb16f8effd5ff46996f0514539e17abc
10+
SHA512 cd7c0c1ea59fac69f2746f65f59656798eeb87410c304ac9d3b3d26ebea4f4124d1426c10fb4b87ff5f93f367ea10d63337f519ee3c3f8fefbb4b7ebf6438130
1111
HEAD_REF master
1212
PATCHES
1313
patch_cpuinfo_h_for_arm64ec.patch

onnxruntime/core/common/cpuid_info.cc

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ void CPUIDInfo::ArmLinuxInit() {
237237
#elif defined(_WIN32) // ^ defined(__linux__)
238238

239239
void CPUIDInfo::ArmWindowsInit() {
240-
// Read MIDR and ID_AA64ISAR1_EL1 register values from Windows registry
240+
// Read MIDR register values from Windows registry
241241
// There should be one per CPU
242-
std::vector<uint64_t> midr_values{}, id_aa64isar1_el1_values{};
242+
std::vector<uint64_t> midr_values{};
243243

244244
// TODO!! Don't support multiple processor group yet!!
245245
constexpr int MAX_CORES = 64;
@@ -272,17 +272,7 @@ void CPUIDInfo::ArmWindowsInit() {
272272
break;
273273
}
274274

275-
uint64_t id_aa64isar1_el1_value;
276-
data_size = sizeof(id_aa64isar1_el1_value);
277-
278-
// CP 4031 corresponds to ID_AA64ISAR1_EL1 register
279-
if (::RegGetValueA(HKEY_LOCAL_MACHINE, processor_subkey, "CP 4031", RRF_RT_REG_QWORD,
280-
nullptr, &id_aa64isar1_el1_value, &data_size) != ERROR_SUCCESS) {
281-
break;
282-
}
283-
284275
midr_values.push_back(midr_value);
285-
id_aa64isar1_el1_values.push_back(id_aa64isar1_el1_value);
286276
}
287277

288278
// process midr_values
@@ -308,22 +298,15 @@ void CPUIDInfo::ArmWindowsInit() {
308298
}
309299
}
310300

311-
has_arm_neon_i8mm_ = std::all_of(
312-
id_aa64isar1_el1_values.begin(), id_aa64isar1_el1_values.end(),
313-
[](uint64_t id_aa64isar1_el1_value) {
314-
// I8MM, bits [55:52]
315-
return ((id_aa64isar1_el1_value >> 52) & 0xF) != 0;
316-
});
317-
318-
has_arm_neon_dot_ = (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) != 0);
319-
320301
#if defined(CPUINFO_SUPPORTED)
321302
if (pytorch_cpuinfo_init_) {
303+
has_arm_neon_dot_ = cpuinfo_has_arm_neon_dot();
322304
has_fp16_ = cpuinfo_has_arm_neon_fp16_arith();
323-
// cpuinfo_has_arm_i8mm() doesn't work on Windows yet. See https://github.com/pytorch/cpuinfo/issues/279.
324-
// has_arm_neon_i8mm_ = cpuinfo_has_arm_i8mm();
325-
has_arm_sve_i8mm_ = cpuinfo_has_arm_sve() && has_arm_neon_i8mm_;
305+
has_arm_neon_i8mm_ = cpuinfo_has_arm_i8mm();
306+
has_arm_sve_i8mm_ = cpuinfo_has_arm_sve() && cpuinfo_has_arm_i8mm();
326307
has_arm_neon_bf16_ = cpuinfo_has_arm_neon_bf16();
308+
has_arm_sme_ = cpuinfo_has_arm_sme();
309+
has_arm_sme2_ = cpuinfo_has_arm_sme2();
327310
}
328311
#endif // defined(CPUINFO_SUPPORTED)
329312
}
@@ -397,4 +380,4 @@ CPUIDInfo::CPUIDInfo() {
397380
#endif
398381
#endif // defined(CPUIDINFO_ARCH_ARM)
399382
}
400-
} // namespace onnxruntime
383+
} // namespace onnxruntime

onnxruntime/core/common/cpuid_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ class CPUIDInfo {
171171
uint32_t vendor_id_;
172172
};
173173

174-
} // namespace onnxruntime
174+
} // namespace onnxruntime

0 commit comments

Comments
 (0)