mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Auto-set NCNN GPU threads default value based on hardware
This commit is contained in:
9
CodeLegacy/Forms/SettingsForm.Designer.cs
generated
9
CodeLegacy/Forms/SettingsForm.Designer.cs
generated
@@ -1188,11 +1188,6 @@
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
this.ncnnThreads.Minimum = new decimal(new int[] {
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.ncnnThreads.Name = "ncnnThreads";
|
this.ncnnThreads.Name = "ncnnThreads";
|
||||||
this.ncnnThreads.Size = new System.Drawing.Size(77, 20);
|
this.ncnnThreads.Size = new System.Drawing.Size(77, 20);
|
||||||
this.ncnnThreads.TabIndex = 75;
|
this.ncnnThreads.TabIndex = 75;
|
||||||
@@ -1269,9 +1264,9 @@
|
|||||||
this.label44.Location = new System.Drawing.Point(370, 101);
|
this.label44.Location = new System.Drawing.Point(370, 101);
|
||||||
this.label44.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.label44.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
this.label44.Name = "label44";
|
this.label44.Name = "label44";
|
||||||
this.label44.Size = new System.Drawing.Size(358, 13);
|
this.label44.Size = new System.Drawing.Size(330, 13);
|
||||||
this.label44.TabIndex = 60;
|
this.label44.TabIndex = 60;
|
||||||
this.label44.Text = "Use 1 for small videos, 2 for >1080p, higher values might cause slowdown!";
|
this.label44.Text = "Higher will cause more GPU/VRAM load but can be faster. 0 = Auto.";
|
||||||
//
|
//
|
||||||
// label43
|
// label43
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ namespace Flowframes.IO
|
|||||||
if (key == Key.uhdThresh) return WriteDefault(key, "1600");
|
if (key == Key.uhdThresh) return WriteDefault(key, "1600");
|
||||||
if (key == Key.torchGpus) return WriteDefault(key, "0");
|
if (key == Key.torchGpus) return WriteDefault(key, "0");
|
||||||
if (key == Key.ncnnGpus) return WriteDefault(key, "0");
|
if (key == Key.ncnnGpus) return WriteDefault(key, "0");
|
||||||
if (key == Key.ncnnThreads) return WriteDefault(key, "4");
|
if (key == Key.ncnnThreads) return WriteDefault(key, "0");
|
||||||
if (key == Key.dainNcnnTilesize) return WriteDefault(key, "768");
|
if (key == Key.dainNcnnTilesize) return WriteDefault(key, "768");
|
||||||
// Debug / Other / Experimental
|
// Debug / Other / Experimental
|
||||||
if (key == Key.ffEncPreset) return WriteDefault(key, "fast");
|
if (key == Key.ffEncPreset) return WriteDefault(key, "fast");
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ namespace Flowframes.Utilities
|
|||||||
int threads = Config.GetInt(Config.Key.ncnnThreads);
|
int threads = Config.GetInt(Config.Key.ncnnThreads);
|
||||||
int maxThreads = VulkanUtils.GetMaxNcnnThreads(gpuId).Clamp(1, 64);
|
int maxThreads = VulkanUtils.GetMaxNcnnThreads(gpuId).Clamp(1, 64);
|
||||||
|
|
||||||
|
if(threads == 0)
|
||||||
|
{
|
||||||
|
threads = (maxThreads / 2f).RoundToInt().Clamp(1, maxThreads); // Default to half of max threads
|
||||||
|
}
|
||||||
|
|
||||||
threads = threads.Clamp(1, maxThreads); // To avoid exceeding the max queue count
|
threads = threads.Clamp(1, maxThreads); // To avoid exceeding the max queue count
|
||||||
Logger.Log($"Using {threads}/{maxThreads} GPU compute threads.", true, false, ai.LogFilename);
|
Logger.Log($"Using {threads}/{maxThreads} GPU compute threads.", true, false, ai.LogFilename);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user