1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Add detection of AVX2551CD and AVX512F

This commit is contained in:
Carles Fernandez 2018-07-21 09:18:37 +02:00
parent ee5a66063e
commit a25557c868
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 66 additions and 3 deletions

View File

@ -238,4 +238,48 @@
<alignment>32</alignment>
</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>

View File

@ -51,4 +51,14 @@
<archs>generic 32|64| mmx| sse sse2 sse3 ssse3 sse4_1 sse4_2 popcount avx fma avx2 orc|</archs>
</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>

View File

@ -121,7 +121,7 @@ def flatten_section_text(sections):
class impl_class:
def __init__(self, kern_name, header, body):
#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
body = flatten_section_text(body)
try:
@ -153,7 +153,7 @@ def extract_lv_haves(code):
haves = list()
for line in code.splitlines():
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)
return haves
@ -164,7 +164,7 @@ class kernel_class:
def __init__(self, kernel_file):
self.name = os.path.splitext(os.path.basename(kernel_file))[0]
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)
sections = split_into_nested_ifdef_sections(code)
self._impls = list()

View File

@ -123,6 +123,15 @@ static inline unsigned int get_avx2_enabled(void)
#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
#if defined(__arm__) && defined(__linux__)
#include <asm/hwcap.h>