misc: Code cleanups & improvements, again

This commit is contained in:
Evan Husted 2024-10-17 01:21:32 -05:00
parent a13cf098b4
commit 235083ad75
13 changed files with 75 additions and 156 deletions

View file

@ -6,7 +6,7 @@ namespace ARMeilleure
public static class Optimizations
{
// low-core count PPTC
public static bool EcoFriendly { get; set; } = false;
public static bool LowPower { get; set; } = false;
public static bool FastFP { get; set; } = true;
@ -54,8 +54,8 @@ namespace ARMeilleure
internal static bool UseSse41 => UseSse41IfAvailable && X86HardwareCapabilities.SupportsSse41;
internal static bool UseSse42 => UseSse42IfAvailable && X86HardwareCapabilities.SupportsSse42;
internal static bool UsePopCnt => UsePopCntIfAvailable && X86HardwareCapabilities.SupportsPopcnt;
internal static bool UseAvx => UseAvxIfAvailable && X86HardwareCapabilities.SupportsAvx && !ForceLegacySse;
internal static bool UseAvx512F => UseAvx512FIfAvailable && X86HardwareCapabilities.SupportsAvx512F && !ForceLegacySse;
internal static bool UseAvx => UseAvxIfAvailable && X86HardwareCapabilities.SupportsAvx && !ForceLegacySse;
internal static bool UseAvx512F => UseAvx512FIfAvailable && X86HardwareCapabilities.SupportsAvx512F && !ForceLegacySse;
internal static bool UseAvx512Vl => UseAvx512VlIfAvailable && X86HardwareCapabilities.SupportsAvx512Vl && !ForceLegacySse;
internal static bool UseAvx512Bw => UseAvx512BwIfAvailable && X86HardwareCapabilities.SupportsAvx512Bw && !ForceLegacySse;
internal static bool UseAvx512Dq => UseAvx512DqIfAvailable && X86HardwareCapabilities.SupportsAvx512Dq && !ForceLegacySse;

View file

@ -799,11 +799,11 @@ namespace ARMeilleure.Translation.PTC
int degreeOfParallelism = Environment.ProcessorCount;
if (Optimizations.EcoFriendly)
if (Optimizations.LowPower)
degreeOfParallelism /= 3;
// If there are enough cores lying around, we leave one alone for other tasks.
if (degreeOfParallelism > 4 && !Optimizations.EcoFriendly)
if (degreeOfParallelism > 4 && !Optimizations.LowPower)
{
degreeOfParallelism--;
}