Class MetalDynamicParallelism
- Namespace
- DotCompute.Backends.Metal.Execution
- Assembly
- DotCompute.Backends.Metal.dll
Metal dynamic parallelism manager for nested kernel execution. Supports kernels launching other kernels using Metal 3's indirect command buffers. Equivalent to CUDA dynamic parallelism for recursive/hierarchical algorithms.
public sealed class MetalDynamicParallelism : IDisposable
- Inheritance
-
MetalDynamicParallelism
- Implements
- Inherited Members
- Extension Methods
Constructors
MetalDynamicParallelism(nint, nint, ILogger<MetalDynamicParallelism>)
public MetalDynamicParallelism(nint device, nint commandQueue, ILogger<MetalDynamicParallelism> logger)
Parameters
devicenintcommandQueuenintloggerILogger<MetalDynamicParallelism>
Methods
CreateIndirectCommandBufferAsync(nint, int, CancellationToken)
Creates an indirect command buffer for dynamic kernel launches. Metal 3 feature for GPU-driven work submission.
public Task<nint> CreateIndirectCommandBufferAsync(nint device, int maxCommands, CancellationToken cancellationToken = default)
Parameters
devicenintmaxCommandsintcancellationTokenCancellationToken
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
EncodeNestedKernelAsync(nint, nint, int[], int[], CancellationToken)
Encodes a nested kernel launch in the parent command buffer.
public Task EncodeNestedKernelAsync(nint parentBuffer, nint childKernel, int[] gridSize, int[] threadgroupSize, CancellationToken cancellationToken = default)
Parameters
parentBuffernintchildKernelnintgridSizeint[]threadgroupSizeint[]cancellationTokenCancellationToken
Returns
ExecuteWithDynamicParallelismAsync(KernelDefinition, KernelDefinition[], int, CancellationToken)
Executes a parent kernel with dynamic child kernel launches. Supports multi-level nesting for hierarchical algorithms.
public Task ExecuteWithDynamicParallelismAsync(KernelDefinition parent, KernelDefinition[] children, int maxNestingLevel = 3, CancellationToken cancellationToken = default)
Parameters
parentKernelDefinitionchildrenKernelDefinition[]maxNestingLevelintcancellationTokenCancellationToken
Returns
GetMetrics()
Gets dynamic parallelism execution metrics.
public DynamicParallelismMetrics GetMetrics()