Table of Contents

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

properties QueueProperties

Queue properties specifying execution mode and profiling.

cancellationToken CancellationToken

Cancellation 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

ValueTask

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

handle QueueHandle

The queue handle to release.

Returns

ValueTask

SynchronizeQueueAsync(OpenCLCommandQueue, CancellationToken)

Synchronizes a specific queue, waiting for all enqueued operations to complete.

public ValueTask SynchronizeQueueAsync(OpenCLCommandQueue queue, CancellationToken cancellationToken = default)

Parameters

queue OpenCLCommandQueue

The queue to synchronize.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask