cpu_detect: Add additional x86 flags and telemetry
Adds detection of additional CPU flags to cpu_detect and additions to telemetry output.
This is not exhaustive but guided by features that [dynarmic utilizes](bcfe377aaa/src/dynarmic/backend/x64/host_feature.h (L12-L33)
) as well as features that are currently utilized but not reported to telemetry(invariant_tsc). This is intended to guide future optimizations.
AVX512 in particular is broken up into its individual subsets and some other processor features such as [sha](https://en.wikipedia.org/wiki/Intel_SHA_extensions) and [gfni](https://en.wikipedia.org/wiki/AVX-512#GFNI) are added to have some forward-facing data-points.
What used to be a single `CPU_Extension_x64_AVX512` telemetry field
is also broken up into individual `CPU_Extension_x64_AVX512{F,VL,CD,...}` fields.
This commit is contained in:
parent
21ccb35705
commit
c802f8fbd2
4 changed files with 86 additions and 29 deletions
|
@ -93,10 +93,14 @@ static CPUCaps Detect() {
|
|||
caps.sse = Common::Bit<25>(cpu_id[3]);
|
||||
caps.sse2 = Common::Bit<26>(cpu_id[3]);
|
||||
caps.sse3 = Common::Bit<0>(cpu_id[2]);
|
||||
caps.pclmulqdq = Common::Bit<1>(cpu_id[2]);
|
||||
caps.ssse3 = Common::Bit<9>(cpu_id[2]);
|
||||
caps.sse4_1 = Common::Bit<19>(cpu_id[2]);
|
||||
caps.sse4_2 = Common::Bit<20>(cpu_id[2]);
|
||||
caps.movbe = Common::Bit<22>(cpu_id[2]);
|
||||
caps.popcnt = Common::Bit<23>(cpu_id[2]);
|
||||
caps.aes = Common::Bit<25>(cpu_id[2]);
|
||||
caps.f16c = Common::Bit<29>(cpu_id[2]);
|
||||
|
||||
// AVX support requires 3 separate checks:
|
||||
// - Is the AVX bit set in CPUID?
|
||||
|
@ -112,16 +116,26 @@ static CPUCaps Detect() {
|
|||
|
||||
if (max_std_fn >= 7) {
|
||||
__cpuidex(cpu_id, 0x00000007, 0x00000000);
|
||||
// Can't enable AVX2 unless the XSAVE/XGETBV checks above passed
|
||||
caps.avx2 = caps.avx && Common::Bit<5>(cpu_id[1]);
|
||||
// Can't enable AVX{2,512} unless the XSAVE/XGETBV checks above passed
|
||||
if (caps.avx) {
|
||||
caps.avx2 = Common::Bit<5>(cpu_id[1]);
|
||||
caps.avx512f = Common::Bit<16>(cpu_id[1]);
|
||||
caps.avx512dq = Common::Bit<17>(cpu_id[1]);
|
||||
caps.avx512cd = Common::Bit<28>(cpu_id[1]);
|
||||
caps.avx512bw = Common::Bit<30>(cpu_id[1]);
|
||||
caps.avx512vl = Common::Bit<31>(cpu_id[1]);
|
||||
caps.avx512vbmi = Common::Bit<1>(cpu_id[2]);
|
||||
caps.avx512bitalg = Common::Bit<12>(cpu_id[2]);
|
||||
}
|
||||
|
||||
caps.bmi1 = Common::Bit<3>(cpu_id[1]);
|
||||
caps.bmi2 = Common::Bit<8>(cpu_id[1]);
|
||||
// Checks for AVX512F, AVX512CD, AVX512VL, AVX512DQ, AVX512BW (Intel Skylake-X/SP)
|
||||
if (Common::Bit<16>(cpu_id[1]) && Common::Bit<28>(cpu_id[1]) &&
|
||||
Common::Bit<31>(cpu_id[1]) && Common::Bit<17>(cpu_id[1]) &&
|
||||
Common::Bit<30>(cpu_id[1])) {
|
||||
caps.avx512 = caps.avx2;
|
||||
}
|
||||
caps.sha = Common::Bit<29>(cpu_id[1]);
|
||||
|
||||
caps.gfni = Common::Bit<8>(cpu_id[2]);
|
||||
|
||||
__cpuidex(cpu_id, 0x00000007, 0x00000001);
|
||||
caps.avx_vnni = caps.avx && Common::Bit<4>(cpu_id[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue