Qt/Core: implement max llvm compile threads

This commit is contained in:
Megamouse 2018-01-24 17:38:38 +01:00 committed by Ivan
parent c8965564e4
commit b9c10a186d
7 changed files with 34 additions and 19 deletions

View file

@ -1161,7 +1161,9 @@ extern void ppu_initialize(const ppu_module& info)
static semaphore<> jmutex; static semaphore<> jmutex;
// Initialize semaphore with the max number of threads // Initialize semaphore with the max number of threads
semaphore<INT32_MAX> jcores(std::thread::hardware_concurrency()); u32 max_threads = static_cast<u32>(g_cfg.core.llvm_threads);
s32 thread_count = max_threads > 0 ? std::min(max_threads, std::thread::hardware_concurrency()) : std::thread::hardware_concurrency();
semaphore<INT32_MAX> jcores(thread_count);
if (!jcores.get()) if (!jcores.get())
{ {

View file

@ -285,6 +285,7 @@ struct cfg_root : cfg::node
cfg::_bool ppu_debug{this, "PPU Debug"}; cfg::_bool ppu_debug{this, "PPU Debug"};
cfg::_bool llvm_logs{this, "Save LLVM logs"}; cfg::_bool llvm_logs{this, "Save LLVM logs"};
cfg::string llvm_cpu{this, "Use LLVM CPU"}; cfg::string llvm_cpu{this, "Use LLVM CPU"};
cfg::_int<0, INT32_MAX> llvm_threads{this, "Max LLVM Compile Threads", 0};
#ifdef _WIN32 #ifdef _WIN32
cfg::_bool thread_scheduler_enabled{ this, "Enable thread scheduler", true }; cfg::_bool thread_scheduler_enabled{ this, "Enable thread scheduler", true };

View file

@ -64,6 +64,7 @@
"gs_resizeOnBoot": "Automatically resizes the game window on boot.\nThis does not change the internal game resolution.", "gs_resizeOnBoot": "Automatically resizes the game window on boot.\nThis does not change the internal game resolution.",
"showTrophyPopups": "Show trophy popups when a trophy is unlocked.", "showTrophyPopups": "Show trophy popups when a trophy is unlocked.",
"gs_disableMouse": "Disables the activation of fullscreen mode per doubleclick while the game screen is active.\nCheck this if you want to play with mouse and keyboard (for example with UCR).", "gs_disableMouse": "Disables the activation of fullscreen mode per doubleclick while the game screen is active.\nCheck this if you want to play with mouse and keyboard (for example with UCR).",
"maxLLVMThreads": "Limits the maximum number of threads used for PPU Module compilation.\nLower this in order to increase performance of other open applications.\nThe default uses all available threads.",
"useNativeInterface": "Enables use of native HUD within the game window that can interacts with the game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nNot all languages are currently supported (English only)" "useNativeInterface": "Enables use of native HUD within the game window that can interacts with the game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nNot all languages are currently supported (English only)"
} }
}, },

View file

@ -222,13 +222,15 @@ void emu_settings::SaveSettings()
m_config.write(out.c_str(), out.size()); m_config.write(out.c_str(), out.size());
} }
void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged) void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged, bool use_max, int max)
{ {
if (is_ranged) if (is_ranged)
{ {
QStringList range = GetSettingOptions(type); QStringList range = GetSettingOptions(type);
for (int i = range.first().toInt(); i <= range.last().toInt(); i++) int max_item = use_max ? max : range.last().toInt();
for (int i = range.first().toInt(); i <= max_item; i++)
{ {
combobox->addItem(QString::number(i), QVariant(QString::number(i))); combobox->addItem(QString::number(i), QVariant(QString::number(i)));
} }

View file

@ -36,6 +36,7 @@ public:
PreferredSPUThreads, PreferredSPUThreads,
PPUDebug, PPUDebug,
SPUDebug, SPUDebug,
MaxLLVMThreads,
// Graphics // Graphics
Renderer, Renderer,
@ -143,7 +144,7 @@ public:
~emu_settings(); ~emu_settings();
/** Connects a combo box with the target settings type*/ /** Connects a combo box with the target settings type*/
void EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged = false); void EnhanceComboBox(QComboBox* combobox, SettingsType type, bool is_ranged = false, bool use_max = false, int max = 0);
/** Connects a check box with the target settings type*/ /** Connects a check box with the target settings type*/
void EnhanceCheckBox(QCheckBox* checkbox, SettingsType type); void EnhanceCheckBox(QCheckBox* checkbox, SettingsType type);
@ -193,6 +194,7 @@ private:
{ PreferredSPUThreads, { "Core", "Preferred SPU Threads"}}, { PreferredSPUThreads, { "Core", "Preferred SPU Threads"}},
{ PPUDebug, { "Core", "PPU Debug"}}, { PPUDebug, { "Core", "PPU Debug"}},
{ SPUDebug, { "Core", "SPU Debug"}}, { SPUDebug, { "Core", "SPU Debug"}},
{ MaxLLVMThreads, { "Core", "Max LLVM Compile Threads"}},
// Graphics Tab // Graphics Tab
{ Renderer, { "Video", "Renderer"}}, { Renderer, { "Video", "Renderer"}},

View file

@ -22,6 +22,7 @@
#include "Crypto/unself.h" #include "Crypto/unself.h"
#include <unordered_set> #include <unordered_set>
#include <thread>
inline std::string sstr(const QString& _in) { return _in.toStdString(); } inline std::string sstr(const QString& _in) { return _in.toStdString(); }
inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); }
@ -692,6 +693,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
// Comboboxes // Comboboxes
xemu_settings->EnhanceComboBox(ui->maxLLVMThreads, emu_settings::MaxLLVMThreads, true, true, std::thread::hardware_concurrency());
SubscribeTooltip(ui->maxLLVMThreads, json_emu_misc["maxLLVMThreads"].toString());
ui->maxLLVMThreads->setItemText(ui->maxLLVMThreads->findData("0"), tr("All (%1)").arg(std::thread::hardware_concurrency()));
SubscribeTooltip(ui->combo_configs, json_emu_gui["configs"].toString()); SubscribeTooltip(ui->combo_configs, json_emu_gui["configs"].toString());
SubscribeTooltip(ui->combo_stylesheets, json_emu_gui["stylesheets"].toString()); SubscribeTooltip(ui->combo_stylesheets, json_emu_gui["stylesheets"].toString());
@ -727,7 +732,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
if (game) if (game)
{ {
ui->gb_stylesheets->setEnabled(false); ui->gb_stylesheets->setEnabled(false);
ui->gb_configs->setEnabled(false);
ui->gb_settings->setEnabled(false); ui->gb_settings->setEnabled(false);
ui->gb_colors->setEnabled(false); ui->gb_colors->setEnabled(false);
ui->gb_viewport->setEnabled(false); ui->gb_viewport->setEnabled(false);

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>787</width> <width>1011</width>
<height>566</height> <height>775</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -1377,20 +1377,13 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_58"> <layout class="QVBoxLayout" name="verticalLayout_58">
<item> <item>
<widget class="QGroupBox" name="gb_configs"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>UI Configurations</string> <string>Max LLVM Compile Threads</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_44"> <layout class="QVBoxLayout" name="verticalLayout_63">
<item> <item>
<widget class="QComboBox" name="combo_configs"/> <widget class="QComboBox" name="maxLLVMThreads"/>
</item>
<item>
<widget class="QPushButton" name="pb_apply_config">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -1439,12 +1432,22 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>0</width> <width>20</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QComboBox" name="combo_configs"/>
</item>
<item>
<widget class="QPushButton" name="pb_apply_config">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>