Commit Graph
91 Commits
Author SHA1 Message Date
mlemanczyk c3254e3fda Temporary restored delegating all work to CPU in CPU mode in preparation for a branch-less split. 2025-11-30 15:40:03 +01:00
mlemanczyk 6a1198c417 CPU vs GPU work delegation adjusted to better utilize CPU. 2025-11-29 12:09:33 +01:00
mlemanczyk c311b27dcc Prime testing using divisor tables depending on the last digit separated to its own class. PrimeTester switched back to standard endings. 2025-11-27 16:45:02 +01:00
mlemanczyk a296e62d4d --min-k command-line argument added. Partial factoring switched back to CPU. 2025-11-26 22:03:52 +01:00
mlemanczyk 13498dc460 Most device buffers integrated into PrimeOrderCalculatorAccelerator. PrimeOrderCalculator switched to partial factoring on GPU. 2025-11-26 03:16:39 +01:00
mlemanczyk b9ca95bf8c PrimeOrderCalculatorAccelerator.Rent is now created outside of the loops and re-used for all calculations. 2025-11-24 22:51:53 +01:00
mlemanczyk 070e2a14fd MontgomeryDivisorData converted to a pooled class to limit GC pressure. MontgomeryDivisorDataGpu added for GPU operations. PrimeOrderCalculator kernels precompiled during warmup. 2025-11-24 15:14:31 +01:00
mlemanczyk 6d1ff1372e Factoring switched to PrimeTester.IsPrime for the best performance. PrimeOrderCalculator.PartialFactor switched to GPU factorization. Every so often it will send work to GPU instead of CPU. BatchedResources renamed to MersenneNumberDivisorByDivisorAccelerator for consistency and moved to its own file. It now uses array instead of dictionary for lookup free performance. 2025-11-23 00:07:03 +01:00
mlemanczyk 54fdff0a4e GPU calculations frequency adjusted 2025-11-19 21:38:07 +01:00
mlemanczyk 5cac51479e GPU memory allocations protected with lock to prevent shared memory access issues. GPU usage limited for the best performance. 2025-11-19 16:49:01 +01:00
mlemanczyk 02d16bf05c Tiny cleanup 2025-11-18 06:02:43 +01:00
mlemanczyk 801b1be3e3 Cleanup 2025-11-18 04:22:39 +01:00
mlemanczyk 342eff2726 GpuKernelPool.GetOrAddKernels removed in --mersenne=bydivisor mode. PartialFactorResult.WithAdditionalPrime will now modify the current instance instead of creating new copy for better performance. SmallPrimeFactorViews renamed to SmallPrimeFactorGpuTables for consistency with other static tables. 2025-11-17 23:33:59 +01:00
mlemanczyk f630bfb598 HeuristicCombinedPrimeTesterAccelerator integrated with PrimeOrderCalculatorAccelerator. 2025-11-17 17:38:23 +01:00
mlemanczyk 183b147135 Heuristic tables split into 2 groups 2025-11-17 16:04:27 +01:00
mlemanczyk 0540411cad Accelerator index added for dictionary-less use-cases 2025-11-15 02:21:45 +01:00
mlemanczyk 42447c4e43 BinaryGcd switched to the best performing variant according to benchmarks. 2025-11-14 11:43:16 +01:00
mlemanczyk 0d2a88c45f GpuPrimeWorkLimiter.Acquire() / .Release() removed to save time on the hot-path with billions of calls. We'll rely on AcceleratorStreamPool limits and synchronization. 2025-11-13 17:52:13 +01:00
mlemanczyk c53aa517f7 GpuScratchBuffer / -Pool naively integrated with PriemOrderCalculatorAccelerator (formerly Pow2MontgomeryAccelerator). FactorEntry replaced with 2 arrays - unused field removed. Small cleanup. 2025-11-13 14:41:27 +01:00
mlemanczyk 43863d03fb Performance improvements 2025-11-13 00:51:32 +01:00
mlemanczyk 5bc65464d0 Initial PollardRho implementation for GPU. Added pool for accelerator streams shared across the threads. GPU processing performance and stabilization improvements. GpuUInt128.BinaryGcd switched to the version which outperformed other in benchmarks. 2025-11-12 21:18:30 +01:00
mlemanczyk fdc2da7dae Accelerator leak fixed. 2025-11-11 16:40:44 +01:00
mlemanczyk cf5f78c2ef PrimeTesterByLastDigitAccelerator integrated into Pow2MontgomeryGpuCalculator for better performance. 2025-11-11 13:36:21 +01:00
mlemanczyk fa89958736 Stabilization improvements. Stream will be released when releasing GPU lease to prevent application crashes. 2025-11-10 14:30:30 +01:00
mlemanczyk d0b1639a5d GPU stabilization improvements to prevent calculation crashes 2025-11-09 21:52:16 +01:00
Marek Lemańczyk 4c4d4243fb Merge remote-tracking branch 'github/codex/optimize-evenperfectbitscanner-for-static-arrays-khd9w8' into work
# Conflicts:
#	PerfectNumbers.Core/Gpu/GpuContextPool.cs
#	PerfectNumbers.Core/Gpu/GpuKernelLease.cs
#	PerfectNumbers.Core/Gpu/GpuKernelPool.cs
#	PerfectNumbers.Core/Gpu/GpuStaticTableInitializer.cs
#	PerfectNumbers.Core/Gpu/Kernels/PrimeOrderSpecialMaxKernels.cs
#	PerfectNumbers.Core/PrimeOrderCalculator.Cpu.cs
#	PerfectNumbers.Core/PrimeOrderCalculator.Gpu.cs
#	PerfectNumbers.Core/PrimeTester.cs
2025-11-03 23:59:12 +01:00
Marek Lemańczyk 76dfe108a9 Address feedback on GPU pooling and heuristic factoring 2025-11-02 11:22:49 +01:00
Marek Lemańczyk 5339c3c304 Use span growth instead of dictionaries in partial factor 2025-11-02 11:22:38 +01:00
mlemanczyk 2281d9535e Revert "Merge pull request #251 from mlemanczyk/codex/refactor-prime-checking-on-gpu-n5t2pm"
This reverts commit 936ce239db, reversing
changes made to e14b77e504.
2025-11-02 11:22:14 +01:00
Marek Lemańczyk 8c662c5c85 Address feedback on GPU pooling and heuristic factoring 2025-10-31 21:47:42 +01:00
Marek Lemańczyk 567b92792c Use span growth instead of dictionaries in partial factor 2025-10-31 18:52:00 +01:00
mlemanczyk fc5700f82c IsPrime with cancellation token removed. 2025-10-29 22:31:28 +01:00
mlemanczyk 0850227881 Switched to heuristic GPU for a better performance than the standard one. 2025-10-28 22:15:33 +01:00
mlemanczyk ab045a62c4 Revert "Temporarily enabling heuristic GPU order checks."
This reverts commit 4db06cfe80.
2025-10-28 21:04:09 +01:00
mlemanczyk 4db06cfe80 Temporarily enabling heuristic GPU order checks. 2025-10-28 20:49:41 +01:00
Marek Lemańczyk bd0727131f Merge pull request #238 from mlemanczyk/codex/optimize-evenperfectbitscanner-loops-kit1so
Hoist prime order thresholds in CPU heuristics
2025-10-27 21:31:23 +01:00
Marek Lemańczyk 94a4ed8328 Hoist prime order thresholds in CPU heuristics 2025-10-27 21:24:43 +01:00
mlemanczyk d381abe0cc We'll now clear the dictionary after renting, to avoid unnecessary clearing if it's not going to be used anymore. 2025-10-27 16:54:49 +01:00
mlemanczyk 50d66a5186 Switched to GPU version in some places. 2025-10-27 15:30:10 +01:00
mlemanczyk f2ce40ade9 Additional logging added. 2025-10-26 20:00:32 +01:00
Marek Lemańczyk 3758524450 Extract divisor validator and rename legacy CPU prime helper 2025-10-26 18:59:07 +01:00
Marek Lemańczyk 1e5eadac34 Refine heuristic prime tester integration 2025-10-26 18:15:27 +01:00
Marek Lemańczyk 43c7bafd5d Restore CPU PrimeTester usage and rename fallback helpers 2025-10-26 15:19:49 +01:00
mlemanczyk 1ed5afe689 Switched to .IsPrime which performed best in benchmarks. 2025-10-26 04:05:00 +01:00
Marek Lemańczyk 15c229665d Add heuristic prime sieves for cached divisor sequences 2025-10-26 03:21:29 +01:00
Marek Lemańczyk fab9ba0413 Restore reviewed divisor heuristics 2025-10-24 19:50:32 +02:00
Marek Lemańczyk bbe0c02069 Use bit masks for divisor heuristics 2025-10-24 19:50:27 +02:00
Marek Lemańczyk 1e5a9128cb Split CPU and GPU exponent steppers 2025-10-24 08:49:53 +02:00
Marek Lemańczyk 7feeb08943 Clarify Pollard-Rho parity guard and seed CPU batches 2025-10-23 19:50:39 +02:00
mlemanczyk 865a88fac0 Switched to GPU for prime testing 2025-10-22 00:40:30 +02:00