Add a setting to control the maximum number of accumulated GPU cmds

This helps to keep the GPU fed when processing large command buffers which don't have any syncpoints to force a flush inbetween.
This commit is contained in:
Billy Laws 2022-12-24 20:59:10 +00:00
parent 77214a98dd
commit c67f27e914
7 changed files with 17 additions and 0 deletions

View File

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

View File

@ -73,6 +73,7 @@ namespace skyline {
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<u32> executorSlotCountScale; //!< Number of GPU executor slots that can be used concurrently
Setting<u32> executorFlushThreshold; //!< Number of commands that need to accumulate before they're flushed to the GPU
// Hacks
Setting<bool> enableFastGpuReadbackHack; //!< If the CPU texture readback skipping hack should be used

View File

@ -367,6 +367,9 @@ namespace skyline::gpu::interconnect {
slot->nodes.emplace_back(std::in_place_type_t<node::NextSubpassFunctionNode>(), std::forward<decltype(function)>(function));
else
slot->nodes.emplace_back(std::in_place_type_t<node::SubpassFunctionNode>(), std::forward<decltype(function)>(function));
if (slot->nodes.size() > *state.settings->executorFlushThreshold && !gotoNext)
Submit();
}
void CommandExecutor::AddOutsideRpCommand(std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &)> &&function) {

View File

@ -27,6 +27,7 @@ class NativeSettings(context : Context, pref : PreferenceSettings) {
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 executorSlotCountScale : Int = pref.executorSlotCountScale
var executorFlushThreshold : Int = pref.executorFlushThreshold
// Hacks
var enableFastGpuReadbackHack : Boolean = pref.enableFastGpuReadbackHack

View File

@ -40,6 +40,7 @@ class PreferenceSettings @Inject constructor(@ApplicationContext private val con
// GPU
var gpuDriver by sharedPreferences(context, SYSTEM_GPU_DRIVER)
var executorSlotCountScale by sharedPreferences(context, 6)
var executorFlushThreshold by sharedPreferences(context, 256)
var forceMaxGpuClocks by sharedPreferences(context, false)
// Hacks

View File

@ -77,6 +77,8 @@
<string name="respect_display_cutout_disabled">Allow UI elements to be drawn in the cutout area</string>
<string name="executor_slot_count_scale">Executor Slot Count Scale</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>
<string name="executor_flush_threshold">Executor Flush Threshold</string>
<string name="executor_flush_threshold_desc">Controls how frequently work is flushed to the GPU</string>
<string name="force_max_gpu_clocks">Force Maximum GPU Clocks</string>
<string name="force_max_gpu_clocks_desc">Forces the GPU to run at its maximum possible clock speed (May cause excessive heating and power usage)</string>
<string name="force_max_gpu_clocks_desc_unsupported">Your device does not support forcing maximum GPU clocks</string>

View File

@ -138,6 +138,14 @@
app:key="executor_slot_count_scale"
app:title="@string/executor_slot_count_scale"
app:showSeekBarValue="true" />
<SeekBarPreference
android:min="0"
android:defaultValue="256"
android:max="1024"
android:summary="@string/executor_flush_threshold_desc"
app:key="executor_flush_threshold"
app:title="@string/executor_flush_threshold"
app:showSeekBarValue="true" />
<CheckBoxPreference
android:defaultValue="false"
android:summary="@string/force_max_gpu_clocks_desc"