Remove CPU fallback from GPU context pool

This commit is contained in:
Marek Lemańczyk committed 2025-10-11 18:31:46 +02:00
1 parent 3e2d2b05b1
commit d476748216
2 files changed
+11 -5

No files matched your search

+7 -4
View File
@@ -145,8 +145,7 @@ public static class GpuContextPool
public object ExecutionLock => _ctx.ExecutionLock; public object ExecutionLock => _ctx.ExecutionLock;
internal void ReturnToPool()
public void Dispose()
{ {
if (disposed) if (disposed)
{ {
@@ -156,6 +155,10 @@ public static class GpuContextPool
Return(_ctx); Return(_ctx);
disposed = true; disposed = true;
} }
}
}
public void Dispose()
{
ReturnToPool();
}
}
}
+4 -1
View File
@@ -396,7 +396,10 @@ public ref struct GpuKernelLease(IDisposable limiter, GpuContextLease gpu, Kerne
_stream?.Dispose(); _stream?.Dispose();
_stream = null; _stream = null;
_gpu?.Dispose(); if (_gpu.HasValue)
{
_gpu.Value.ReturnToPool();
}
_gpu = null; _gpu = null;
_executionLock = null; _executionLock = null;