Heuristic and small prime factor kernels restored in PrimeOrderAcceleratorTemplate.
This commit is contained in:
1 parent
6603f65993
commit
75a2017385
1 file changed
+8
-11
@@ -16,7 +16,7 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
public static PrimeOrderCalculatorAccelerator Rent(int primeTesterCapacity)
|
||||
{
|
||||
var pool = _pool ??= new(PerfectNumberConstants.DefaultThreadPoolCapacity);
|
||||
if (pool.Pop() is { } gpu)
|
||||
if (pool.TryPop(out var gpu))
|
||||
{
|
||||
gpu.EnsureCapacity(PerfectNumberConstants.DefaultFactorsBuffer, primeTesterCapacity);
|
||||
return gpu;
|
||||
@@ -67,8 +67,8 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
// TODO: Review which tables are needed when final execution path is defined.
|
||||
LastDigitGpuTables.WarmUp(i, stream);
|
||||
_kernels[i] = new CalculatorKernels(accelerator);
|
||||
// HeuristicCombinedGpuTables.WarmUp(i, stream);
|
||||
// SmallPrimeFactorGpuTables.WarmUp(i, stream);
|
||||
HeuristicCombinedGpuTables.WarmUp(i, stream);
|
||||
SmallPrimeFactorGpuTables.WarmUp(i, stream);
|
||||
// SharedHeuristicGpuTables.EnsureStaticTables(accelerator, stream);
|
||||
// _ = GpuKernelPool.GetOrAddKernels(accelerator, stream, KernelType.None);
|
||||
// KernelContainer kernels = GpuKernelPool.GetOrAddKernels(accelerator, stream);
|
||||
@@ -170,7 +170,7 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
|
||||
// public readonly Action<AcceleratorStream, Index1D, ArrayView<ulong>, ArrayView<byte>> SharesFactorKernelLauncher = KernelUtil.GetKernel(accelerator.LoadAutoGroupedStreamKernel<Index1D, ArrayView<ulong>, ArrayView<byte>>(PrimeTesterKernels.SharesFactorKernel)).CreateLauncherDelegate<Action<AcceleratorStream, Index1D, ArrayView<ulong>, ArrayView<byte>>>();
|
||||
|
||||
// public readonly Action<AcceleratorStream, Index1D, ulong, uint, ArrayView1D<uint, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>, int, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>> SmallPrimeFactorKernelLauncher = KernelUtil.GetKernel(accelerator.LoadAutoGroupedStreamKernel<Index1D, ulong, uint, ArrayView1D<uint, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>, int, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>>(SmallPrimeFactorKernels.SmallPrimeFactorKernelScan)).CreateLauncherDelegate<Action<AcceleratorStream, Index1D, ulong, uint, ArrayView1D<uint, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>, int, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>>>();
|
||||
public readonly Action<AcceleratorStream, Index1D, ulong, uint, ArrayView1D<uint, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>, int, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>> SmallPrimeFactorKernelLauncher = KernelUtil.GetKernel(accelerator.LoadAutoGroupedStreamKernel<Index1D, ulong, uint, ArrayView1D<uint, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>, int, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>>(SmallPrimeFactorKernels.SmallPrimeFactorKernelScan)).CreateLauncherDelegate<Action<AcceleratorStream, Index1D, ulong, uint, ArrayView1D<uint, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>, int, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<int, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>>>();
|
||||
|
||||
// public readonly Action<AcceleratorStream, Index1D, ArrayView<ulong>, ArrayView<uint>, ArrayView<uint>, ArrayView<uint>, ArrayView<uint>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<byte>> SmallPrimeSieveKernelLauncher = KernelUtil.GetKernel(accelerator.LoadAutoGroupedStreamKernel<Index1D, ArrayView<ulong>, ArrayView<uint>, ArrayView<uint>, ArrayView<uint>, ArrayView<uint>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<byte>>(PrimeTesterKernels.SmallPrimeSieveKernel)).CreateLauncherDelegate<Action<AcceleratorStream, Index1D, ArrayView<ulong>, ArrayView<uint>, ArrayView<uint>, ArrayView<uint>, ArrayView<uint>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<ulong>, ArrayView<byte>>>();
|
||||
|
||||
@@ -360,8 +360,6 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
Accelerator = accelerator;
|
||||
AcceleratorIndex = acceleratorIndex;
|
||||
|
||||
// lock (accelerator)
|
||||
// {
|
||||
Input = accelerator.Allocate1D<ulong>(Math.Max(Math.Max(specialMaxFactorCapacity, primeTesterCapacity), PrimeOrderConstants.MaxGpuBatchSize));
|
||||
InputView = Input.View;
|
||||
|
||||
@@ -423,9 +421,9 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
DevicePrimesPow2LastThree = lastDigitSharedTables.DevicePrimesPow2LastThree.View;
|
||||
DevicePrimesPow2LastNine = lastDigitSharedTables.DevicePrimesPow2LastNine.View;
|
||||
|
||||
// DivisorTables = HeuristicCombinedGpuTables
|
||||
// .GetStaticTables(acceleratorIndex)
|
||||
// .CreateViews();
|
||||
DivisorTables = HeuristicCombinedGpuTables
|
||||
.GetStaticTables(acceleratorIndex)
|
||||
.CreateViews();
|
||||
|
||||
var smallPrimeFactorTables = SmallPrimeFactorGpuTables.GetStaticTables(acceleratorIndex);
|
||||
|
||||
@@ -448,10 +446,9 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
Pow2ModKernelLauncher = kernels.Pow2ModKernelLauncher;
|
||||
Pow2ModWideKernelLauncher = kernels.Pow2ModWideKernelLauncher;
|
||||
// SharesFactorKernelLauncher = kernels.SharesFactorKernelLauncher;
|
||||
// SmallPrimeFactorKernelLauncher = kernels.SmallPrimeFactorKernelLauncher;
|
||||
SmallPrimeFactorKernelLauncher = kernels.SmallPrimeFactorKernelLauncher;
|
||||
// SmallPrimeSieveKernelLauncher = kernels.SmallPrimeSieveKernelLauncher;
|
||||
SpecialMaxKernelLauncher = kernels.SpecialMaxKernelLauncher;
|
||||
// }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
Reference in new issue
Block a user