Implement GPU pow2 heuristics with safe fallbacks

This commit is contained in:
Marek Lemańczyk committed 2025-10-04 22:40:12 +02:00
1 parent ea08d3f71f
commit 38df505f4f
5 files changed
+123 -50

No files matched your search

@@ -691,7 +691,6 @@ internal static partial class PrimeOrderCalculator
private static bool Pow2EqualsOne(ulong exponent, ulong prime, in MontgomeryDivisorData divisorData)
{
// TODO: Implement the GPU heuristic path so TryPow2Mod can verify candidates on the device instead of immediately falling back to the CPU Montgomery reducer.
GpuPow2ModStatus status = PrimeOrderGpuHeuristics.TryPow2Mod(exponent, prime, out ulong remainder);
if (status == GpuPow2ModStatus.Success)
{