pub trait GpuKernel:
Send
+ Sync
+ Debug {
// Required method
fn metadata(&self) -> &KernelMetadata;
// Provided methods
fn validate(&self) -> Result<()> { ... }
fn id(&self) -> &str { ... }
fn requires_gpu_native(&self) -> bool { ... }
fn health_check(&self) -> HealthStatus { ... }
fn shutdown(&self) -> Result<()> { ... }
fn refresh_config(&mut self, _config: &KernelConfig) -> Result<()> { ... }
}Expand description
Base trait for all GPU kernels.
Provides access to kernel metadata, health checking, and lifecycle management.
§Enterprise Features (0.3.1)
health_check()- Report kernel health for liveness/readiness probesshutdown()- Graceful shutdown with resource cleanuprefresh_config()- Hot configuration reload
Required Methods§
Sourcefn metadata(&self) -> &KernelMetadata
fn metadata(&self) -> &KernelMetadata
Returns the kernel metadata.
Provided Methods§
Sourcefn validate(&self) -> Result<()>
fn validate(&self) -> Result<()>
Validate kernel configuration.
Called before kernel launch to ensure configuration is valid.
Sourcefn requires_gpu_native(&self) -> bool
fn requires_gpu_native(&self) -> bool
Returns true if this kernel requires GPU-native execution.
Sourcefn health_check(&self) -> HealthStatus
fn health_check(&self) -> HealthStatus
Perform a health check on this kernel.
Used by liveness and readiness probes. Override to implement custom health checking logic (e.g., checking GPU memory, connections).
§Returns
The current health status of the kernel.
Sourcefn shutdown(&self) -> Result<()>
fn shutdown(&self) -> Result<()>
Graceful shutdown of the kernel.
Called during runtime shutdown to release resources. Override to implement custom cleanup (e.g., flushing buffers, closing connections).
Default implementation does nothing.