2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

core,common,yuzu qt: Add CPU accuracy option 'Auto'

The current CPU accuracy settings in yuzu are fairly polarized and
require more than common knowledge to know what the optimal settings for
yuzu would be. This adds a curated option called 'Auto' that applies a
few at the moment known-good unsafe optimizations to Dynarmic.
This commit is contained in:
lat9nq 2021-06-30 22:22:21 -04:00
parent 5edc96f4a4
commit 7ab5767157
4 changed files with 50 additions and 16 deletions

View file

@ -31,9 +31,10 @@ enum class GPUAccuracy : u32 {
}; };
enum class CPUAccuracy : u32 { enum class CPUAccuracy : u32 {
Accurate = 0, Auto = 0,
Unsafe = 1, Accurate = 1,
DebugMode = 2, Unsafe = 2,
DebugMode = 3,
}; };
/** The BasicSetting class is a simple resource manager. It defines a label and default value /** The BasicSetting class is a simple resource manager. It defines a label and default value
@ -284,7 +285,7 @@ struct Values {
Setting<bool> use_multi_core{true, "use_multi_core"}; Setting<bool> use_multi_core{true, "use_multi_core"};
// Cpu // Cpu
Setting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Accurate, "cpu_accuracy"}; Setting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Auto, "cpu_accuracy"};
BasicSetting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"}; BasicSetting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"};
BasicSetting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"}; BasicSetting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"};

View file

@ -183,16 +183,30 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
// Unsafe optimizations // Unsafe optimizations
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) { if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) {
config.unsafe_optimizations = true; config.unsafe_optimizations = true;
if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) { if (Settings::values.cpuopt_unsafe_unfuse_fma) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
} }
if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) { if (Settings::values.cpuopt_unsafe_reduce_fp_error) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
} }
if (Settings::values.cpuopt_unsafe_ignore_standard_fpcr.GetValue()) { if (Settings::values.cpuopt_unsafe_ignore_standard_fpcr) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_IgnoreStandardFPCRValue; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_IgnoreStandardFPCRValue;
} }
if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) { if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
}
}
// Curated optimizations
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Auto) {
config.unsafe_optimizations = true;
if (Settings::values.cpuopt_unsafe_unfuse_fma) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
}
if (Settings::values.cpuopt_unsafe_ignore_standard_fpcr) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_IgnoreStandardFPCRValue;
}
if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
} }
} }

View file

@ -223,16 +223,30 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
// Unsafe optimizations // Unsafe optimizations
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) { if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Unsafe) {
config.unsafe_optimizations = true; config.unsafe_optimizations = true;
if (Settings::values.cpuopt_unsafe_unfuse_fma.GetValue()) { if (Settings::values.cpuopt_unsafe_unfuse_fma) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
} }
if (Settings::values.cpuopt_unsafe_reduce_fp_error.GetValue()) { if (Settings::values.cpuopt_unsafe_reduce_fp_error) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_ReducedErrorFP;
} }
if (Settings::values.cpuopt_unsafe_inaccurate_nan.GetValue()) { if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN; config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
} }
if (Settings::values.cpuopt_unsafe_fastmem_check.GetValue()) { if (Settings::values.cpuopt_unsafe_fastmem_check) {
config.fastmem_address_space_bits = 64;
}
}
// Curated optimizations
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::Auto) {
config.unsafe_optimizations = true;
if (Settings::values.cpuopt_unsafe_unfuse_fma) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_UnfuseFMA;
}
if (Settings::values.cpuopt_unsafe_inaccurate_nan) {
config.optimizations |= Dynarmic::OptimizationFlag::Unsafe_InaccurateNaN;
}
if (Settings::values.cpuopt_unsafe_fastmem_check) {
config.fastmem_address_space_bits = 64; config.fastmem_address_space_bits = 64;
} }
} }

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>448</width>
<height>321</height> <height>433</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -17,7 +17,7 @@
<item> <item>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<widget class="QGroupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>General</string> <string>General</string>
</property> </property>
@ -34,6 +34,11 @@
</item> </item>
<item> <item>
<widget class="QComboBox" name="accuracy"> <widget class="QComboBox" name="accuracy">
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Accurate</string> <string>Accurate</string>
@ -57,7 +62,7 @@
<item> <item>
<widget class="QLabel" name="label_recommended_accuracy"> <widget class="QLabel" name="label_recommended_accuracy">
<property name="text"> <property name="text">
<string>We recommend setting accuracy to &quot;Accurate&quot;.</string> <string>We recommend setting accuracy to &quot;Auto&quot;.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>false</bool> <bool>false</bool>