Make executor slot count setting exponential

This commit is contained in:
Billy Laws 2022-11-19 16:05:08 +00:00
parent e0ae94be9d
commit bfae292fb0
7 changed files with 16 additions and 15 deletions

View File

@ -39,7 +39,7 @@ namespace skyline {
disableFrameThrottling = ktSettings.GetBool("disableFrameThrottling"); disableFrameThrottling = ktSettings.GetBool("disableFrameThrottling");
gpuDriver = ktSettings.GetString("gpuDriver"); gpuDriver = ktSettings.GetString("gpuDriver");
gpuDriverLibraryName = ktSettings.GetString("gpuDriverLibraryName"); gpuDriverLibraryName = ktSettings.GetString("gpuDriverLibraryName");
executorSlotCount = ktSettings.GetInt<u32>("executorSlotCount"); executorSlotCountScale = ktSettings.GetInt<u32>("executorSlotCountScale");
enableFastGpuReadbackHack = ktSettings.GetBool("enableFastGpuReadbackHack"); enableFastGpuReadbackHack = ktSettings.GetBool("enableFastGpuReadbackHack");
isAudioOutputDisabled = ktSettings.GetBool("isAudioOutputDisabled"); isAudioOutputDisabled = ktSettings.GetBool("isAudioOutputDisabled");
validationLayer = ktSettings.GetBool("validationLayer"); validationLayer = ktSettings.GetBool("validationLayer");

View File

@ -71,7 +71,7 @@ namespace skyline {
// GPU // GPU
Setting<std::string> gpuDriver; //!< The label of the GPU driver to use Setting<std::string> gpuDriver; //!< The label of the GPU driver to use
Setting<std::string> gpuDriverLibraryName; //!< The name of the GPU driver library to use Setting<std::string> gpuDriverLibraryName; //!< The name of the GPU driver library to use
Setting<u32> executorSlotCount; //!< Number of GPU executor slots that can be used concurrently Setting<u32> executorSlotCountScale; //!< Number of GPU executor slots that can be used concurrently
// Hacks // Hacks
Setting<bool> enableFastGpuReadbackHack; //!< If the CPU texture readback skipping hack should be used Setting<bool> enableFastGpuReadbackHack; //!< If the CPU texture readback skipping hack should be used

View File

@ -7,12 +7,13 @@
#include <gpu.h> #include <gpu.h>
#include <dlfcn.h> #include <dlfcn.h>
#include "command_executor.h" #include "command_executor.h"
#include <nce.h>
namespace skyline::gpu::interconnect { namespace skyline::gpu::interconnect {
CommandRecordThread::CommandRecordThread(const DeviceState &state) CommandRecordThread::CommandRecordThread(const DeviceState &state)
: state{state}, : state{state},
incoming{*state.settings->executorSlotCount}, incoming{1U << *state.settings->executorSlotCountScale},
outgoing{*state.settings->executorSlotCount}, outgoing{1U << *state.settings->executorSlotCountScale},
thread{&CommandRecordThread::Run, this} {} thread{&CommandRecordThread::Run, this} {}
CommandRecordThread::Slot::ScopedBegin::ScopedBegin(CommandRecordThread::Slot &slot) : slot{slot} {} CommandRecordThread::Slot::ScopedBegin::ScopedBegin(CommandRecordThread::Slot &slot) : slot{slot} {}
@ -126,7 +127,7 @@ namespace skyline::gpu::interconnect {
} }
std::vector<Slot> slots{}; std::vector<Slot> slots{};
std::generate_n(std::back_inserter(slots), *state.settings->executorSlotCount, [&] () -> Slot { return gpu; }); std::generate_n(std::back_inserter(slots), (1U << *state.settings->executorSlotCountScale), [&] () -> Slot { return gpu; });
outgoing.AppendTranform(span<Slot>(slots), [](auto &slot) { return &slot; }); outgoing.AppendTranform(span<Slot>(slots), [](auto &slot) { return &slot; });
@ -472,7 +473,7 @@ namespace skyline::gpu::interconnect {
renderPassIndex = 0; renderPassIndex = 0;
// Periodically clear preserve attachments just in case there are new waiters which would otherwise end up waiting forever // Periodically clear preserve attachments just in case there are new waiters which would otherwise end up waiting forever
if ((submissionNumber % (*state.settings->executorSlotCount * 2)) == 0) { if ((submissionNumber % (2U << *state.settings->executorSlotCountScale)) == 0) {
preserveAttachedBuffers.clear(); preserveAttachedBuffers.clear();
preserveAttachedTextures.clear(); preserveAttachedTextures.clear();
} }

View File

@ -25,7 +25,7 @@ class NativeSettings(context : Context, pref : PreferenceSettings) {
// GPU // GPU
var gpuDriver : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else pref.gpuDriver var gpuDriver : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else pref.gpuDriver
var gpuDriverLibraryName : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else GpuDriverHelper.getLibraryName(context, pref.gpuDriver) var gpuDriverLibraryName : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else GpuDriverHelper.getLibraryName(context, pref.gpuDriver)
var executorSlotCount : Int = pref.executorSlotCount var executorSlotCountScale : Int = pref.executorSlotCountScale
// Hacks // Hacks
var enableFastGpuReadbackHack : Boolean = pref.enableFastGpuReadbackHack var enableFastGpuReadbackHack : Boolean = pref.enableFastGpuReadbackHack

View File

@ -38,7 +38,7 @@ class PreferenceSettings @Inject constructor(@ApplicationContext private val con
// GPU // GPU
var gpuDriver by sharedPreferences(context, SYSTEM_GPU_DRIVER) var gpuDriver by sharedPreferences(context, SYSTEM_GPU_DRIVER)
var executorSlotCount by sharedPreferences(context, 6) var executorSlotCountScale by sharedPreferences(context, 6)
// Hacks // Hacks
var enableFastGpuReadbackHack by sharedPreferences(context, false) var enableFastGpuReadbackHack by sharedPreferences(context, false)

View File

@ -73,8 +73,8 @@
<string name="respect_display_cutout">Respect Display Cutout</string> <string name="respect_display_cutout">Respect Display Cutout</string>
<string name="respect_display_cutout_enabled">Do not draw UI elements in the cutout area</string> <string name="respect_display_cutout_enabled">Do not draw UI elements in the cutout area</string>
<string name="respect_display_cutout_disabled">Allow UI elements to be drawn in the cutout area</string> <string name="respect_display_cutout_disabled">Allow UI elements to be drawn in the cutout area</string>
<string name="executor_slot_count">Executor Slot Count</string> <string name="executor_slot_count_scale">Executor Slot Count Scale</string>
<string name="executor_slot_count_desc">Maximum number of simultaneous GPU executions (Higher may sometimes perform better but will use more RAM)</string> <string name="executor_slot_count_scale_desc">Scale controlling the maximum number of simultaneous GPU executions (Higher may sometimes perform better but will use more RAM)</string>
<!-- Settings - Hacks --> <!-- Settings - Hacks -->
<string name="hacks">Hacks</string> <string name="hacks">Hacks</string>
<string name="enable_fast_gpu_readback">Enable fast GPU readback</string> <string name="enable_fast_gpu_readback">Enable fast GPU readback</string>

View File

@ -129,11 +129,11 @@
app:title="@string/respect_display_cutout" /> app:title="@string/respect_display_cutout" />
<SeekBarPreference <SeekBarPreference
android:min="1" android:min="1"
android:defaultValue="6" android:defaultValue="4"
android:max="16" android:max="6"
android:summary="@string/executor_slot_count_desc" android:summary="@string/executor_slot_count_scale_desc"
app:key="executor_slot_count" app:key="executor_slot_count_scale"
app:title="@string/executor_slot_count" app:title="@string/executor_slot_count_scale"
app:showSeekBarValue="true" /> app:showSeekBarValue="true" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory