On Wed, 16 Jun 2021 at 08:19, Florian Weimer <fweimer@redhat.com> wrote:
* Stephen John Smoogen:

> I used this
> https://unix.stackexchange.com/questions/631217/how-do-i-check-if-my-cpu-supports-x86-64-v2
> to see what cpu instructions are at each level
>
> ```
> #!/usr/bin/awk -f
>
> BEGIN {
>     while (!/flags/) if (getline < "/proc/cpuinfo" != 1) exit 1
>     if (/lm/&&/cmov/&&/cx8/&&/fpu/&&/fxsr/&&/mmx/&&/syscall/&&/sse2/) level = 1
>     if (level == 1 && /cx16/&&/lahf/&&/popcnt/&&/sse4_1/&&/sse4_2/&&/ssse3/) level = 2
>     if (level == 2 && /avx/&&/avx2/&&/bmi1/&&/bmi2/&&/f16c/&&/fma/&&/abm/&&/movbe/&&/xsave/) level = 3
>     if (level == 3 && /avx512f/&&/avx512bw/&&/avx512cd/&&/avx512dq/&&/avx512vl/) level = 4
>     if (level > 0) { print "CPU supports x86-64-v" level; exit level + 1 }
>     exit 1
> }
> ```

Hmm.  I believe the script is almost correct, not sure about “xsave” part.
The “fma” match is problematic because it also applies to “fma4”, which
is definitely not correct.


I think changing that to /fma[[:space:]]/ would fix that..

 
On Fedora 34 or later, you can use “/lib64/ld-linux-x86-64.so.2 --help”.
If x86-64-v2 shows up as “supported”, there is compatibile:

| Subdirectories of glibc-hwcaps directories, in priority order:
|   x86-64-v4
|   x86-64-v3 (supported, searched)
|   x86-64-v2 (supported, searched)

On older Fedora, you can run:

  podman run fedora:latest /lib64/ld-linux-x86-64.so.2 --help


oh cool. this even works on CentOS and RHEL systems:
```
smooge@xanadu ~]$ podman run fedora:latest /lib64/ld-linux-x86-64.so.2 --help
...
Subdirectories of glibc-hwcaps directories, in priority order:
  x86-64-v4
  x86-64-v3 (supported, searched)
  x86-64-v2 (supported, searched)

Legacy HWCAP subdirectories under library search path directories:
  haswell (AT_PLATFORM; supported, searched)
  tls (supported, searched)
  avx512_1
  x86_64 (supported, searched)
[smooge@xanadu ~]$ uname -a
Linux xanadu.int.smoogespace.com 4.18.0-305.0.1.el8.x86_64 #1 SMP Fri May 28 11:04:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
```
from my oldest system.
 
Thanks,
Florian



--
Stephen J Smoogen.
I've seen things you people wouldn't believe. Flame wars in sci.astro.orion. I have seen SPAM filters overload because of Godwin's Law. All those moments will be lost in time... like posts on  BBS... time to reboot.