Add GPU simplified mul-mod helper for host callers
This commit is contained in:
1 parent
3e081141e0
commit
03194650c9
2 files changed
+11
-2
No files matched your search
@@ -19,7 +19,7 @@ public static partial class ULongExtensions
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[Obsolete("Deprecated: use ULongExtensions.MulMod64 for CPU code and GpuUInt128.MulMod inside GPU kernels.")]
|
||||
[Obsolete("Use ULongExtensions.GpuCompatibleMulModSimplifiedExtension for GPU-compatible host code or GpuUInt128.MulMod inside kernels.")]
|
||||
public static ulong MulMod64Gpu(this ulong a, ulong b, ulong modulus)
|
||||
{
|
||||
// TODO: Remove this GPU-compatible shim from production once callers migrate to MulMod64,
|
||||
@@ -29,6 +29,7 @@ public static partial class ULongExtensions
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[Obsolete("Use ULongExtensions.GpuCompatibleMulModSimplifiedExtension for GPU-compatible host code or GpuUInt128.MulMod inside kernels.")]
|
||||
public static ulong MulMod64GpuDeferred(this ulong a, ulong b, ulong modulus)
|
||||
{
|
||||
// TODO: Move this deferred helper to the benchmark suite; the baseline MulMod64 avoids the
|
||||
@@ -37,6 +38,13 @@ public static partial class ULongExtensions
|
||||
return state.MulModWithNativeModulo(b, modulus);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong GpuCompatibleMulModSimplifiedExtension(this ulong left, ulong right, ulong modulus)
|
||||
{
|
||||
GpuUInt128 state = new(left);
|
||||
return state.MulModSimplified(right, modulus);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static ulong Pow2ModWindowedGpu(this ulong exponent, ulong modulus)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user