Table of Contents

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

logger ILogger<MetalErrorHandler>
options MetalErrorRecoveryOptions

Properties

IsAppleSilicon

Gets whether running on Apple Silicon

public bool IsAppleSilicon { get; }

Property Value

bool

IsGpuAvailable

Gets whether GPU is currently available

public bool IsGpuAvailable { get; }

Property Value

bool

TimeSinceLastSuccess

Gets time since last successful operation

public TimeSpan TimeSinceLastSuccess { get; }

Property Value

TimeSpan

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

operation Func<Task<T>>
operationName string
cancellationToken CancellationToken

Returns

Task<T>

Type Parameters

T

GetErrorStatistics()

Gets error statistics

public IReadOnlyDictionary<MetalError, MetalErrorStatistics> GetErrorStatistics()

Returns

IReadOnlyDictionary<MetalError, MetalErrorStatistics>