Skip to content
Snippets Groups Projects

Properly detect and enable vectorization on ARM

Merged Michael Kuron requested to merge arm64 into master
All threads resolved!
2 files
+ 3
6
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -43,8 +43,7 @@ def get_supported_instruction_sets():
@@ -43,8 +43,7 @@ def get_supported_instruction_sets():
return _cache.copy()
return _cache.copy()
if 'PYSTENCILS_SIMD' in os.environ:
if 'PYSTENCILS_SIMD' in os.environ:
return os.environ['PYSTENCILS_SIMD'].split(',')
return os.environ['PYSTENCILS_SIMD'].split(',')
if (platform.system() == 'Darwin' or platform.system() == 'Linux') and platform.machine() == 'arm64':
if platform.system() == 'Darwin' and platform.machine() == 'arm64': # not supported by cpuinfo
# not supported by cpuinfo
return ['neon']
return ['neon']
elif platform.system() == 'Linux' and platform.machine().startswith('riscv'): # not supported by cpuinfo
elif platform.system() == 'Linux' and platform.machine().startswith('riscv'): # not supported by cpuinfo
libc = CDLL('libc.so.6')
libc = CDLL('libc.so.6')
@@ -72,7 +71,7 @@ def get_supported_instruction_sets():
@@ -72,7 +71,7 @@ def get_supported_instruction_sets():
required_sse_flags = {'sse', 'sse2', 'ssse3', 'sse4_1', 'sse4_2'}
required_sse_flags = {'sse', 'sse2', 'ssse3', 'sse4_1', 'sse4_2'}
required_avx_flags = {'avx', 'avx2'}
required_avx_flags = {'avx', 'avx2'}
required_avx512_flags = {'avx512f'}
required_avx512_flags = {'avx512f'}
required_neon_flags = {'neon'}
required_neon_flags = {'asimd'}
required_sve_flags = {'sve'}
required_sve_flags = {'sve'}
flags = set(get_cpu_info()['flags'])
flags = set(get_cpu_info()['flags'])
if flags.issuperset(required_sse_flags):
if flags.issuperset(required_sse_flags):
Loading