mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
Add detection of AVX2551CD and AVX512F
This commit is contained in:
parent
ee5a66063e
commit
a25557c868
@ -238,4 +238,48 @@
|
|||||||
<alignment>32</alignment>
|
<alignment>32</alignment>
|
||||||
</arch>
|
</arch>
|
||||||
|
|
||||||
|
<arch name="avx512f">
|
||||||
|
<!-- check for AVX512F -->
|
||||||
|
<check name="cpuid_count_x86_bit">
|
||||||
|
<param>7</param>
|
||||||
|
<param>0</param>
|
||||||
|
<param>1</param>
|
||||||
|
<param>16</param>
|
||||||
|
</check>
|
||||||
|
<!-- check to make sure that xgetbv is enabled in OS -->
|
||||||
|
<check name="cpuid_x86_bit">
|
||||||
|
<param>2</param>
|
||||||
|
<param>0x00000001</param>
|
||||||
|
<param>27</param>
|
||||||
|
</check>
|
||||||
|
<!-- check to see that the OS has enabled AVX512 -->
|
||||||
|
<check name="get_avx512_enabled"></check>
|
||||||
|
<flag compiler="gnu">-mavx512f</flag>
|
||||||
|
<flag compiler="clang">-mavx512f</flag>
|
||||||
|
<flag compiler="msvc">/arch:AVX512F</flag>
|
||||||
|
<alignment>64</alignment>
|
||||||
|
</arch>
|
||||||
|
|
||||||
|
<arch name="avx512cd">
|
||||||
|
<!-- check for AVX512CD -->
|
||||||
|
<check name="cpuid_count_x86_bit">
|
||||||
|
<param>7</param>
|
||||||
|
<param>0</param>
|
||||||
|
<param>1</param>
|
||||||
|
<param>28</param>
|
||||||
|
</check>
|
||||||
|
<!-- check to make sure that xgetbv is enabled in OS -->
|
||||||
|
<check name="cpuid_x86_bit">
|
||||||
|
<param>2</param>
|
||||||
|
<param>0x00000001</param>
|
||||||
|
<param>27</param>
|
||||||
|
</check>
|
||||||
|
<!-- check to see that the OS has enabled AVX512 -->
|
||||||
|
<check name="get_avx512_enabled"></check>
|
||||||
|
<flag compiler="gnu">-mavx512cd</flag>
|
||||||
|
<flag compiler="clang">-mavx512cd</flag>
|
||||||
|
<flag compiler="msvc">/arch:AVX512CD</flag>
|
||||||
|
<alignment>64</alignment>
|
||||||
|
</arch>
|
||||||
|
|
||||||
</grammar>
|
</grammar>
|
||||||
|
@ -51,4 +51,14 @@
|
|||||||
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount avx fma avx2 orc|</archs>
|
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount avx fma avx2 orc|</archs>
|
||||||
</machine>
|
</machine>
|
||||||
|
|
||||||
|
<!-- trailing | bar means generate without either for MSVC -->
|
||||||
|
<machine name="avx512f">
|
||||||
|
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount avx fma avx2 avx512f orc|</archs>
|
||||||
|
</machine>
|
||||||
|
|
||||||
|
<!-- trailing | bar means generate without either for MSVC -->
|
||||||
|
<machine name="avx512cd">
|
||||||
|
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount avx fma avx2 avx512f avx512cd orc|</archs>
|
||||||
|
</machine>
|
||||||
|
|
||||||
</grammar>
|
</grammar>
|
||||||
|
@ -121,7 +121,7 @@ def flatten_section_text(sections):
|
|||||||
class impl_class:
|
class impl_class:
|
||||||
def __init__(self, kern_name, header, body):
|
def __init__(self, kern_name, header, body):
|
||||||
#extract LV_HAVE_*
|
#extract LV_HAVE_*
|
||||||
self.deps = set(map(str.lower, re.findall('LV_HAVE_(\w+)', header)))
|
self.deps = set(res.lower() for res in re.findall('LV_HAVE_(\w+)', header))
|
||||||
#extract function suffix and args
|
#extract function suffix and args
|
||||||
body = flatten_section_text(body)
|
body = flatten_section_text(body)
|
||||||
try:
|
try:
|
||||||
@ -153,7 +153,7 @@ def extract_lv_haves(code):
|
|||||||
haves = list()
|
haves = list()
|
||||||
for line in code.splitlines():
|
for line in code.splitlines():
|
||||||
if not line.strip().startswith('#'): continue
|
if not line.strip().startswith('#'): continue
|
||||||
have_set = set(map(str.lower, re.findall('LV_HAVE_(\w+)', line)))
|
have_set = set(res.lower() for res in re.findall('LV_HAVE_(\w+)', line))
|
||||||
if have_set: haves.append(have_set)
|
if have_set: haves.append(have_set)
|
||||||
return haves
|
return haves
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ class kernel_class:
|
|||||||
def __init__(self, kernel_file):
|
def __init__(self, kernel_file):
|
||||||
self.name = os.path.splitext(os.path.basename(kernel_file))[0]
|
self.name = os.path.splitext(os.path.basename(kernel_file))[0]
|
||||||
self.pname = self.name.replace('volk_gnsssdr_', 'p_')
|
self.pname = self.name.replace('volk_gnsssdr_', 'p_')
|
||||||
code = open(kernel_file, 'r').read()
|
code = open(kernel_file, 'rb').read().decode("utf-8")
|
||||||
code = comment_remover(code)
|
code = comment_remover(code)
|
||||||
sections = split_into_nested_ifdef_sections(code)
|
sections = split_into_nested_ifdef_sections(code)
|
||||||
self._impls = list()
|
self._impls = list()
|
||||||
|
@ -123,6 +123,15 @@ static inline unsigned int get_avx2_enabled(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned int get_avx512_enabled(void)
|
||||||
|
{
|
||||||
|
#if defined(VOLK_CPU_x86)
|
||||||
|
return __xgetbv() & 0xE6; //check for zmm, xmm and ymm regs
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//neon detection is linux specific
|
//neon detection is linux specific
|
||||||
#if defined(__arm__) && defined(__linux__)
|
#if defined(__arm__) && defined(__linux__)
|
||||||
#include <asm/hwcap.h>
|
#include <asm/hwcap.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user