Class MetalExecutionManager
- Namespace
- DotCompute.Backends.Metal.Execution
- Assembly
- DotCompute.Backends.Metal.dll
Unified Metal execution manager that orchestrates all execution components, integrating with the existing Metal backend architecture for production-grade usage.
public sealed class MetalExecutionManager : IDisposable
- Inheritance
-
MetalExecutionManager
- Implements
- Inherited Members
- Extension Methods
Constructors
MetalExecutionManager(nint, ILogger<MetalExecutionManager>, IOptions<MetalExecutionManagerOptions>?)
Initializes the Metal execution manager with all required components
public MetalExecutionManager(nint device, ILogger<MetalExecutionManager> logger, IOptions<MetalExecutionManagerOptions>? options = null)
Parameters
devicenintloggerILogger<MetalExecutionManager>optionsIOptions<MetalExecutionManagerOptions>
Properties
CommandStream
Gets the command stream manager
public MetalCommandStream CommandStream { get; }
Property Value
Device
Gets the Metal device handle
public nint Device { get; }
Property Value
EncoderFactory
Gets the command encoder factory
public MetalCommandEncoderFactory EncoderFactory { get; }
Property Value
ErrorHandler
Gets the error handler
public MetalErrorHandler ErrorHandler { get; }
Property Value
EventManager
Gets the event manager
public MetalEventManager EventManager { get; }
Property Value
ExecutionContext
Gets the execution context
public MetalExecutionContext ExecutionContext { get; }
Property Value
IsAppleSilicon
Gets whether the execution manager is running on Apple Silicon
public bool IsAppleSilicon { get; }
Property Value
IsGpuAvailable
Gets whether the GPU is currently available
public bool IsGpuAvailable { get; }
Property Value
Methods
CreateTrackedBuffer(nuint, MetalStorageMode, string?)
Creates and tracks a Metal buffer
public nint CreateTrackedBuffer(nuint length, MetalStorageMode storageMode, string? resourceId = null)
Parameters
lengthnuintstorageModeMetalStorageModeresourceIdstring
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
ExecuteComputeOperationAsync<T>(MetalComputeOperationDescriptor, Func<MetalOperationExecutionInfo, MetalCommandEncoder, Task<T>>, CancellationToken)
Executes a compute operation with comprehensive management and error handling
public Task<T> ExecuteComputeOperationAsync<T>(MetalComputeOperationDescriptor descriptor, Func<MetalOperationExecutionInfo, MetalCommandEncoder, Task<T>> operation, CancellationToken cancellationToken = default)
Parameters
descriptorMetalComputeOperationDescriptoroperationFunc<MetalOperationExecutionInfo, MetalCommandEncoder, Task<T>>cancellationTokenCancellationToken
Returns
- Task<T>
Type Parameters
T
ExecuteMemoryOperationAsync(MetalMemoryOperationDescriptor, CancellationToken)
Executes a memory operation with comprehensive management
public Task ExecuteMemoryOperationAsync(MetalMemoryOperationDescriptor descriptor, CancellationToken cancellationToken = default)
Parameters
descriptorMetalMemoryOperationDescriptorcancellationTokenCancellationToken
Returns
GenerateDiagnosticReport()
Generates a comprehensive diagnostic report
public MetalDiagnosticInfo GenerateDiagnosticReport()
Returns
GetStatistics()
Gets comprehensive statistics from all execution components
public MetalExecutionManagerStats GetStatistics()
Returns
PerformHealthCheckAsync(CancellationToken)
Performs a comprehensive health check
public Task<MetalExecutionManagerHealthCheck> PerformHealthCheckAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
ReleaseTrackedResource(string, bool)
Releases and untracks a Metal resource
public void ReleaseTrackedResource(string resourceId, bool releaseNativeResource = true)