Interface IUnifiedKernelCompiler<TSource, TCompiled>
- Namespace
- DotCompute.Abstractions
- Assembly
- DotCompute.Abstractions.dll
Unified kernel compiler interface that replaces all duplicate compiler interfaces. This is the ONLY kernel compiler interface in the entire solution. Supports both generic and accelerator-specific compilation workflows.
public interface IUnifiedKernelCompiler<in TSource, TCompiled> where TSource : class where TCompiled : ICompiledKernel
Type Parameters
TSourceThe type of the kernel source.
TCompiledThe type of the compiled kernel.
Properties
Capabilities
Gets compiler capabilities as a dictionary of feature flags.
IReadOnlyDictionary<string, object> Capabilities { get; }
Property Value
Name
Gets the name of the compiler.
string Name { get; }
Property Value
SupportedSourceTypes
Gets the supported source types this compiler can handle.
IReadOnlyList<KernelLanguage> SupportedSourceTypes { get; }
Property Value
Methods
CompileAsync(TSource, CompilationOptions?, CancellationToken)
Compiles a kernel source to executable form.
ValueTask<TCompiled> CompileAsync(TSource source, CompilationOptions? options = null, CancellationToken cancellationToken = default)
Parameters
sourceTSourceThe kernel source to compile.
optionsCompilationOptionsOptional compilation options.
cancellationTokenCancellationTokenToken to cancel the compilation.
Returns
- ValueTask<TCompiled>
A task that represents the asynchronous compilation operation.
OptimizeAsync(TCompiled, OptimizationLevel, CancellationToken)
Optimizes an already compiled kernel for better performance.
ValueTask<TCompiled> OptimizeAsync(TCompiled kernel, OptimizationLevel level, CancellationToken cancellationToken = default)
Parameters
kernelTCompiledThe compiled kernel to optimize.
levelOptimizationLevelThe optimization level to apply.
cancellationTokenCancellationTokenToken to cancel the optimization.
Returns
- ValueTask<TCompiled>
A task that represents the asynchronous optimization operation.
Validate(TSource)
Validates a kernel source without compiling.
UnifiedValidationResult Validate(TSource source)
Parameters
sourceTSourceThe kernel source to validate.
Returns
- UnifiedValidationResult
A validation result indicating whether compilation is possible.
ValidateAsync(TSource, CancellationToken)
Asynchronously validates a kernel source with detailed analysis.
ValueTask<UnifiedValidationResult> ValidateAsync(TSource source, CancellationToken cancellationToken = default)
Parameters
sourceTSourceThe kernel source to validate.
cancellationTokenCancellationTokenToken to cancel the validation operation.
Returns
- ValueTask<UnifiedValidationResult>
A task that represents the asynchronous validation operation.