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
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
resultsIEnumerable<KernelExecutionResult>Collection of execution results from different backends
comparisonStrategyComparisonStrategyStrategy 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
optionsDebugServiceOptionsDebugging 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
kernelNamestringName of the kernel to execute
backendTypestringSpecific backend to use for execution
inputsobject[]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
kernelNamestringName of the kernel to trace
inputsobject[]Input parameters for the kernel
tracePointsstring[]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
kernelNamestringName of the kernel to test
inputsobject[]Input parameters for the kernel
iterationsintNumber 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
kernelNamestringName of the kernel to validate
inputsobject[]Input parameters for the kernel
tolerancefloatNumerical tolerance for floating-point comparisons (default: 1e-6f)
Returns
- Task<KernelValidationResult>
Validation result containing comparison data and potential issues