pub struct RingKernelConfig {Show 13 fields
pub id: String,
pub block_size: u32,
pub queue_capacity: u32,
pub enable_k2k: bool,
pub enable_hlc: bool,
pub message_size: usize,
pub response_size: usize,
pub cooperative_groups: bool,
pub idle_sleep_ns: u32,
pub use_envelope_format: bool,
pub kernel_id_num: u64,
pub hlc_node_id: u64,
pub reduction: KernelReductionConfig,
}Expand description
Configuration for a ring kernel.
Fields§
§id: StringKernel identifier (used in function name).
block_size: u32Block size (threads per block).
queue_capacity: u32Input queue capacity (must be power of 2).
enable_k2k: boolEnable kernel-to-kernel messaging.
enable_hlc: boolEnable HLC clock operations.
message_size: usizeMessage size in bytes (for buffer offset calculations).
response_size: usizeResponse size in bytes.
cooperative_groups: boolUse cooperative thread groups.
idle_sleep_ns: u32Nanosleep duration when idle (0 to spin).
use_envelope_format: boolUse MessageEnvelope format (256-byte header + payload). When enabled, messages in queues are full envelopes with headers.
kernel_id_num: u64Kernel numeric ID (for response routing).
hlc_node_id: u64HLC node ID for this kernel.
reduction: KernelReductionConfigConfiguration for global reductions (e.g., for PageRank dangling sum).
Implementations§
Source§impl RingKernelConfig
impl RingKernelConfig
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new ring kernel configuration with the given ID.
Sourcepub fn with_block_size(self, size: u32) -> Self
pub fn with_block_size(self, size: u32) -> Self
Set the block size.
Sourcepub fn with_queue_capacity(self, capacity: u32) -> Self
pub fn with_queue_capacity(self, capacity: u32) -> Self
Set the queue capacity (must be power of 2).
Sourcepub fn with_message_sizes(self, message: usize, response: usize) -> Self
pub fn with_message_sizes(self, message: usize, response: usize) -> Self
Set message and response sizes.
Sourcepub fn with_idle_sleep(self, ns: u32) -> Self
pub fn with_idle_sleep(self, ns: u32) -> Self
Set idle sleep duration in nanoseconds.
Sourcepub fn with_envelope_format(self, enabled: bool) -> Self
pub fn with_envelope_format(self, enabled: bool) -> Self
Enable or disable MessageEnvelope format. When enabled, messages use the 256-byte header + payload format.
Sourcepub fn with_kernel_id(self, id: u64) -> Self
pub fn with_kernel_id(self, id: u64) -> Self
Set the kernel numeric ID (for K2K routing and response headers).
Sourcepub fn with_hlc_node_id(self, node_id: u64) -> Self
pub fn with_hlc_node_id(self, node_id: u64) -> Self
Set the HLC node ID for this kernel.
Sourcepub fn with_reduction(self, reduction: KernelReductionConfig) -> Self
pub fn with_reduction(self, reduction: KernelReductionConfig) -> Self
Configure global reduction for this kernel.
§Example
use ringkernel_cuda_codegen::{RingKernelConfig, KernelReductionConfig};
use ringkernel_cuda_codegen::reduction_intrinsics::ReductionOp;
let config = RingKernelConfig::new("pagerank")
.with_reduction(
KernelReductionConfig::new()
.with_op(ReductionOp::Sum)
.with_type("double")
);Sourcepub fn with_sum_reduction(self) -> Self
pub fn with_sum_reduction(self) -> Self
Enable global sum reduction with default settings.
This is a convenience method for enabling a sum reduction with double precision.
Sourcepub fn kernel_name(&self) -> String
pub fn kernel_name(&self) -> String
Generate the kernel function name.
Sourcepub fn generate_signature(&self) -> String
pub fn generate_signature(&self) -> String
Generate CUDA kernel signature.
Sourcepub fn generate_preamble(&self, indent: &str) -> String
pub fn generate_preamble(&self, indent: &str) -> String
Generate the kernel preamble (thread setup, variable declarations).
Sourcepub fn generate_loop_header(&self, indent: &str) -> String
pub fn generate_loop_header(&self, indent: &str) -> String
Generate the persistent message loop header.
Sourcepub fn generate_message_complete(&self, indent: &str) -> String
pub fn generate_message_complete(&self, indent: &str) -> String
Generate message processing completion code.
Generate the loop footer (end of while loop).
Sourcepub fn generate_epilogue(&self, indent: &str) -> String
pub fn generate_epilogue(&self, indent: &str) -> String
Generate kernel epilogue (termination marking).
Sourcepub fn generate_kernel_wrapper(&self, handler_placeholder: &str) -> String
pub fn generate_kernel_wrapper(&self, handler_placeholder: &str) -> String
Generate complete kernel wrapper (without handler body).
Trait Implementations§
Source§impl Clone for RingKernelConfig
impl Clone for RingKernelConfig
Source§fn clone(&self) -> RingKernelConfig
fn clone(&self) -> RingKernelConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more