TODO moved to the code to concentrate on mirroring heuristic cycle algorithm on GPU

This commit is contained in:
Marek Lemańczyk committed 2025-10-05 02:17:08 +02:00
1 parent 3cddbe22a0
commit b6b372bc59
2 files changed
+2 -5

No files matched your search

+2 -4
View File
@@ -67,6 +67,7 @@ public static class UInt128Extensions
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static UInt128 Pow2MontgomeryModWindowed(this UInt128 exponent, UInt128 modulus)
{
// TODO: Prototype a UInt128-native Pow2MontgomeryModWindowed path that matches the GPU implementation once a faster modular multiplication helper is available, so we can revisit removing the GPU struct dependency without regressing benchmarks.
if (modulus == UInt128.One)
{
return UInt128.Zero;
@@ -139,10 +140,7 @@ public static class UInt128Extensions
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool ShouldUseSingleBit(UInt128 exponent)
{
return (exponent >> 64) == UInt128.Zero && (ulong)exponent <= Pow2WindowFallbackThreshold;
}
private static bool ShouldUseSingleBit(UInt128 exponent) => (exponent >> 64) == UInt128.Zero && (ulong)exponent <= Pow2WindowFallbackThreshold;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int GetWindowSize(int bitLength)
-1
View File
@@ -1,3 +1,2 @@
- Prototype a UInt128-native Pow2MontgomeryModWindowed path that matches the GPU implementation once a faster modular multiplication helper is available, so we can revisit removing the GPU struct dependency without regressing benchmarks.
- Mirror the complete CPU heuristic cycle algorithm on the GPU path so both implementations stay aligned.
- Extend the GPU numeric type probe to cover proposed custom types such as GpuUInt256 and GpuUInt512 once their definitions are available so we can plan the wide-order heuristics on the device.