simplified avx detection on Linux
This commit is contained in:
parent
00b3449443
commit
0f3dfb85d4
1 changed files with 5 additions and 7 deletions
12
llvm/ee.py
12
llvm/ee.py
|
|
@ -56,14 +56,12 @@ def _detect_avx_support():
|
||||||
return True # force disable AVX
|
return True # force disable AVX
|
||||||
# auto-detect avx
|
# auto-detect avx
|
||||||
try:
|
try:
|
||||||
lines = open('/proc/cpuinfo').read().splitlines()
|
for line in open('/proc/cpuinfo'):
|
||||||
|
if line.lstrip().startswith('flags') and 'avx' in line.split():
|
||||||
|
# enable AVX if flags contain AVX
|
||||||
|
return False
|
||||||
except IOError:
|
except IOError:
|
||||||
return True # disable AVX if no /proc/cpuinfo is found
|
pass # disable AVX if no /proc/cpuinfo is found
|
||||||
flags = [l for l in lines if l.lstrip().startswith('flags')]
|
|
||||||
if not flags:
|
|
||||||
return True # disable AVX if flags are empty
|
|
||||||
if 'avx' in flags[0]:
|
|
||||||
return False # enable AVX if flags contain AVX
|
|
||||||
return True # disable AVX if flags does not have AVX
|
return True # disable AVX if flags does not have AVX
|
||||||
|
|
||||||
FORCE_DISABLE_AVX = _detect_avx_support()
|
FORCE_DISABLE_AVX = _detect_avx_support()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue