PrimeOrderCalculator.PartialFactorCpu simplified to work only with spans and throw exception if the number of factors is exceeded. PrimeOrderMode removed in favor of bool flag.
This commit is contained in:
1 parent
72890bf343
commit
7a242b3bfa
15 files changed
+337
-302
No files matched your search
@@ -1,10 +1,10 @@
|
||||
namespace PerfectNumbers.Core.Gpu;
|
||||
|
||||
public readonly struct CalculateOrderKernelConfig(ulong previousOrder, byte hasPreviousOrder, uint smallFactorLimit, int maxPowChecks, int mode)
|
||||
public readonly struct CalculateOrderKernelConfig(ulong previousOrder, byte hasPreviousOrder, uint smallFactorLimit, int maxPowChecks, bool strictMode)
|
||||
{
|
||||
public readonly ulong PreviousOrder = previousOrder;
|
||||
public readonly byte HasPreviousOrder = hasPreviousOrder;
|
||||
public readonly uint SmallFactorLimit = smallFactorLimit;
|
||||
public readonly int MaxPowChecks = maxPowChecks;
|
||||
public readonly int Mode = mode;
|
||||
public readonly int Mode = strictMode ? 1 : 0;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ internal static partial class PrimeOrderGpuHeuristics
|
||||
PrimeOrderCalculatorAccelerator gpu,
|
||||
ulong prime,
|
||||
ulong? previousOrder,
|
||||
PrimeOrderCalculator.PrimeOrderSearchConfig config,
|
||||
PrimeOrderCalculator.PrimeOrderCalculatorConfig config,
|
||||
in MontgomeryDivisorData divisorData,
|
||||
out ulong order)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ internal static partial class PrimeOrderGpuHeuristics
|
||||
byte hasPrevious = previousOrder.HasValue ? (byte)1 : (byte)0;
|
||||
ulong previousValue = previousOrder ?? 0UL;
|
||||
|
||||
var kernelConfig = new CalculateOrderKernelConfig(previousValue, hasPrevious, limit, config.MaxPowChecks, (int)config.Mode);
|
||||
var kernelConfig = new CalculateOrderKernelConfig(previousValue, hasPrevious, limit, config.MaxPowChecks, config.StrictMode);
|
||||
ref var buffers = ref gpu.CalculateOrderKernelBuffers;
|
||||
|
||||
var kernelLauncher = gpu.CalculateOrderKernelLauncher;
|
||||
|
||||
Reference in new issue
Block a user