App crash fix related to unassigned value
This commit is contained in:
1 parent
56be12ab95
commit
a5696ca17f
2 files changed
+10
-5
No files matched your search
@@ -129,7 +129,7 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
public void EnsureCapacity(int factorsCount, int primeTesterCapacity)
|
||||
{
|
||||
Accelerator accelerator = Accelerator;
|
||||
|
||||
|
||||
MemoryBuffer1D<KeyValuePair<ulong, int>, Stride1D.Dense> pow2ModEntriesToTestOnDevice = Pow2ModEntriesToTestOnDevice;
|
||||
if (pow2ModEntriesToTestOnDevice.Length < factorsCount)
|
||||
{
|
||||
@@ -225,8 +225,13 @@ public sealed class PrimeOrderCalculatorAccelerator
|
||||
.CreateViews();
|
||||
|
||||
var smallPrimeFactorTables = SmallPrimeFactorGpuTables.GetStaticTables(acceleratorIndex);
|
||||
SmallPrimeFactorPrimes = smallPrimeFactorTables.Primes.View;
|
||||
SmallPrimeFactorSquares = smallPrimeFactorTables.Squares.View;
|
||||
|
||||
if (smallPrimeFactorTables.HasValue)
|
||||
{
|
||||
SmallPrimeFactorGpuTables tables = smallPrimeFactorTables.Value;
|
||||
SmallPrimeFactorPrimes = tables.Primes.View;
|
||||
SmallPrimeFactorSquares = tables.Squares.View;
|
||||
}
|
||||
|
||||
CheckFactorsKernel = KernelUtil.GetKernel(accelerator.LoadStreamKernel<int, ulong, ArrayView1D<KeyValuePair<ulong, int>, Stride1D.Dense>, MontgomeryDivisorData, ArrayView1D<ulong, Stride1D.Dense>>(PrimeOrderGpuHeuristics.CheckFactorsKernel));
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ public readonly struct SmallPrimeFactorGpuTables
|
||||
|
||||
{
|
||||
private static readonly Accelerator[] _accelerators = AcceleratorPool.Shared.Accelerators;
|
||||
private static readonly SmallPrimeFactorGpuTables[] _sharedTables = new SmallPrimeFactorGpuTables[PerfectNumberConstants.RollingAccelerators];
|
||||
private static readonly SmallPrimeFactorGpuTables?[] _sharedTables = new SmallPrimeFactorGpuTables?[PerfectNumberConstants.RollingAccelerators];
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static SmallPrimeFactorGpuTables GetStaticTables(int acceleratorIndex) => _sharedTables[acceleratorIndex];
|
||||
internal static SmallPrimeFactorGpuTables? GetStaticTables(int acceleratorIndex) => _sharedTables[acceleratorIndex];
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void WarmUp(int acceleratorIndex, AcceleratorStream stream) => _sharedTables[acceleratorIndex] = new SmallPrimeFactorGpuTables(_accelerators[acceleratorIndex], stream);
|
||||
|
||||
Reference in new issue
Block a user