Streams added to all kernels and GPU operations to separate threads from each other.
This commit is contained in:
1 parent
64d615c402
commit
de2a78b27b
30 files changed
+1097
-1002
No files matched your search
@@ -7,11 +7,12 @@ namespace PerfectNumbers.Core.Gpu;
|
||||
|
||||
public static class SharedGpuContext
|
||||
{
|
||||
// TODO: Remove Lazy<T> in favor for better performance with nullable fields.
|
||||
private static readonly Lazy<Context> s_context = new(() => ILGPU.Context.CreateDefault(), LazyThreadSafetyMode.ExecutionAndPublication);
|
||||
private static readonly Lazy<Device> s_device = new(() => s_context.Value.GetPreferredDevice(false), LazyThreadSafetyMode.ExecutionAndPublication);
|
||||
private static readonly Lazy<Accelerator> s_accelerator = new(() => s_device.Value.CreateAccelerator(s_context.Value), LazyThreadSafetyMode.ExecutionAndPublication);
|
||||
|
||||
internal static Context Context => s_context.Value;
|
||||
internal static Context Context => s_context.Value;
|
||||
|
||||
internal static Device Device => s_device.Value;
|
||||
|
||||
|
||||
Reference in new issue
Block a user