Table of Contents

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

TSource

The type of the kernel source.

TCompiled

The type of the compiled kernel.

Properties

Capabilities

Gets compiler capabilities as a dictionary of feature flags.

IReadOnlyDictionary<string, object> Capabilities { get; }

Property Value

IReadOnlyDictionary<string, object>

Name

Gets the name of the compiler.

string Name { get; }

Property Value

string

SupportedSourceTypes

Gets the supported source types this compiler can handle.

IReadOnlyList<KernelLanguage> SupportedSourceTypes { get; }

Property Value

IReadOnlyList<KernelLanguage>

Methods

CompileAsync(TSource, CompilationOptions?, CancellationToken)

Compiles a kernel source to executable form.

ValueTask<TCompiled> CompileAsync(TSource source, CompilationOptions? options = null, CancellationToken cancellationToken = default)

Parameters

source TSource

The kernel source to compile.

options CompilationOptions

Optional compilation options.

cancellationToken CancellationToken

Token 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

kernel TCompiled

The compiled kernel to optimize.

level OptimizationLevel

The optimization level to apply.

cancellationToken CancellationToken

Token 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

source TSource

The 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

source TSource

The kernel source to validate.

cancellationToken CancellationToken

Token to cancel the validation operation.

Returns

ValueTask<UnifiedValidationResult>

A task that represents the asynchronous validation operation.