klauspost / cpuid

CPU feature identification for Go
MIT License
1.01k stars 125 forks source link

CPUID and NFD support: AVX_VNNI #106

Closed ionutnechita closed 2 years ago

ionutnechita commented 2 years ago

Hi NFD Team,

I have ADL CPU, but i not have AVX_VNNI in label list. I have v0.11.0 image and this issue is observed.

This ticket is imported from NFD project. https://github.com/kubernetes-sigs/node-feature-discovery/issues/844

{ "beta.kubernetes.io/arch": "amd64", "beta.kubernetes.io/os": "linux", "feature.node.kubernetes.io/cpu-cpuid.ADX": "true", "feature.node.kubernetes.io/cpu-cpuid.AESNI": "true", "feature.node.kubernetes.io/cpu-cpuid.AVX": "true", "feature.node.kubernetes.io/cpu-cpuid.AVX2": "true", "feature.node.kubernetes.io/cpu-cpuid.CETIBT": "true", "feature.node.kubernetes.io/cpu-cpuid.CETSS": "true", "feature.node.kubernetes.io/cpu-cpuid.CMPXCHG8": "true", "feature.node.kubernetes.io/cpu-cpuid.FMA3": "true", "feature.node.kubernetes.io/cpu-cpuid.FXSR": "true", "feature.node.kubernetes.io/cpu-cpuid.FXSROPT": "true", "feature.node.kubernetes.io/cpu-cpuid.IBPB": "true", "feature.node.kubernetes.io/cpu-cpuid.LAHF": "true", "feature.node.kubernetes.io/cpu-cpuid.MOVBE": "true", "feature.node.kubernetes.io/cpu-cpuid.MOVDIR64B": "true", "feature.node.kubernetes.io/cpu-cpuid.MOVDIRI": "true", "feature.node.kubernetes.io/cpu-cpuid.OSXSAVE": "true", "feature.node.kubernetes.io/cpu-cpuid.SCE": "true", "feature.node.kubernetes.io/cpu-cpuid.SERIALIZE": "true", "feature.node.kubernetes.io/cpu-cpuid.SHA": "true", "feature.node.kubernetes.io/cpu-cpuid.STIBP": "true", "feature.node.kubernetes.io/cpu-cpuid.VMX": "true", "feature.node.kubernetes.io/cpu-cpuid.WAITPKG": "true", "feature.node.kubernetes.io/cpu-cpuid.X87": "true", "feature.node.kubernetes.io/cpu-cpuid.XSAVE": "true", "feature.node.kubernetes.io/cpu-hardware_multithreading": "true", "feature.node.kubernetes.io/cpu-model.family": "6", "feature.node.kubernetes.io/cpu-model.id": "154", "feature.node.kubernetes.io/cpu-model.vendor_id": "Intel", "feature.node.kubernetes.io/cpu-pstate.scaling_governor": "powersave", "feature.node.kubernetes.io/cpu-pstate.status": "active", "feature.node.kubernetes.io/cpu-pstate.turbo": "true", "feature.node.kubernetes.io/cpu-rdt.RDTL2CA": "true", "feature.node.kubernetes.io/kernel-config.NO_HZ": "true", "feature.node.kubernetes.io/kernel-config.NO_HZ_IDLE": "true", "feature.node.kubernetes.io/kernel-version.full": "5.15.0-40-generic", "feature.node.kubernetes.io/kernel-version.major": "5", "feature.node.kubernetes.io/kernel-version.minor": "15", "feature.node.kubernetes.io/kernel-version.revision": "0", "feature.node.kubernetes.io/pci-0300_8086.present": "true", "feature.node.kubernetes.io/pci-0300_8086.sriov.capable": "true", "feature.node.kubernetes.io/storage-nonrotationaldisk": "true", "feature.node.kubernetes.io/system-os_release.ID": "ubuntu", "feature.node.kubernetes.io/system-os_release.VERSION_ID": "22.04", "feature.node.kubernetes.io/system-os_release.VERSION_ID.major": "22", "feature.node.kubernetes.io/system-os_release.VERSION_ID.minor": "04", "gpu.intel.com/cards": "card0", "kubernetes.io/arch": "amd64", "kubernetes.io/hostname": "10.10.10.10", "kubernetes.io/os": "linux", "node-role.kubernetes.io/worker": "true" }

cpuid -1 | grep AVX-VNNI AVX-VNNI: AVX VNNI neural network instrs = true This CPU feature is not implemented in NFD?

BR, Ionut Nechita ionutnechita

klauspost commented 2 years ago

AVX512VNNI is detected. However, your CPU does not appear to enable this, or it isn't picked up.

Could you post the output from running the latest release binary?

klauspost commented 2 years ago

I do not believe a non-avx512 version of this exists.

ionutnechita commented 2 years ago

I need to reopen this ticket.

For ADL using cpuid-Linux_x86_64_2.0.14.tar.gz:

./cpuid Name: 12th Gen Intel(R) Core(TM) i7-12800HE Vendor String: GenuineIntel Vendor ID: Intel PhysicalCores: 20 Threads Per Core: 1 Logical Cores: 20 CPU Family 6 Model: 154 Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CETIBT,CETSS,CLMUL,CMOV,CMPXCHG8,CX16,ERMS,F16C,FMA3,FXSR,FXSROPT,IBPB,LAHF,LZCNT,MMX,MMXEXT,MOVBE,MOVDIR64B,MOVDIRI,NX,OSXSAVE,PCONFIG,POPCNT,RDRAND,RDSEED,RDTSCP,SCE,SERIALIZE,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSSE3,STIBP,TME,VMX,WAITPKG,X87,XGETBV1,XSAVE,XSAVEC,XSAVEOPT,XSAVES Microarchitecture level: 3 Cacheline bytes: 64 L1 Instruction Cache: 65536 bytes L1 Data Cache: 32768 bytes L2 Cache: 2097152 bytes L3 Cache: 25165824 bytes Frequency: 2600000000 Hz Boost Frequency: 3500000000 Hz

CPUID LINUX: cpuid-linux-binary.txt

AVX-VNNI: AVX VNNI neural network instrs = true

AVX512 is not supported on this CPU. But AVX-VNNI is supported.

klauspost commented 2 years ago

@ionutnechita Why? Your CPU or OS does not support AVX512, so VNNI cannot be used. there is only avx512 vnni.

ionutnechita commented 2 years ago

And with this referrence: https://en.wikipedia.org/wiki/Alder_Lake

_AVX-VNNI, a VEX-coded variant of AVX512-VNNI for 256-bit vectors_

ionutnechita commented 2 years ago

I think is necessary to reopen this ticket and review my file: cpuid-linux-binary.txt.

A good day.

klauspost commented 2 years ago

Added in #110

ionutnechita commented 2 years ago

It's fine now:

Name: 12th Gen Intel(R) Core(TM) i9-12900E Vendor String: GenuineIntel Vendor ID: Intel PhysicalCores: 12 Threads Per Core: 2 Logical Cores: 24 CPU Family 6 Model: 151 Features: ADX,AESNI,AVX,AVX2,AVXVNNI,BMI1,BMI2,CETIBT,CETSS,CLMUL,CMOV,CMPXCHG8,CX16,ERMS,F16C,FMA3,FXSR,FXSROPT,GFNI,HRESET,HTT,IBPB,LAHF,LZCNT,MMX,MMXEXT,MOVBE,MOVDIR64B,MOVDIRI,NX,OSXSAVE,PCONFIG,POPCNT,RDRAND,RDSEED,RDTSCP,SCE,SERIALIZE,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSSE3,STIBP,STOSB_SHORT,TME,VAES,VMX,VPCLMULQDQ,WAITPKG,X87,XGETBV1,XSAVE,XSAVEC,XSAVEOPT,XSAVES Microarchitecture level: 3 Cacheline bytes: 64 L1 Instruction Cache: 32768 bytes L1 Data Cache: 49152 bytes L2 Cache: 1310720 bytes L3 Cache: 31457280 bytes Frequency: 2300000000 Hz Boost Frequency: 5000000000 Hz

ionutnechita commented 2 years ago

Thank you for this fix.

A good day.