Inline legacy GPU sieve and update heuristic fallbacks
This commit is contained in:
1 parent
a7fc34e37a
commit
55554d9565
5 files changed
+10
-14
No files matched your search
@@ -102,7 +102,7 @@ public sealed class HeuristicPrimeTester
|
||||
{
|
||||
if (!EnableHeuristicPrimeTesting)
|
||||
{
|
||||
return PrimeTester.IsPrimeGpuFallback(n, ct);
|
||||
return PrimeTester.Exclusive.IsPrimeGpu(n, ct);
|
||||
}
|
||||
|
||||
return IsPrimeGpu(n);
|
||||
@@ -119,7 +119,7 @@ public sealed class HeuristicPrimeTester
|
||||
{
|
||||
if (!EnableHeuristicPrimeTesting)
|
||||
{
|
||||
return PrimeTester.IsPrimeGpuFallback(n, CancellationToken.None);
|
||||
return PrimeTester.Exclusive.IsPrimeGpu(n, CancellationToken.None);
|
||||
}
|
||||
|
||||
return HeuristicIsPrimeGpuCore(n, sqrtLimit, nMod10);
|
||||
|
||||
@@ -72,18 +72,14 @@ public sealed class PrimeTester
|
||||
return Exclusive.IsPrimeGpu(n, CancellationToken.None);
|
||||
}
|
||||
|
||||
public static bool IsPrimeGpu(ulong n, ulong limit, byte nMod10)
|
||||
{
|
||||
return Exclusive.IsPrimeGpu(n, CancellationToken.None);
|
||||
}
|
||||
// Legacy overload retained for heuristic toggles; tests and benchmarks now call the thread-local instance directly.
|
||||
// public static bool IsPrimeGpu(ulong n, ulong limit, byte nMod10)
|
||||
// {
|
||||
// return Exclusive.IsPrimeGpu(n, CancellationToken.None);
|
||||
// }
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IsPrimeGpu(ulong n, CancellationToken ct)
|
||||
{
|
||||
return IsPrimeGpuFallback(n, ct);
|
||||
}
|
||||
|
||||
public static bool IsPrimeGpuFallback(ulong n, CancellationToken ct)
|
||||
{
|
||||
bool forceCpu = GpuContextPool.ForceCpu;
|
||||
Span<ulong> one = stackalloc ulong[1];
|
||||
|
||||
Reference in new issue
Block a user