Class KernelCatalog
Central catalog for resolving and managing GPU kernel registrations. Provides thread-safe kernel resolution with automatic CPU fallback.
public sealed class KernelCatalog
- Inheritance
-
KernelCatalog
- Inherited Members
Constructors
KernelCatalog(ILogger<KernelCatalog>, IOptions<KernelCatalogOptions>)
Initializes a new instance of the KernelCatalog class.
public KernelCatalog(ILogger<KernelCatalog> logger, IOptions<KernelCatalogOptions> options)
Parameters
loggerILogger<KernelCatalog>Logger for catalog operations.
optionsIOptions<KernelCatalogOptions>Catalog configuration options containing kernel descriptors.
Exceptions
- ArgumentNullException
Thrown when logger or options are null.
Methods
ResolveAsync<TIn, TOut>(KernelId, IServiceProvider, CancellationToken)
Resolves a kernel instance by its identifier with the specified input and output types. Falls back to CPU passthrough if the kernel is not found in the catalog.
public Task<IGpuKernel<TIn, TOut>> ResolveAsync<TIn, TOut>(KernelId id, IServiceProvider sp, CancellationToken cancellationToken = default) where TIn : notnull where TOut : notnull
Parameters
idKernelIdThe kernel identifier.
spIServiceProviderThe service provider for dependency resolution.
cancellationTokenCancellationTokenCancellation token for the operation.
Returns
- Task<IGpuKernel<TIn, TOut>>
A resolved kernel instance.
Type Parameters
TInThe input type for the kernel.
TOutThe output type for the kernel.
Exceptions
- InvalidOperationException
Thrown when kernel resolution fails.