Expand description
Ring kernel configuration and code generation for persistent actor kernels.
This module provides the infrastructure for generating CUDA code for persistent actor kernels that process messages in a loop.
§Overview
Ring kernels are persistent GPU kernels that:
- Run continuously until terminated
- Process messages from input queues
- Produce responses to output queues
- Use HLC (Hybrid Logical Clocks) for causal ordering
- Support kernel-to-kernel (K2K) messaging
§Generated Kernel Structure
extern "C" __global__ void ring_kernel_NAME(
ControlBlock* __restrict__ control,
unsigned char* __restrict__ input_buffer,
unsigned char* __restrict__ output_buffer,
void* __restrict__ shared_state
) {
// Preamble: thread setup
int tid = threadIdx.x + blockIdx.x * blockDim.x;
// Persistent message loop
while (!atomicLoad(&control->should_terminate)) {
if (!atomicLoad(&control->is_active)) {
__nanosleep(1000);
continue;
}
// Message processing...
// (user handler code inserted here)
}
// Epilogue: mark terminated
if (tid == 0) {
atomicStore(&control->has_terminated, 1);
}
}Structs§
- Cuda
Dispatch Table - Dispatch table for multi-handler kernel code generation.
- Cuda
Handler Info - Handler registration for CUDA code generation.
- Kernel
Reduction Config - Configuration for global reductions in a ring kernel.
- Ring
Kernel Config - Configuration for a ring kernel.
Enums§
- Ring
Kernel Intrinsic - Intrinsic functions available in ring kernel handlers.
Functions§
- generate_
control_ block_ struct - Generate CUDA ControlBlock struct definition.
- generate_
extended_ h2k_ message_ struct - Generate the ExtendedH2KMessage struct for handler dispatch.
- generate_
handler_ dispatch_ code - Generate CUDA switch statement for handler dispatch.
- generate_
hlc_ struct - Generate CUDA HLC helper struct.
- generate_
k2k_ structs - Generate CUDA K2K routing structs and helper functions.
- generate_
message_ envelope_ structs - Generate CUDA MessageEnvelope structs matching ringkernel-core layout.
- generate_
multi_ handler_ kernel - Generate a complete multi-handler kernel with dispatch table.