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>
3
namespace
velographx::kernels
{
4
struct
CpuFeatures
{
bool
avx2
{
false
};
bool
avx512f
{
false
};
bool
neon
{
false
}; };
5
inline
CpuFeatures
detect_cpu_features
(){
CpuFeatures
f;
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; }
15
inline
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
}
velographx::kernels
Definition
cpu_features.hpp:3
velographx::kernels::best_isa
std::string best_isa()
Definition
cpu_features.hpp:15
velographx::kernels::detect_cpu_features
CpuFeatures detect_cpu_features()
Definition
cpu_features.hpp:5
velographx::kernels::CpuFeatures
Definition
cpu_features.hpp:4
velographx::kernels::CpuFeatures::avx2
bool avx2
Definition
cpu_features.hpp:4
velographx::kernels::CpuFeatures::neon
bool neon
Definition
cpu_features.hpp:4
velographx::kernels::CpuFeatures::avx512f
bool avx512f
Definition
cpu_features.hpp:4
include
velographx
kernels
cpu_features.hpp
Generated by
1.9.8