| Crates.io | ringkernel-core |
| lib.rs | ringkernel-core |
| version | 0.4.0 |
| created_at | 2025-12-03 15:44:33.583628+00 |
| updated_at | 2026-01-25 21:22:06.035918+00 |
| description | Core traits and types for RingKernel GPU-native actor system |
| homepage | https://github.com/mivertowski/RustCompute |
| repository | https://github.com/mivertowski/RustCompute |
| max_upload_size | |
| id | 1964333 |
| size | 1,482,904 |
Core traits and types for the RingKernel GPU-native actor system.
This crate provides the foundational abstractions that all RingKernel backends implement. It defines the message passing protocols, kernel lifecycle management, and synchronization primitives.
use ringkernel_core::prelude::*;
// Messages must be serializable for GPU transfer
pub trait RingMessage: Archive + Serialize + Deserialize {
fn type_id(&self) -> u32;
fn correlation_id(&self) -> Option<CorrelationId>;
}
#[async_trait]
pub trait RingKernelRuntime: Send + Sync {
async fn launch(&self, id: &str, options: LaunchOptions) -> Result<KernelHandle>;
async fn shutdown(&self) -> Result<()>;
fn is_k2k_enabled(&self) -> bool;
}
128-byte GPU-resident structure for kernel lifecycle management:
#[repr(C, align(128))]
pub struct ControlBlock {
pub is_active: AtomicU32,
pub should_terminate: AtomicU32,
pub has_terminated: AtomicU32,
pub messages_processed: AtomicU64,
// ... HLC state, queue pointers, etc.
}
| Component | Description |
|---|---|
RingMessage |
Trait for GPU-transferable messages |
MessageQueue |
Lock-free ring buffer for message passing |
KernelHandle |
Handle to manage kernel lifecycle |
ControlBlock |
GPU-resident kernel state |
HlcTimestamp |
Hybrid Logical Clock for causal ordering |
K2KBroker |
Kernel-to-kernel messaging broker |
PubSubBroker |
Topic-based publish/subscribe |
Provides causal ordering across distributed operations:
use ringkernel_core::hlc::{HlcClock, HlcTimestamp};
let clock = HlcClock::new(node_id);
let ts1 = clock.tick();
let ts2 = clock.tick();
assert!(ts1 < ts2);
// Synchronize with remote timestamp
let synced = clock.update(&remote_ts)?;
Direct communication between kernels without host involvement:
let broker = K2KBroker::new();
let endpoint = broker.register(kernel_id);
endpoint.send(destination_id, envelope).await?;
cargo test -p ringkernel-core
The crate includes 65+ tests covering message serialization, queue operations, HLC ordering, and K2K messaging.
Apache-2.0