Class GpuBridge
Main implementation of the GPU bridge
public sealed class GpuBridge : IGpuBridge
- Inheritance
-
GpuBridge
- Implements
- Inherited Members
Constructors
GpuBridge(ILogger<GpuBridge>, KernelCatalog, DeviceBroker, IOptions<GpuBridgeOptions>, IServiceProvider)
Initializes a new instance of the GpuBridge class
public GpuBridge(ILogger<GpuBridge> logger, KernelCatalog kernelCatalog, DeviceBroker deviceBroker, IOptions<GpuBridgeOptions> options, IServiceProvider serviceProvider)
Parameters
loggerILogger<GpuBridge>Logger instance
kernelCatalogKernelCatalogKernel catalog for kernel management
deviceBrokerDeviceBrokerDevice broker for GPU management
optionsIOptions<GpuBridgeOptions>GPU bridge configuration options
serviceProviderIServiceProviderService provider for dependency injection
Methods
ExecuteKernelAsync(string, object, CancellationToken)
Executes a kernel with dynamic type resolution (non-generic overload)
[RequiresDynamicCode("Dynamic kernel execution uses runtime reflection to create generic method calls.")]
[RequiresUnreferencedCode("Dynamic kernel execution uses reflection which may not work with trimming.")]
public ValueTask<object> ExecuteKernelAsync(string kernelId, object input, CancellationToken ct = default)
Parameters
kernelIdstringKernel identifier
inputobjectInput data (type will be inferred)
ctCancellationTokenCancellation token
Returns
ExecuteKernelAsync<TRequest, TResponse>(string, TRequest, CancellationToken)
Executes a kernel dynamically with specified input and output types.
public ValueTask<TResponse> ExecuteKernelAsync<TRequest, TResponse>(string kernelId, TRequest input, CancellationToken ct = default) where TRequest : notnull where TResponse : notnull
Parameters
kernelIdstringThe kernel identifier.
inputTRequestThe input object.
ctCancellationTokenCancellation token.
Returns
- ValueTask<TResponse>
The execution result.
Type Parameters
TRequestThe request type.
TResponseThe response type.
GetDevicesAsync(CancellationToken)
Gets the list of available GPU devices
public ValueTask<IReadOnlyList<GpuDevice>> GetDevicesAsync(CancellationToken ct = default)
Parameters
Returns
GetInfoAsync(CancellationToken)
Gets information about the GPU bridge and available resources
public ValueTask<GpuBridgeInfo> GetInfoAsync(CancellationToken ct = default)
Parameters
Returns
GetKernelAsync<TIn, TOut>(KernelId, CancellationToken)
Gets a kernel executor for the specified kernel ID
public ValueTask<IGpuKernel<TIn, TOut>> GetKernelAsync<TIn, TOut>(KernelId kernelId, CancellationToken ct = default) where TIn : notnull where TOut : notnull
Parameters
kernelIdKernelIdctCancellationToken
Returns
- ValueTask<IGpuKernel<TIn, TOut>>
Type Parameters
TInTOut