VeloGraphX
High-performance dynamic graph analytics in C++20
Loading...
Searching...
No Matches
cpu_features.hpp
Go to the documentation of this file.
1#pragma once
2#include <string>
4struct CpuFeatures { bool avx2{false}; bool avx512f{false}; bool neon{false}; };
6#if defined(__x86_64__) || defined(_M_X64)
7#if defined(__GNUC__) || defined(__clang__)
8 __builtin_cpu_init(); f.avx2=__builtin_cpu_supports("avx2"); f.avx512f=__builtin_cpu_supports("avx512f");
9#endif
10#endif
11#if defined(__ARM_NEON) || defined(__ARM_NEON__)
12 f.neon=true;
13#endif
14 return f; }
15inline std::string best_isa(){auto f=detect_cpu_features();if(f.avx512f)return "avx512";if(f.avx2)return "avx2";if(f.neon)return "neon";return "scalar";}
16}
std::string best_isa()
CpuFeatures detect_cpu_features()