Rename GPU mul-mod helper

This commit is contained in:
Marek Lemańczyk committed 2025-10-25 02:20:15 +02:00
1 parent 4b13bc6497
commit 04d4d18f37
6 files changed
+24 -65

No files matched your search

@@ -13,8 +13,8 @@ namespace EvenPerfectBitScanner.Benchmarks;
/// <summary>
/// GPU benchmarks for 64-bit modular multiplication helpers.
/// Windows 11 results ranged from 0.62 ms to 1.63 ms, and GpuCompatibleMulModSimplifiedExtension led the PrimeSizedModulus case at 0.641 ms.
/// Recommended helper for p ≥ 138,000,000 is GpuCompatibleMulModSimplifiedExtension.
/// Windows 11 results ranged from 0.62 ms to 1.63 ms, and MulModGpu led the PrimeSizedModulus case at 0.641 ms.
/// Recommended helper for p ≥ 138,000,000 is MulModGpu.
/// </summary>
[SimpleJob(RuntimeMoniker.Net80)]
[MemoryDiagnoser]
@@ -106,7 +106,7 @@ public class MulMod64BenchmarksGpu : IDisposable
/// Recommended for production GPU scans, especially for large p ≥ 138,000,000.
/// </summary>
[Benchmark]
public void GpuCompatibleMulModSimplifiedExtension()
public void MulModGpu()
{
LaunchKernel(_gpuCompatibleSimplifiedKernel);
}
@@ -249,7 +249,7 @@ public class MulMod64BenchmarksGpu : IDisposable
MulMod64GpuKernelInput input = inputs[index];
GpuUInt128 state = new(input.Left);
results[index] = state.MulModSimplified(input.Right, input.Modulus);
results[index] = state.MulMod(input.Right, input.Modulus);
}
private static void InlineKernel(Index1D index, ArrayView<MulMod64GpuKernelInput> inputs, ArrayView<ulong> results)
@@ -58,7 +58,7 @@ public class MulMod64Benchmarks
}
/// <summary>
/// Calls the UInt128-based <see cref="ULongExtensions.MulModSimplified(ulong, ulong, ulong)"/> helper; performance mirrors
/// Calls the UInt128-based <see cref="ULongExtensions.MulMod(ulong, ulong, ulong)"/> helper; performance mirrors
/// the full helper with 5.24–5.95 ns on sparse inputs and 1.99 ns when zeros dominate, but 22.8–59.2 ns on dense blends.
/// </summary>
/// <remarks>
@@ -66,10 +66,10 @@ public class MulMod64Benchmarks
/// PrimeSizedModulus 50.490 ns, SparseOperands 5.239 ns, ZeroOperands 1.986 ns.
/// </remarks>
[Benchmark]
public ulong GpuCompatibleMulModSimplifiedExtension()
public ulong MulModGpu()
{
GpuUInt128 gpuUInt128 = new(Input.Left);
return gpuUInt128.MulModSimplified(Input.Right, Input.Modulus);
return gpuUInt128.MulMod(Input.Right, Input.Modulus);
}
/// <summary>