Various improvements to make sure scratch buffers don't override each others memory
This commit is contained in:
1 parent
dcda4b5cba
commit
fc22c01ec8
16 files changed
+489
-565
No files matched your search
@@ -14,11 +14,12 @@ public static class GpuContextPool
|
||||
public readonly Context Context;
|
||||
public readonly Accelerator Accelerator;
|
||||
|
||||
public PooledContext()
|
||||
public PooledContext(KernelContainer kernels)
|
||||
{
|
||||
Context = SharedGpuContext.Context;
|
||||
Accelerator = SharedGpuContext.Accelerator;
|
||||
GpuStaticTableInitializer.EnsureStaticTables(Accelerator);
|
||||
GpuStaticTableInitializer.EnsureStaticTables(kernels, Accelerator);
|
||||
kernels.Dispose();
|
||||
// NOTE: Avoid loading/compiling any kernel here to prevent implicit
|
||||
// CL stream/queue creation during accelerator construction.
|
||||
// Some OpenCL drivers are fragile when a queue is created immediately
|
||||
@@ -52,7 +53,7 @@ public static class GpuContextPool
|
||||
}
|
||||
|
||||
// Create a new accelerator when the pool does not have one available.
|
||||
return new GpuContextLease(new PooledContext());
|
||||
return new GpuContextLease(new PooledContext(GpuKernelPool.GetKernels()));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +71,8 @@ public static class GpuContextPool
|
||||
PooledContext context;
|
||||
for (int i = 0; i < toCreate; i++)
|
||||
{
|
||||
context = new PooledContext();
|
||||
KernelContainer kernels = GpuKernelPool.GetKernels();
|
||||
context = new PooledContext(kernels);
|
||||
contexts[i] = context;
|
||||
pool.Enqueue(context);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user