8 #include <arm_compute/core/CPP/CPPTypes.h>
30 return static_cast<unsigned int>(value.
AsInt());
38 template <
typename CpuInfo>
39 auto SetSveAllowed(CpuInfo& cpuInfo,
bool isEnabled,
int) -> decltype(cpuInfo.set_sve_allowed(isEnabled),
void())
41 cpuInfo.set_sve_allowed(isEnabled);
44 template <
typename CpuInfo>
45 void SetSveAllowed(CpuInfo&,
bool,
long)
48 template <
typename CpuInfo>
49 auto SetSmeAllowed(CpuInfo& cpuInfo,
bool isEnabled,
int) -> decltype(cpuInfo.set_sme_allowed(isEnabled),
void())
51 cpuInfo.set_sme_allowed(isEnabled);
54 template <
typename CpuInfo>
55 void SetSmeAllowed(CpuInfo&,
bool,
long)
64 : m_IsFastMathEnabled(false), m_NumberOfThreads(0), m_IsSveEnabled(true), m_IsSmeEnabled(true)
66 if (!modelOptions.empty())
70 if (name ==
"FastMathEnabled")
72 m_IsFastMathEnabled = ParseBool(value, m_IsFastMathEnabled);
74 if (name ==
"NumberOfThreads")
76 m_NumberOfThreads = ParseUnsignedInt(value, m_NumberOfThreads);
78 if (name ==
"SmeEnabled")
80 m_IsSmeEnabled = ParseBool(value, m_IsSmeEnabled);
82 if (name ==
"SveEnabled")
84 m_IsSveEnabled = ParseBool(value, m_IsSveEnabled);
92 return m_IsFastMathEnabled;
97 return m_NumberOfThreads;
102 arm_compute::CPUInfo& cpuInfo = arm_compute::CPUInfo::get();
103 SetSveAllowed(cpuInfo, m_IsSveEnabled, 0);
104 SetSmeAllowed(cpuInfo, m_IsSmeEnabled, 0);
Very basic type safe variant.
bool IsUnsignedInt() const
unsigned int AsUnsignedInt() const
bool AsBool() const
Value getters.
bool IsBool() const
Type getters.
void ApplyAclIsaPolicy() const
unsigned int GetNumberOfThreads() const
bool IsFastMathEnabled() const
NeonBackendModelContext(const ModelOptions &modelOptions)
Copyright (c) 2021 ARM Limited and Contributors.
std::vector< BackendOptions > ModelOptions
void ParseOptions(const std::vector< BackendOptions > &options, BackendId backend, F f)