GpuPrimeWorkLimiter.Acquire() / .Release() removed to save time on the hot-path with billions of calls. We'll rely on AcceleratorStreamPool limits and synchronization.
This commit is contained in:
1 parent
1552e10ff0
commit
0d2a88c45f
17 files changed
+108
-124
No files matched your search
@@ -147,7 +147,7 @@ public sealed class MersenneNumberTester(
|
||||
|
||||
UInt128[] qs = qsBuffer;
|
||||
|
||||
GpuPrimeWorkLimiter.Acquire();
|
||||
// GpuPrimeWorkLimiter.Acquire();
|
||||
var accelerator = AcceleratorPool.Shared.Rent();
|
||||
var stream = accelerator.CreateStream();
|
||||
var orderKernel = GpuKernelPool.GetOrAddKernels(accelerator, stream, KernelType.OrderKernelScan).Order!;
|
||||
@@ -164,11 +164,8 @@ public sealed class MersenneNumberTester(
|
||||
while (offset < idx)
|
||||
{
|
||||
int count = Math.Min(batchSize, idx - offset);
|
||||
// lock (accelerator)
|
||||
{
|
||||
qBuffer = accelerator.Allocate1D<GpuUInt128>(count);
|
||||
orderBuffer = accelerator.Allocate1D<ulong>(count);
|
||||
}
|
||||
qBuffer = accelerator.Allocate1D<GpuUInt128>(count);
|
||||
orderBuffer = accelerator.Allocate1D<ulong>(count);
|
||||
|
||||
// Convert to device-friendly GpuUInt128 on the fly
|
||||
var tmp = gpuUInt128Pool.Rent(count);
|
||||
@@ -204,7 +201,7 @@ public sealed class MersenneNumberTester(
|
||||
}
|
||||
|
||||
stream.Dispose();
|
||||
GpuPrimeWorkLimiter.Release();
|
||||
// GpuPrimeWorkLimiter.Release();
|
||||
uInt128Pool.Return(qs);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user