GpuKernel

Trait GpuKernel 

Source
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 probes
  • shutdown() - Graceful shutdown with resource cleanup
  • refresh_config() - Hot configuration reload

Required Methods§

Source

fn metadata(&self) -> &KernelMetadata

Returns the kernel metadata.

Provided Methods§

Source

fn validate(&self) -> Result<()>

Validate kernel configuration.

Called before kernel launch to ensure configuration is valid.

Source

fn id(&self) -> &str

Returns the kernel ID.

Source

fn requires_gpu_native(&self) -> bool

Returns true if this kernel requires GPU-native execution.

Source

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.

Source

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.

Source

fn refresh_config(&mut self, _config: &KernelConfig) -> Result<()>

Refresh kernel configuration at runtime.

Called when configuration is hot-reloaded. Only safe-to-reload configuration values should be applied.

§Arguments
  • config - The new configuration to apply
§Returns

Ok if configuration was applied, Err if configuration is invalid.

Implementors§