Interface IKernelCacheService
- Namespace
- DotCompute.Runtime.Services.Interfaces
- Assembly
- DotCompute.Runtime.dll
Service for caching compiled kernels
public interface IKernelCacheService
Methods
ClearAsync()
Clears the kernel cache
Task ClearAsync()
Returns
- Task
A task representing the clear operation
EvictAsync()
Evicts old or unused cached kernels
Task<int> EvictAsync()
Returns
GenerateCacheKey(KernelDefinition, IAccelerator, CompilationOptions?)
Generates a cache key for a kernel definition and accelerator
string GenerateCacheKey(KernelDefinition definition, IAccelerator accelerator, CompilationOptions? options)
Parameters
definitionKernelDefinitionThe kernel definition
acceleratorIAcceleratorThe target accelerator
optionsCompilationOptionsCompilation options
Returns
- string
The cache key
GetAsync(string)
Gets a cached kernel if available
Task<ICompiledKernel?> GetAsync(string cacheKey)
Parameters
cacheKeystringThe cache key
Returns
- Task<ICompiledKernel>
The cached kernel or null if not found
GetStatistics()
Gets cache statistics
KernelCacheStatistics GetStatistics()
Returns
- KernelCacheStatistics
Cache statistics
StoreAsync(string, ICompiledKernel)
Stores a compiled kernel in the cache
Task StoreAsync(string cacheKey, ICompiledKernel kernel)
Parameters
cacheKeystringThe cache key
kernelICompiledKernelThe compiled kernel
Returns
- Task
A task representing the store operation