main/common: Log/append AVX/FMA to the Host CPU string if available and add AVX512 detection

Co-Authored-By: Morph <morph1984@users.noreply.github.com>
This commit is contained in:
FearlessTobi 2020-08-09 01:55:26 +02:00
parent 52fe6daa53
commit ddb4135dea
5 changed files with 23 additions and 3 deletions

View File

@ -190,7 +190,20 @@ GMainWindow::GMainWindow()
LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch, LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
Common::g_scm_desc); Common::g_scm_desc);
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64
LOG_INFO(Frontend, "Host CPU: {}", Common::GetCPUCaps().cpu_string); const auto& caps = Common::GetCPUCaps();
std::string cpu_string = caps.cpu_string;
if (caps.avx || caps.avx2 || caps.avx512) {
cpu_string += " | AVX";
if (caps.avx512) {
cpu_string += "512";
} else if (caps.avx2) {
cpu_string += '2';
}
if (caps.fma || caps.fma4) {
cpu_string += " | FMA";
}
}
LOG_INFO(Frontend, "Host CPU: {}", cpu_string);
#endif #endif
LOG_INFO(Frontend, "Host OS: {}", QSysInfo::prettyProductName().toStdString()); LOG_INFO(Frontend, "Host OS: {}", QSysInfo::prettyProductName().toStdString());
UpdateWindowTitle(); UpdateWindowTitle();

View File

@ -60,6 +60,7 @@ void AppendCPUInfo(FieldCollection& fc) {
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes); fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx); fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx);
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2); fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2);
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX512", Common::GetCPUCaps().avx512);
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1); fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1);
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2); fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2);
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma); fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma);

View File

@ -55,8 +55,8 @@ public:
Field(FieldType type, std::string name, T value) Field(FieldType type, std::string name, T value)
: name(std::move(name)), type(type), value(std::move(value)) {} : name(std::move(name)), type(type), value(std::move(value)) {}
Field(const Field& other) = default; Field(const Field&) = default;
Field& operator=(const Field& other) = default; Field& operator=(const Field&) = default;
Field(Field&&) = default; Field(Field&&) = default;
Field& operator=(Field&& other) = default; Field& operator=(Field&& other) = default;

View File

@ -110,6 +110,11 @@ static CPUCaps Detect() {
caps.bmi1 = true; caps.bmi1 = true;
if ((cpu_id[1] >> 8) & 1) if ((cpu_id[1] >> 8) & 1)
caps.bmi2 = true; caps.bmi2 = true;
// Checks for AVX512F, AVX512CD, AVX512VL, AVX512DQ, AVX512BW (Intel Skylake-X/SP)
if ((cpu_id[1] >> 16) & 1 && (cpu_id[1] >> 28) & 1 && (cpu_id[1] >> 31) & 1 &&
(cpu_id[1] >> 17) & 1 && (cpu_id[1] >> 30) & 1) {
caps.avx512 = caps.avx2;
}
} }
} }

View File

@ -18,6 +18,7 @@ struct CPUCaps {
bool sse4_2; bool sse4_2;
bool avx; bool avx;
bool avx2; bool avx2;
bool avx512;
bool bmi1; bool bmi1;
bool bmi2; bool bmi2;
bool fma; bool fma;