#[repr(C, align(128))]pub struct ControlBlock {Show 18 fields
pub is_active: u32,
pub should_terminate: u32,
pub has_terminated: u32,
pub _pad1: u32,
pub messages_processed: u64,
pub messages_in_flight: u64,
pub input_head: u64,
pub input_tail: u64,
pub output_head: u64,
pub output_tail: u64,
pub input_capacity: u32,
pub output_capacity: u32,
pub input_mask: u32,
pub output_mask: u32,
pub hlc_state: HlcState,
pub last_error: u32,
pub error_count: u32,
pub _reserved: [u8; 24],
}Expand description
Kernel control block (128 bytes, cache-line aligned).
This structure resides in GPU global memory and is accessed atomically by both host and device code for kernel lifecycle management.
§Memory Layout
The structure is carefully designed to minimize false sharing:
- Frequently written fields are grouped together
- Read-only fields are separated
- Padding ensures proper alignment
Fields§
§is_active: u32Kernel is actively processing messages (atomic bool).
should_terminate: u32Signal to terminate the kernel (atomic bool).
has_terminated: u32Kernel has completed termination (atomic bool).
_pad1: u32Reserved for alignment.
messages_processed: u64Total messages processed.
messages_in_flight: u64Messages currently being processed.
input_head: u64Input queue head pointer (producer writes).
input_tail: u64Input queue tail pointer (consumer reads).
output_head: u64Output queue head pointer (producer writes).
output_tail: u64Output queue tail pointer (consumer reads).
input_capacity: u32Input queue capacity (power of 2).
output_capacity: u32Output queue capacity (power of 2).
input_mask: u32Input queue mask (capacity - 1).
output_mask: u32Output queue mask (capacity - 1).
hlc_state: HlcStateHLC state for this kernel.
last_error: u32Last error code (0 = no error).
error_count: u32Error count.
_reserved: [u8; 24]Reserved for future use.
Implementations§
Source§impl ControlBlock
impl ControlBlock
Sourcepub fn with_capacities(input_capacity: u32, output_capacity: u32) -> Self
pub fn with_capacities(input_capacity: u32, output_capacity: u32) -> Self
Create with specified queue capacities.
Capacities must be powers of 2.
Sourcepub fn should_terminate(&self) -> bool
pub fn should_terminate(&self) -> bool
Check if termination was requested.
Sourcepub fn has_terminated(&self) -> bool
pub fn has_terminated(&self) -> bool
Check if the kernel has terminated.
Sourcepub fn input_queue_size(&self) -> u64
pub fn input_queue_size(&self) -> u64
Get input queue size.
Sourcepub fn output_queue_size(&self) -> u64
pub fn output_queue_size(&self) -> u64
Get output queue size.
Sourcepub fn input_queue_empty(&self) -> bool
pub fn input_queue_empty(&self) -> bool
Check if input queue is empty.
Sourcepub fn output_queue_empty(&self) -> bool
pub fn output_queue_empty(&self) -> bool
Check if output queue is empty.
Sourcepub fn input_queue_full(&self) -> bool
pub fn input_queue_full(&self) -> bool
Check if input queue is full.
Sourcepub fn output_queue_full(&self) -> bool
pub fn output_queue_full(&self) -> bool
Check if output queue is full.
Trait Implementations§
Source§impl Clone for ControlBlock
impl Clone for ControlBlock
Source§fn clone(&self) -> ControlBlock
fn clone(&self) -> ControlBlock
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ControlBlock
impl Debug for ControlBlock
Source§impl Default for ControlBlock
impl Default for ControlBlock
impl Copy for ControlBlock
Auto Trait Implementations§
impl Freeze for ControlBlock
impl RefUnwindSafe for ControlBlock
impl Send for ControlBlock
impl Sync for ControlBlock
impl Unpin for ControlBlock
impl UnwindSafe for ControlBlock
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)