LLVM cpu features i.e -mattr

Since I started working with TVM I struggle to find suitable cpu features of my CPU. Finally I have found a way. Maybe it will help other people. Let’s start:

  1. When you specify incorrect args to llvm target, you will get message that llvm target are compatible with llc flags.: llc - LLVM static compiler — LLVM 19.0.0git documentation

  2. But when you list all possible attributes it may be overwhelming. E.g. for ARM llvm-as < /dev/null | llc -march=arm -mattr=help gives you about 200 features. And you are not sure which are supported by your CPU.

  3. cat /proc/cpuinfo . Output of that is dependent of the system: Why do I get different cpu flags in /proc/cpuinfo between CentOS 6 and CentOS 7? - Unix & Linux Stack Exchange .

  4. We need to go deeper. LLVM in someway need to know which features are supported by certain CPU: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/ARM/ARM.td

Example: I have Cortex-A72:

ARMv8a, ProcA72, FeatureHWDivThumb, FeatureHWDivARM, FeatureCrypto, FeatureCRC, FeatureFixCortexA57AES1742098, HasV8Ops, FeatureAClass, FeatureDB, FeatureFPARMv8, FeatureNEON, FeatureDSP, FeatureTrustZone, FeatureMP, FeatureVirtualization, FeatureCrypto, FeatureCRC

And before that information, I strongly tried to use dotprod and i8mm without results :noob: