@@ -158,6 +158,11 @@ MLAS_FORCEINLINE void
158158// of the ONNX Runtime source tree. OpenMP may or may not be enabled in this
159159// configuration.
160160//
161+ struct SMEInfo {
162+ static const bool CanUseSME2;
163+ static const bool CanUseSME;
164+ static const bool IsSMEAvailable;
165+ };
161166
162167#if !defined(BUILD_MLAS_NO_ONNXRUNTIME)
163168#include " core/platform/threadpool.h"
@@ -167,6 +172,16 @@ using MLAS_CPUIDINFO = onnxruntime::CPUIDInfo;
167172
168173#include " core/common/float16.h"
169174
175+
176+
177+ // Boolean condition to determine if we can use SME2
178+ // By default we should try for SME2 first before falling back to SME.
179+ inline const bool SMEInfo::CanUseSME2 = MLAS_CPUIDINFO::GetCPUIDInfo().HasArm_SME2();
180+ // Boolean condition to determine if we can use SME
181+ inline const bool SMEInfo::CanUseSME = MLAS_CPUIDINFO::GetCPUIDInfo().HasArm_SME();
182+ // Boolean condition to tell us if SME is enabled on this system
183+ inline const bool SMEInfo::IsSMEAvailable = SMEInfo::CanUseSME2 || SMEInfo::CanUseSME;
184+
170185#else // BUILD_MLAS_NO_ONNXRUNTIME
171186
172187class MLASCPUIDInfo
@@ -201,6 +216,10 @@ class MLASCPUIDInfo
201216
202217 bool HasArmNeon_BF16 () const { return has_arm_neon_bf16_; }
203218
219+ bool HasArm_SME () const { return has_arm_sme_; }
220+
221+ bool HasArm_SME2 () const { return has_arm_sme2_; }
222+
204223 private:
205224 MLASCPUIDInfo ();
206225
@@ -210,9 +229,19 @@ class MLASCPUIDInfo
210229 bool has_arm_sve_{false };
211230 bool has_arm_sve_i8mm_{false };
212231 bool has_arm_neon_bf16_{false };
232+ bool has_arm_sme_{false };
233+ bool has_arm_sme2_{false };
213234};
214235using MLAS_CPUIDINFO = MLASCPUIDInfo;
215236
237+ // Boolean condition to determine if we can use SME2
238+ // By default we should try for SME2 first before falling back to SME.
239+ inline const bool SMEInfo::CanUseSME2 = MLAS_CPUIDINFO::GetCPUIDInfo().HasArm_SME2();
240+ // Boolean condition to determine if we can use SME
241+ inline const bool SMEInfo::CanUseSME = MLAS_CPUIDINFO::GetCPUIDInfo().HasArm_SME();
242+ // Boolean condition to tell us if SME is enabled on this system
243+ inline const bool SMEInfo::IsSMEAvailable = SMEInfo::CanUseSME2 || SMEInfo::CanUseSME;
244+
216245#if defined(MLAS_TARGET_ARM64)
217246/* *
218247 * @brief IDs for cpu microarchitectures.
0 commit comments