Skip to main content

Module ring

Module ring 

Source
Expand description

Ring producer / consumer traits for the megakernel host protocol.

T036 / T037 in VyreOffload/RELEASE_PLAN.md. Today the protocol module ships byte-oriented encode_* / decode_* helpers and the consumer (host) drives a Vec<u8> ring directly. To make the ring source swappable - in-process host, out-of-process broker, or a GPU-direct producer - we lift the two halves of that contract behind traits and keep the existing path as the default in-process impl.

The wire format is owned by super::protocol; this module sits one level above it (publishing/observation surface, not bytes).

§Producer

RingProducer::publish writes one encoded slot. The encoded bytes come from a protocol::encode_* helper; the producer never inspects them beyond their length. Producers are responsible for the visibility/fence semantics the GPU expects (atomic store of the status word last); the default in-process producer does this via the protocol codec’s byte ordering and memcpy.

§Consumer

RingConsumer::read_slot is a read-only view of one slot’s bytes. Consumers may decode with protocol::decode_*. A consumer is decoupled from where the bytes are stored (host RAM, GPU mirror, shared-mem broker) - only the byte layout matters.

§Boundary

Neither trait names a consumer-specific concept (no “expert”, no “MoE”, no “shard”). The two traits are vyre-generic - see the boundary rule in AGENTS.md.

Structs§

HostRing
Default in-process ring backed by a Vec<u8>. Both RingProducer and RingConsumer are implemented on a single &mut /& borrow so the producer-consumer parity test can drive both halves with the same buffer.

Constants§

SLOT_BYTES
Bytes per slot in the megakernel ring buffer (= SLOT_WORDS * 4).

Traits§

RingConsumer
Consumer half of the megakernel ring contract.
RingProducer
Producer half of the megakernel ring contract.