using ILGPU; using ILGPU.Runtime; namespace PerfectNumbers.Core.Gpu; public sealed class KernelContainer { // Serializes first-time initialization of kernels/buffers per accelerator. public Action, ArrayView>? Order; public Action, ArrayView1D>? Incremental; public Action, ArrayView1D, ArrayView1D, ArrayView1D, ArrayView1D, ArrayView1D>? Pow2Mod; public Action, ArrayView1D>? IncrementalOrder; public Action, ArrayView1D>? Pow2ModOrder; public Kernel? SmallPrimeFactor; public Action, int, MontgomeryDivisorData, ArrayView1D, ArrayView1D>? SpecialMax; // Optional device buffer with small divisor cycles (<= 4M). Index = divisor, value = cycle length. public MemoryBuffer1D? SmallCycles; public MemoryBuffer1D? SmallPrimesLastOne; public MemoryBuffer1D? SmallPrimesLastSeven; public MemoryBuffer1D? SmallPrimesPow2LastOne; public MemoryBuffer1D? SmallPrimesPow2LastSeven; public MemoryBuffer1D? SmallPrimeFactorsPrimes; public MemoryBuffer1D? SmallPrimeFactorsSquares; public void Dispose() { // Order = null; // Incremental = null; // Pow2Mod = null; // IncrementalOrder = null; // Pow2ModOrder = null; // SmallPrimeFactor = null; // SpecialMax = null; // SmallCycles?.Dispose(); // SmallPrimesLastOne?.Dispose(); // SmallPrimesLastSeven?.Dispose(); // SmallPrimesPow2LastOne?.Dispose(); // SmallPrimesPow2LastSeven?.Dispose(); // SmallPrimeFactorsPrimes?.Dispose(); // SmallPrimeFactorsSquares?.Dispose(); } }