Class OpenCLStreamManager
- Namespace
- DotCompute.Backends.OpenCL.Execution
- Assembly
- DotCompute.Backends.OpenCL.dll
Manages OpenCL command queues with pooling and recycling for optimal performance. Provides in-order and out-of-order queue management with priority scheduling. Follows proven patterns from CUDA's stream management for production-grade queue orchestration.
public sealed class OpenCLStreamManager : IAsyncDisposable
- Inheritance
-
OpenCLStreamManager
- Implements
- Inherited Members
Methods
AcquireQueueAsync(QueueProperties, CancellationToken)
Acquires a command queue from the pool or creates a new one. This is the primary method for obtaining queues with pooling optimization.
public ValueTask<QueueHandle> AcquireQueueAsync(QueueProperties properties, CancellationToken cancellationToken = default)
Parameters
propertiesQueuePropertiesQueue properties specifying execution mode and profiling.
cancellationTokenCancellationTokenCancellation token for async operations.
Returns
- ValueTask<QueueHandle>
A handle to the acquired command queue with RAII cleanup semantics.
DisposeAsync()
Asynchronously disposes the stream manager and all managed queues.
public ValueTask DisposeAsync()
Returns
GetStatistics()
Gets comprehensive statistics about queue usage and pool performance.
public QueueStatistics GetStatistics()
Returns
- QueueStatistics
Statistics snapshot for monitoring and optimization.
ReleaseQueueAsync(QueueHandle)
Releases a queue back to the pool for reuse. Called automatically when QueueHandle is disposed.
public ValueTask ReleaseQueueAsync(QueueHandle handle)
Parameters
handleQueueHandleThe queue handle to release.
Returns
SynchronizeQueueAsync(OpenCLCommandQueue, CancellationToken)
Synchronizes a specific queue, waiting for all enqueued operations to complete.
public ValueTask SynchronizeQueueAsync(OpenCLCommandQueue queue, CancellationToken cancellationToken = default)
Parameters
queueOpenCLCommandQueueThe queue to synchronize.
cancellationTokenCancellationTokenCancellation token.