Interface IComputeContext
- Namespace
- Orleans.GpuBridge.Abstractions.Providers
- Assembly
- Orleans.GpuBridge.Abstractions.dll
Represents a compute context for kernel execution on a specific device. A compute context maintains the execution environment, manages resources, and provides isolation between different computation sessions on the same device.
public interface IComputeContext : IDisposable
- Inherited Members
Properties
ContextId
Gets the unique identifier for this context. This ID can be used for debugging, logging, and context management operations.
string ContextId { get; }
Property Value
Device
Gets the associated compute device for this context. This is the device on which all operations within this context will be executed.
IComputeDevice Device { get; }
Property Value
Methods
CreateCommandQueue(CommandQueueOptions)
Creates a command queue (also known as a stream) for this context. Command queues allow asynchronous submission of work to the device and can be used to overlap computation with memory transfers or to execute multiple kernels concurrently.
ICommandQueue CreateCommandQueue(CommandQueueOptions options)
Parameters
optionsCommandQueueOptionsConfiguration options for the command queue creation.
Returns
- ICommandQueue
A new command queue associated with this context.
MakeCurrent()
Makes this context current for the calling thread. This is required for certain backend APIs that maintain thread-local context state. After calling this method, subsequent operations on the current thread will use this context.
void MakeCurrent()
SynchronizeAsync(CancellationToken)
Synchronizes all pending operations in this context. This method blocks until all previously submitted work to this context has completed, ensuring that all kernels, memory operations, and other commands have finished execution.
Task SynchronizeAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to cancel the synchronization operation.
Returns
- Task
A task that completes when all operations in the context have finished.