projg2 / cpuid2cpuflags

Tool to generate CPU_FLAGS_* for your CPU
GNU General Public License v2.0
104 stars 20 forks source link

Missing flag for AMD ZEN 4? #26

Closed HaukurPall closed 8 months ago

HaukurPall commented 8 months ago

I have a recent AMD ZEN 4 (AMD Ryzen 7 PRO 7840U) and it seems that f.ex. avx512_vnni flag is not registered. I have not cross referenced the list below, so there might be more missing.

Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         48 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  16
  On-line CPU(s) list:   0-15
Vendor ID:               AuthenticAMD
  Model name:            AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics
    CPU family:          25
    Model:               116
    Thread(s) per core:  2
    Core(s) per socket:  8
    Socket(s):           1
    Stepping:            1
    CPU(s) scaling MHz:  50%
    CPU max MHz:         6076,0000
    CPU min MHz:         400,0000
    BogoMIPS:            6590,60
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht sys
                         call nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_a
                         picid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave a
                         vx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs sk
                         init wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd m
                         ba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a 
                         avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt x
                         savec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk avx512_bf16 clzero irp
                         erf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid dec
                         odeassists pausefilter pfthreshold v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi avx512vbmi umip pku ospk
                         e avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succ
                         or smca flush_l1d
Virtualization features: 
  Virtualization:        AMD-V
Caches (sum of all):     
  L1d:                   256 KiB (8 instances)
  L1i:                   256 KiB (8 instances)
  L2:                    8 MiB (8 instances)
  L3:                    16 MiB (1 instance)
NUMA:                    
  NUMA node(s):          1
  NUMA node0 CPU(s):     0-15
Vulnerabilities:         
  Gather data sampling:  Not affected
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Mmio stale data:       Not affected
  Retbleed:              Not affected
  Spec rstack overflow:  Vulnerable: Safe RET, no microcode
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Enhanced / Automatic IBRS, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not a
                         ffected
  Srbds:                 Not affected
  Tsx async abort:       Not affected
mgorny commented 8 months ago

That's with v14, right?

Could you include the cpuid2cpuflags output?

Could you build and run x86-dump from the sources? You can e.g.:

ebuild /var/db/repos/gentoo/app-portage/cpuid2cpuflags/cpuid2cpuflags-14.ebuild configure
cd /tmp/portage/app-portage/cpuid2cpuflags-14/work/cpuid2cpuflags-14
make x86-dump
./x86-dump

(changing paths as appropriate for your system)

HaukurPall commented 8 months ago

No, that was with the v12, sorry.

I updated to v14 and now the flag I mentioned is there :smile:

Regardless, here is the x86 dump

top:00000001:00a70f41:06100800:7ef8320b:178bfbff
sub:00000007:00000000:00000001:f1bf97a9:00405fde:10000000
sub:00000007:00000001:00000020:00000000:00000000:00000000
top:80000001:00a70f41:40000000:75c237ff:2fd3fbff

And the output from cpuid2cpuflags-v14:

CPU_FLAGS_X86: aes avx avx2 avx512_bf16 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vpopcntdq avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 vpclmulqdq
mgorny commented 8 months ago

Thanks. Is everything all right there? If yes, then I'll add it to our test suite.

HaukurPall commented 8 months ago

Everything seems to be good there :+1: