Table of Contents

Interface IKernelDebugService

Namespace
DotCompute.Abstractions.Debugging
Assembly
DotCompute.Abstractions.dll

Service for debugging kernels across different backends with cross-validation capabilities. Enables comparison of results between backends to ensure correctness and identify issues.

public interface IKernelDebugService

Methods

AnalyzeMemoryPatternsAsync(string, object[])

Analyzes memory access patterns and identifies potential performance issues. Helps optimize kernels by detecting memory coalescing problems, bank conflicts, etc.

Task<MemoryAnalysisReport> AnalyzeMemoryPatternsAsync(string kernelName, object[] inputs)

Parameters

kernelName string

Name of the kernel to analyze

inputs object[]

Input parameters for the kernel

Returns

Task<MemoryAnalysisReport>

Memory analysis report with optimization suggestions

CompareResultsAsync(IEnumerable<KernelExecutionResult>, ComparisonStrategy)

Compares outputs from different backend executions to identify discrepancies. Supports various comparison strategies (exact, tolerance-based, statistical).

Task<ResultComparisonReport> CompareResultsAsync(IEnumerable<KernelExecutionResult> results, ComparisonStrategy comparisonStrategy = ComparisonStrategy.Tolerance)

Parameters

results IEnumerable<KernelExecutionResult>

Collection of execution results from different backends

comparisonStrategy ComparisonStrategy

Strategy for comparing the results

Returns

Task<ResultComparisonReport>

Comparison result highlighting differences and similarities

Configure(DebugServiceOptions)

Configures debugging options such as verbosity level, output formats, etc.

void Configure(DebugServiceOptions options)

Parameters

options DebugServiceOptions

Debugging configuration options

ExecuteOnBackendAsync(string, string, object[])

Executes a kernel on a specific backend with detailed profiling information. Useful for performance analysis and identifying backend-specific issues.

Task<KernelExecutionResult> ExecuteOnBackendAsync(string kernelName, string backendType, object[] inputs)

Parameters

kernelName string

Name of the kernel to execute

backendType string

Specific backend to use for execution

inputs object[]

Input parameters for the kernel

Returns

Task<KernelExecutionResult>

Execution result with timing, memory usage, and output data

GetAvailableBackendsAsync()

Gets detailed information about available backends and their capabilities. Useful for understanding why certain backends might be selected or rejected.

Task<IEnumerable<BackendInfo>> GetAvailableBackendsAsync()

Returns

Task<IEnumerable<BackendInfo>>

Information about all available backends and their current status

TraceKernelExecutionAsync(string, object[], string[])

Captures intermediate state during kernel execution for step-by-step debugging. Useful for complex kernels where you need to examine internal calculations.

Task<KernelExecutionTrace> TraceKernelExecutionAsync(string kernelName, object[] inputs, string[] tracePoints)

Parameters

kernelName string

Name of the kernel to trace

inputs object[]

Input parameters for the kernel

tracePoints string[]

Specific points in the kernel to capture state

Returns

Task<KernelExecutionTrace>

Execution trace with intermediate values

ValidateDeterminismAsync(string, object[], int)

Validates that a kernel produces deterministic results across multiple executions. Important for ensuring reproducibility in scientific computing applications.

Task<DeterminismReport> ValidateDeterminismAsync(string kernelName, object[] inputs, int iterations = 10)

Parameters

kernelName string

Name of the kernel to test

inputs object[]

Input parameters for the kernel

iterations int

Number of executions to perform (default: 10)

Returns

Task<DeterminismReport>

Determinism report showing consistency across executions

ValidateKernelAsync(string, object[], float)

Validates a kernel by executing it on multiple backends and comparing results. This is the primary debugging method for ensuring kernel correctness.

Task<KernelValidationResult> ValidateKernelAsync(string kernelName, object[] inputs, float tolerance = 1E-06)

Parameters

kernelName string

Name of the kernel to validate

inputs object[]

Input parameters for the kernel

tolerance float

Numerical tolerance for floating-point comparisons (default: 1e-6f)

Returns

Task<KernelValidationResult>

Validation result containing comparison data and potential issues