Skip to main content

Module protocol

Module protocol 

Source
Expand description

Ring-buffer protocol constants - slot layout, control words, opcodes, debug log.

Pure data module. No logic, no imports beyond std. Every constant has a doc-comment that says what the GPU kernel does with it.

Modules§

control
Control-buffer slot layout helpers.
debug
Debug helpers for inspecting megakernel slot/opcode state at runtime.
opcode
Opcode constants and decoding utilities for megakernel slots.
slot
Slot layout helpers (per-slot offsets, ARG0 helpers).

Structs§

DebugRecord
A single PRINTF event decoded out of the debug-log buffer.

Enums§

ProtocolError
Megakernel host-protocol encoding and decoding error.

Constants§

ARG0_WORD
First argument word. Opcodes read args at ring_buffer[slot_base + ARG0_WORD .. slot_base + SLOT_WORDS].
ARGS_PER_SLOT
Number of u32 argument words available per slot (12).
CONTROL_MIN_WORDS
Minimum control-buffer words required by the compiled megakernel ABI.
MAX_DEBUG_RECORDS
Maximum debug-log records whose byte length is representable by the u32 wire ABI.
MAX_ENCODED_DEBUG_RECORDS
Maximum debug-log records the allocating encoder will materialize.
MAX_ENCODED_OBSERVABLE_SLOTS
Maximum host-observable words the allocating encoder will materialize.
MAX_ENCODED_RING_SLOTS
Maximum ring slots the allocating encoder will materialize.
MAX_OBSERVABLE_SLOTS
Maximum host-observable words whose control-buffer byte length is representable by the u32 wire ABI.
MAX_RING_SLOTS
Maximum ring slots whose byte length is representable by the u32 wire ABI.
OPCODE_WORD
Word index of the slot opcode (dispatched via If-tree).
PRIORITY_WORD
Word index of the slot priority level.
SLOT_WORDS
Number of u32 words each ring-buffer slot occupies. 16 words = 64 B, a cache line on x86_64 and the slot size NVMe Submission Queue Entries will use when the uring-cmd-nvme extension lands.
STATUS_WORD
Word index of the slot status header (the CAS target).
TENANT_WORD
Word index of the slot tenant id.

Functions§

control_byte_len
Return the number of bytes required by a control buffer with observable_slots.
count_done_ring_slots
Count DONE slots in a ring-buffer readback.
debug_log_byte_len
Return the number of bytes required by a debug-log buffer.
decode_expert_missDeprecated
Deprecated alias for decode_load_miss; see encode_expert_miss.
decode_load_miss
Decode a load-miss slot from ring-buffer bytes.
encode_control
Encode a control-buffer payload.
encode_empty_debug_log
Encode an empty PRINTF channel buffer.
encode_empty_ring
Encode an empty ring buffer with slot_count slots.
encode_expert_missDeprecated
Deprecated alias for encode_load_miss. The old MoE-specific parameter name was a boundary violation - vyre is a generic GPU substrate. New code must use encode_load_miss; this shim will be removed once consumers have migrated.
encode_load_miss
Encode a single ring-buffer slot for a load-miss request.
read_debug_log
Decode PRINTF records out of the debug-log buffer.
read_debug_log_into
Decode PRINTF records into caller-owned storage.
read_done_count
Decode the kernel’s done_count from a control buffer.
read_epoch
Read the epoch counter from a control buffer.
read_metrics
Read per-opcode metrics counters from a control buffer.
read_metrics_into
Read per-opcode metrics counters into caller-owned storage.
read_observable
Read an observable result word from a control buffer.
ring_byte_len
Return the number of bytes required by a ring buffer with slot_count slots.
try_count_done_ring_slots
Strictly count DONE slots in a ring-buffer readback.
try_encode_control
Strictly encode a control-buffer payload.
try_encode_control_into
Strictly encode a control-buffer payload into caller-owned storage.
try_encode_empty_debug_log
Strictly encode an empty PRINTF channel buffer.
try_encode_empty_debug_log_into
Strictly encode an empty PRINTF channel buffer into caller-owned storage.
try_encode_empty_ring
Strictly encode an empty ring buffer with slot_count slots.
try_encode_empty_ring_into
Strictly encode an empty ring buffer into caller-owned storage.
try_encode_load_miss
Strictly encode a single ring-buffer slot for a load-miss request.
try_encode_load_miss_into
Strictly encode a load-miss slot into caller-owned storage.
try_read_debug_log
Strictly decode PRINTF records out of the debug-log buffer.
try_read_debug_log_into
Strictly decode PRINTF records into caller-owned storage.
try_read_done_count
Strictly decode the kernel’s done_count from a control buffer.
try_read_epoch
Strictly decode the epoch counter from a control buffer.
try_read_metrics
Strictly read per-opcode metrics counters from a control buffer.
try_read_metrics_into
Strictly read per-opcode metrics counters into caller-owned storage.
try_read_observable
Strictly read an observable result word from a control buffer.
try_slot_byte_len
Return the byte length of one ring-buffer slot.
try_slot_word_base
Return the first word index for slot.
try_slot_word_index
Return the absolute ring word index for a slot-local word.
try_word_index
Convert a protocol-local word index into a host index.