Add GPU kernel for divisor candidate generation
This commit is contained in:
1 parent
ab4388dfba
commit
bfc5712d81
2 files changed
+120
-24
No files matched your search
@@ -17,6 +17,26 @@ internal static class DivisorByDivisorKernels
|
||||
hits[index] = montgomeryResult == 1UL ? (byte)1 : (byte)0;
|
||||
}
|
||||
|
||||
public static void GenerateCandidatesAndGapsKernel(Index1D index, ArrayView<ulong> candidates, ArrayView<ulong> gaps, ulong startValue, ulong stride)
|
||||
{
|
||||
int globalIndex = index;
|
||||
int candidateLength = (int)candidates.Length;
|
||||
if (globalIndex >= candidateLength)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ulong offset = (ulong)globalIndex;
|
||||
ulong candidate = startValue + offset * stride;
|
||||
candidates[globalIndex] = candidate;
|
||||
|
||||
int gapLength = (int)gaps.Length;
|
||||
if (globalIndex < gapLength)
|
||||
{
|
||||
gaps[globalIndex] = offset == 0UL ? 0UL : stride;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ComputeRemainderDeltasKernel(Index1D index, ArrayView<ulong> gaps, ArrayView<byte> deltas, byte modulus)
|
||||
{
|
||||
deltas[index] = (byte)(gaps[index] % modulus);
|
||||
|
||||
Reference in new issue
Block a user