Table of Contents

Class MetalEventPool

Namespace
DotCompute.Backends.Metal.Execution
Assembly
DotCompute.Backends.Metal.dll

Efficient pool for managing Metal events to reduce allocation overhead and improve performance. Follows CUDA event pool patterns with Metal-specific optimizations.

public sealed class MetalEventPool : IDisposable
Inheritance
MetalEventPool
Implements
Inherited Members
Extension Methods

Constructors

MetalEventPool(nint, ILogger<MetalEventManager>)

public MetalEventPool(nint device, ILogger<MetalEventManager> logger)

Parameters

device nint
logger ILogger<MetalEventManager>

Properties

Statistics

Gets statistics about the event pools

public MetalEventPoolStatistics Statistics { get; }

Property Value

MetalEventPoolStatistics

Methods

AcquireSyncEventAsync(CancellationToken)

Acquires a synchronization event from the pool or creates a new one

public Task<nint> AcquireSyncEventAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<nint>

AcquireTimingEventAsync(CancellationToken)

Acquires a timing event from the pool or creates a new one

public Task<nint> AcquireTimingEventAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<nint>

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetStatistics()

Gets statistics about the event pool (API compatibility method).

public MetalEventPoolStatistics GetStatistics()

Returns

MetalEventPoolStatistics

PerformMaintenance()

Performs maintenance on the event pools

public void PerformMaintenance()

Return(nint, MetalEventType)

Returns an event to the appropriate pool for reuse

public void Return(nint eventHandle, MetalEventType eventType)

Parameters

eventHandle nint
eventType MetalEventType