Interface ICommandQueue
- Namespace
- Orleans.GpuBridge.Abstractions.Providers
- Assembly
- Orleans.GpuBridge.Abstractions.dll
Represents a command queue (also known as a stream) for submitting work to a compute device. Command queues provide asynchronous execution of kernels and memory operations, allowing for efficient overlapping of computation and data transfer operations.
public interface ICommandQueue : IDisposable
- Inherited Members
Properties
Context
Gets the associated compute context that owns this command queue. All operations submitted to this queue will execute within the scope of this context.
IComputeContext Context { get; }
Property Value
QueueId
Gets the unique identifier for this command queue. This ID can be used for debugging, profiling, and queue management operations.
string QueueId { get; }
Property Value
Methods
EnqueueBarrier()
Inserts a synchronization barrier in the command queue. This ensures that all operations enqueued before this barrier complete before any operations enqueued after the barrier begin execution. This is useful for enforcing ordering constraints between operations.
void EnqueueBarrier()
EnqueueCopyAsync(nint, nint, long, CancellationToken)
Enqueues a memory copy operation for asynchronous execution. This allows for efficient data transfer between host and device memory, or between different memory locations on the device.
Task EnqueueCopyAsync(nint source, nint destination, long sizeBytes, CancellationToken cancellationToken = default)
Parameters
sourcenintPointer to the source memory location.
destinationnintPointer to the destination memory location.
sizeByteslongNumber of bytes to copy.
cancellationTokenCancellationTokenToken to cancel the memory copy operation.
Returns
- Task
A task that completes when the memory copy has been successfully enqueued.
EnqueueKernelAsync(CompiledKernel, KernelLaunchParameters, CancellationToken)
Enqueues a compiled kernel for asynchronous execution on the device. The kernel will be executed with the specified launch parameters, and execution may begin immediately or be scheduled based on device availability.
Task EnqueueKernelAsync(CompiledKernel kernel, KernelLaunchParameters parameters, CancellationToken cancellationToken = default)
Parameters
kernelCompiledKernelThe compiled kernel to execute.
parametersKernelLaunchParametersLaunch parameters including work sizes, memory configuration, and kernel arguments.
cancellationTokenCancellationTokenToken to cancel the kernel enqueue operation.
Returns
- Task
A task that completes when the kernel has been successfully enqueued (not necessarily executed).
FlushAsync(CancellationToken)
Waits for all previously enqueued operations in this queue to complete. This method blocks until all kernels, memory operations, and other commands that were submitted to this queue have finished execution.
Task FlushAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to cancel the flush operation.
Returns
- Task
A task that completes when all enqueued operations have finished.