X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=scripts%2Fget_native_properties.sh;fp=scripts%2Fget_native_properties.sh;h=ae23c3bb4ac23b5f96cdeaf14e4db8862987779c;hp=cffb0ce2731cd082222a3eb9a77702a2a9e9fd1f;hb=8724503d9c8f15f9185bd4394e425e809f3992c1;hpb=53ad6d23b0e7ec2814579d4acba7c02c2b12008f diff --git a/scripts/get_native_properties.sh b/scripts/get_native_properties.sh index cffb0ce2..ae23c3bb 100755 --- a/scripts/get_native_properties.sh +++ b/scripts/get_native_properties.sh @@ -14,10 +14,9 @@ check_flags() { } # Set the CPU flags list +# remove underscores and points from flags, e.g. gcc uses avx512vnni, while some cpuinfo can have avx512_vnni, some systems use sse4_1 others sse4.1 get_flags() { - flags="$(awk '/^flags[ \t]*:/{gsub(/^flags[ \t]*:[ \t]*/, ""); line=$0} END{print line}' /proc/cpuinfo) $(awk '/^Features[ \t]*:/{gsub(/^Features[ \t]*:[ \t]*/, ""); line=$0} END{print line}' /proc/cpuinfo)" - # remove underscores and points from flags, e.g. gcc uses avx512vnni, while some cpuinfo can have avx512_vnni, some systems use sse4_1 others sse4.1 - flags=$(printf '%s' "$flags" | sed "s/[_.]//g") + flags=$(awk '/^flags[ \t]*:|^Features[ \t]*:/{gsub(/^flags[ \t]*:[ \t]*|^Features[ \t]*:[ \t]*|[_.]/, ""); line=$0} END{print line}' /proc/cpuinfo) } # Check for gcc march "znver1" or "znver2" https://en.wikichip.org/wiki/amd/cpuid @@ -55,7 +54,7 @@ case $uname_s in file_arch='x86-64-sse41-popcnt' # Supported by Rosetta 2 ;; 'x86_64') - flags=$(sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | tr '\n' ' ' | tr '[:upper:]' '[:lower:]' | sed "s/[_.]//g") + flags=$(sysctl -n machdep.cpu.features machdep.cpu.leaf7_features | tr '\n' ' ' | tr '[:upper:]' '[:lower:]' | tr -d '_.') set_arch_x86_64 if [ "$true_arch" = 'x86-64-vnni256' ] || [ "$true_arch" = 'x86-64-avx512' ]; then file_arch='x86-64-bmi2'