Compute Library
 22.11
arm_gemm::utils Namespace Reference

Functions

template<typename T >
unsigned long get_vector_length ()
 
template<typename T >
unsigned long get_vector_length (VLType vl_type)
 
template<typename T >
std::tuple< T, T > get_default_activation_values ()
 
template<>
std::tuple< float, float > get_default_activation_values ()
 

Function Documentation

◆ get_default_activation_values() [1/2]

std::tuple<T, T> arm_gemm::utils::get_default_activation_values ( )
inline

Definition at line 210 of file utils.hpp.

211 {
212  const T min = static_cast<T>(std::numeric_limits<T>::min());
213  const T max = static_cast<T>(std::numeric_limits<T>::max());
214 
215  return std::make_tuple(min, max);
216 }

◆ get_default_activation_values() [2/2]

std::tuple<float, float> arm_gemm::utils::get_default_activation_values ( )
inline

Definition at line 220 of file utils.hpp.

221 {
222  const float min = static_cast<float>(-std::numeric_limits<float>::infinity());
223  const float max = static_cast<float>(std::numeric_limits<float>::infinity());
224 
225  return std::make_tuple(min, max);
226 }

◆ get_vector_length() [1/2]

unsigned long arm_gemm::utils::get_vector_length ( )
inline

Definition at line 176 of file utils.hpp.

176  {
177 #if defined(__aarch64__)
178  uint64_t vl;
179 
180  __asm __volatile (
181  ".inst 0x0420e3e0\n" // CNTB X0, ALL, MUL #1
182  "mov %0, X0\n"
183  : "=r" (vl)
184  :
185  : "x0"
186  );
187 
188  return vl / sizeof(T);
189 #else // !defined(__aarch64__)
190  return 16 / sizeof(T);
191 #endif // defined(__aarch64__)
192 }

◆ get_vector_length() [2/2]

unsigned long arm_gemm::utils::get_vector_length ( VLType  vl_type)
inline

Definition at line 199 of file utils.hpp.

References arm_gemm::SVE.

199  {
200  switch (vl_type) {
201  case VLType::SVE:
202  return get_vector_length<T>();
203  default:
204  return 16 / sizeof(T);
205  }
206 }