summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2020-06-23 15:19:47 -0400
committerGravatar GitHub2020-06-23 15:19:47 -0400
commit60da57b518ad712189b015c5d5afcba52446212e (patch)
treeca9e7918727594bc02968515d77f0a7a52ccc15a
parentMerge pull request #4148 from Morph1984/silence-warnings (diff)
parentmain: Append AVX and FMA instructions to cpu string (diff)
downloadyuzu-60da57b518ad712189b015c5d5afcba52446212e.tar.gz
yuzu-60da57b518ad712189b015c5d5afcba52446212e.tar.xz
yuzu-60da57b518ad712189b015c5d5afcba52446212e.zip
Merge pull request #3948 from Morph1984/log-cpu-instructions
main/common: Log/append AVX/FMA to the Host CPU string if available and add AVX512 detection
-rw-r--r--src/common/telemetry.cpp1
-rw-r--r--src/common/x64/cpu_detect.cpp5
-rw-r--r--src/common/x64/cpu_detect.h1
-rw-r--r--src/yuzu/main.cpp15
4 files changed, 21 insertions, 1 deletions
diff --git a/src/common/telemetry.cpp b/src/common/telemetry.cpp
index 200c6489a..16d42facd 100644
--- a/src/common/telemetry.cpp
+++ b/src/common/telemetry.cpp
@@ -60,6 +60,7 @@ void AppendCPUInfo(FieldCollection& fc) {
60 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes); 60 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
61 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx); 61 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx);
62 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2); 62 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2);
63 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX512", Common::GetCPUCaps().avx512);
63 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1); 64 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1);
64 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2); 65 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2);
65 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma); 66 fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma);
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index c9349a6b4..f35dcb498 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -110,6 +110,11 @@ static CPUCaps Detect() {
110 caps.bmi1 = true; 110 caps.bmi1 = true;
111 if ((cpu_id[1] >> 8) & 1) 111 if ((cpu_id[1] >> 8) & 1)
112 caps.bmi2 = true; 112 caps.bmi2 = true;
113 // Checks for AVX512F, AVX512CD, AVX512VL, AVX512DQ, AVX512BW (Intel Skylake-X/SP)
114 if ((cpu_id[1] >> 16) & 1 && (cpu_id[1] >> 28) & 1 && (cpu_id[1] >> 31) & 1 &&
115 (cpu_id[1] >> 17) & 1 && (cpu_id[1] >> 30) & 1) {
116 caps.avx512 = caps.avx2;
117 }
113 } 118 }
114 } 119 }
115 120
diff --git a/src/common/x64/cpu_detect.h b/src/common/x64/cpu_detect.h
index 20f2ba234..7606c3f7b 100644
--- a/src/common/x64/cpu_detect.h
+++ b/src/common/x64/cpu_detect.h
@@ -19,6 +19,7 @@ struct CPUCaps {
19 bool lzcnt; 19 bool lzcnt;
20 bool avx; 20 bool avx;
21 bool avx2; 21 bool avx2;
22 bool avx512;
22 bool bmi1; 23 bool bmi1;
23 bool bmi2; 24 bool bmi2;
24 bool fma; 25 bool fma;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 4119d7907..059b96e70 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -217,7 +217,20 @@ GMainWindow::GMainWindow()
217 LOG_INFO(Frontend, "yuzu Version: {} | {}-{}", yuzu_build_version, Common::g_scm_branch, 217 LOG_INFO(Frontend, "yuzu Version: {} | {}-{}", yuzu_build_version, Common::g_scm_branch,
218 Common::g_scm_desc); 218 Common::g_scm_desc);
219#ifdef ARCHITECTURE_x86_64 219#ifdef ARCHITECTURE_x86_64
220 LOG_INFO(Frontend, "Host CPU: {}", Common::GetCPUCaps().cpu_string); 220 const auto& caps = Common::GetCPUCaps();
221 std::string cpu_string = caps.cpu_string;
222 if (caps.avx || caps.avx2 || caps.avx512) {
223 cpu_string += " | AVX";
224 if (caps.avx512) {
225 cpu_string += "512";
226 } else if (caps.avx2) {
227 cpu_string += '2';
228 }
229 if (caps.fma || caps.fma4) {
230 cpu_string += " | FMA";
231 }
232 }
233 LOG_INFO(Frontend, "Host CPU: {}", cpu_string);
221#endif 234#endif
222 LOG_INFO(Frontend, "Host OS: {}", QSysInfo::prettyProductName().toStdString()); 235 LOG_INFO(Frontend, "Host OS: {}", QSysInfo::prettyProductName().toStdString());
223 LOG_INFO(Frontend, "Host RAM: {:.2f} GB", 236 LOG_INFO(Frontend, "Host RAM: {:.2f} GB",