Class MetalErrorHandler
- Namespace
- DotCompute.Backends.Metal.Execution
- Assembly
- DotCompute.Backends.Metal.dll
Production-grade Metal error handler with retry logic, graceful degradation, and comprehensive error recovery strategies following CUDA error handling patterns.
public sealed class MetalErrorHandler : IDisposable
- Inheritance
-
MetalErrorHandler
- Implements
- Inherited Members
- Extension Methods
Constructors
MetalErrorHandler(ILogger<MetalErrorHandler>, MetalErrorRecoveryOptions?)
public MetalErrorHandler(ILogger<MetalErrorHandler> logger, MetalErrorRecoveryOptions? options = null)
Parameters
loggerILogger<MetalErrorHandler>optionsMetalErrorRecoveryOptions
Properties
IsAppleSilicon
Gets whether running on Apple Silicon
public bool IsAppleSilicon { get; }
Property Value
IsGpuAvailable
Gets whether GPU is currently available
public bool IsGpuAvailable { get; }
Property Value
TimeSinceLastSuccess
Gets time since last successful operation
public TimeSpan TimeSinceLastSuccess { get; }
Property Value
Methods
ClearStatistics()
Clears error statistics
public void ClearStatistics()
Dispose()
Disposes the error handler resources
public void Dispose()
ExecuteWithRetryAsync<T>(Func<Task<T>>, string, CancellationToken)
Executes a Metal operation with comprehensive error handling
public Task<T> ExecuteWithRetryAsync<T>(Func<Task<T>> operation, string operationName, CancellationToken cancellationToken = default)
Parameters
operationFunc<Task<T>>operationNamestringcancellationTokenCancellationToken
Returns
- Task<T>
Type Parameters
T
GetErrorStatistics()
Gets error statistics
public IReadOnlyDictionary<MetalError, MetalErrorStatistics> GetErrorStatistics()