Document unreachable guards in GPU by-divisor pipeline
This commit is contained in:
1 parent
65e010ded5
commit
bccb2f43c9
7 files changed
+178
-122
No files matched your search
@@ -71,10 +71,12 @@ internal sealed class MersenneNumberDivisorRemainderGpuStepper : IDisposable
|
||||
throw new ObjectDisposedException(nameof(MersenneNumberDivisorRemainderGpuStepper));
|
||||
}
|
||||
|
||||
if (advanceCount <= 0 || remainders.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// GPU remainder batches always advance by a positive chunk count and operate on fixed-size tables, so
|
||||
// the defensive early-return remains commented out.
|
||||
// if (advanceCount <= 0 || remainders.Length == 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (remainders.Length != _length)
|
||||
{
|
||||
@@ -99,17 +101,20 @@ internal sealed class MersenneNumberDivisorRemainderGpuStepper : IDisposable
|
||||
private static void AdvanceRemaindersKernel(Index1D index, int advanceCount, ArrayView<byte> remainders, ArrayView<byte> steps, ArrayView<byte> results)
|
||||
{
|
||||
int idx = index;
|
||||
if (idx >= remainders.Length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Kernel launches match the remainder table length, so the bounds guard stays commented to avoid redundant branching.
|
||||
// if (idx >= remainders.Length)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
int modulus = GetModulus(idx);
|
||||
if (modulus == 0)
|
||||
{
|
||||
results[idx] = remainders[idx];
|
||||
return;
|
||||
}
|
||||
// The modulus selector only emits positive bases (10, 8, 5, 3, 7, 11) for the configured indices, so the zero-modulus
|
||||
// fallback remains commented out.
|
||||
// if (modulus == 0)
|
||||
// {
|
||||
// results[idx] = remainders[idx];
|
||||
// return;
|
||||
// }
|
||||
|
||||
int remainder = remainders[idx] % modulus;
|
||||
int step = steps[idx] % modulus;
|
||||
|
||||
Reference in new issue
Block a user