Skip to main content

chronon::sender::ConnectionBase

More...

#include <Connection.hpp>

Inherited by chronon::sender::Connection< T >

Public Functions

Name
virtual~ConnectionBase() =default
virtual booltransparentBroadcastEligible(size_t headroom_cycles) const
virtual size_ttransactionPushesAt(uint64_t cycle) const =0
virtual void *sourcePortPtr() const
virtual Unit *source() const =0
virtual voidsetThreadQueueId(size_t queue_id) =0
virtual voidsetDependencyOnlyTransport(bool enabled, size_t cross_thread_headroom =std::numeric_limits< size_t >::max()) =0
virtual voidsetConnId(uint32_t conn_id) =0
virtual size_tregisterProducerThread(size_t thread_id) =0
virtual class IMultiProducerPort *registerOnDestMPSC() =0
virtual voidoptimizeForSameThread(bool cycle_strict_admission =false) =0
virtual voidoptimizeForSPSC() =0
virtual voidoptimizeForMPSC() =0
boolisTight() const
True if this is a zero-delay (tight) connection.
virtual boolhasThreadQueueId() const =0
True if this connection uses thread-specific queue (MPSC mode).
virtual boolfinalizeTransparentBroadcastForDestination(size_t producer_count) =0
virtual boolensureEpochFreeHeadroom(uint32_t max_lookahead_cycles) =0
virtual boolenableTransparentBroadcastForSource(size_t headroom_cycles)
virtual Unit *destination() const =0
virtual void *destPortPtr() const =0
virtual booldependencyOnlyTransport() const =0
virtual uint32_tdelay() const =0
virtual size_tcrossThreadHeadroom() const
virtual uint32_tconnId() const =0
virtual voidconfigureRegisteredEdge(std::optional< size_t > capacity, std::optional< size_t > rate) =0
virtual voidcancelInFlight() =0

Detailed Description

class chronon::sender::ConnectionBase;

ConnectionBase - Type-erased base class for connections.

Enables storing heterogeneous connections in containers.

Public Functions Documentation

function ~ConnectionBase

virtual ~ConnectionBase() =default

function transparentBroadcastEligible

inline virtual bool transparentBroadcastEligible(
size_t headroom_cycles
) const

Reimplemented by: chronon::Connection::transparentBroadcastEligible, chronon::sender::Connection::transparentBroadcastEligible

True when this edge can participate in the automatic delay-one shared-broadcast transport without changing model-visible semantics.

function transactionPushesAt

virtual size_t transactionPushesAt(
uint64_t cycle
) const =0

Reimplemented by: chronon::Connection::transactionPushesAt, chronon::sender::Connection::transactionPushesAt

Producer-owned pushes already claimed in cycle.

Port transactions use this cold-path view to detect an ordinary send through another OutPort owned by the same Unit. Every connection in the queried producer group has the same sole writer, so this remains a synchronization-free read of the existing per-cycle counter.

function sourcePortPtr

inline virtual void * sourcePortPtr() const

Reimplemented by: chronon::Connection::sourcePortPtr, chronon::sender::Connection::sourcePortPtr

function source

virtual Unit * source() const =0

Reimplemented by: chronon::Connection::source, chronon::sender::Connection::source

function setThreadQueueId

virtual void setThreadQueueId(
size_t queue_id
) =0

Parameters:

  • queue_id The queue ID for this connection

Reimplemented by: chronon::Connection::setThreadQueueId, chronon::sender::Connection::setThreadQueueId

Set the thread queue ID for multi-producer mode.

Called during initialization when the destination InPort is in multi-producer mode.

function setDependencyOnlyTransport

virtual void setDependencyOnlyTransport(
bool enabled,
size_t cross_thread_headroom =std::numeric_limits< size_t >::max()
) =0

Reimplemented by: chronon::Connection::setDependencyOnlyTransport, chronon::sender::Connection::setDependencyOnlyTransport

Keep this edge in the scheduler dependency graph without transporting payloads. Intended for model-owned shared fabrics that carry data once while declared connections continue to describe ordering and delay. A finite cross_thread_headroom lets the scheduler constrain producer run-ahead to the external transport's storage.

function setConnId

virtual void setConnId(
uint32_t conn_id
) =0

Reimplemented by: chronon::Connection::setConnId, chronon::sender::Connection::setConnId

Stable connection identifier assigned at simulation build time.

Equal to this connection's index in TickSimulation::connections_. Used by MultiProducerQueueAdapter as a cross-num_workers-stable tiebreaker in the k-way merge, replacing the partition-dependent queue_id. The value is deterministic given a fixed topology, regardless of thread count / cluster assignment.

function registerProducerThread

virtual size_t registerProducerThread(
size_t thread_id
) =0

Parameters:

Return: Queue ID for this producer key, or SIZE_MAX on failure

Reimplemented by: chronon::Connection::registerProducerThread, chronon::sender::Connection::registerProducerThread

Register a stable producer key for MPSC mode.

function registerOnDestMPSC

virtual class IMultiProducerPort * registerOnDestMPSC() =0

Reimplemented by: chronon::Connection::registerOnDestMPSC, chronon::sender::Connection::registerOnDestMPSC

Register this MPSC connection on its destination InPort and return the InPort's type-erased MPSC metadata interface. TickSimulation uses it for progress-coverage and physical-overflow validation without knowing the Connection's message type. Returns nullptr outside MPSC mode.

function optimizeForSameThread

virtual void optimizeForSameThread(
bool cycle_strict_admission =false
) =0

Reimplemented by: chronon::Connection::optimizeForSameThread, chronon::sender::Connection::optimizeForSameThread

Optimize destination port for same-thread access.

Switches InPort to use the synchronization-free SingleThreadMessageQueue. Call this during initialization when both source and destination are determined to be on the same worker. Epoch-free execution enables cycle-strict admission because separate local clusters can temporarily execute out of their normal sweep order.

This keeps intra-cluster registered edges on the cheapest storage.

function optimizeForSPSC

virtual void optimizeForSPSC() =0

Reimplemented by: chronon::Connection::optimizeForSPSC, chronon::sender::Connection::optimizeForSPSC

Optimize destination port for cross-thread SPSC access.

Switches InPort to use lock-free LockFreeMessageQueue. Call this during initialization when there is exactly ONE source thread writing to the destination port on a different thread.

function optimizeForMPSC

virtual void optimizeForMPSC() =0

Reimplemented by: chronon::Connection::optimizeForMPSC, chronon::sender::Connection::optimizeForMPSC

Optimize destination port for cross-thread MPSC access.

Switches InPort to use MultiProducerQueueAdapter with one producer queue per Connection.

function isTight

inline bool isTight() const

True if this is a zero-delay (tight) connection.

function hasThreadQueueId

virtual bool hasThreadQueueId() const =0

True if this connection uses thread-specific queue (MPSC mode).

Reimplemented by: chronon::Connection::hasThreadQueueId, chronon::sender::Connection::hasThreadQueueId

function finalizeTransparentBroadcastForDestination

virtual bool finalizeTransparentBroadcastForDestination(
size_t producer_count
) =0

Reimplemented by: chronon::Connection::finalizeTransparentBroadcastForDestination, chronon::sender::Connection::finalizeTransparentBroadcastForDestination

Compile an eligible destination's complete delay-one fan-in into a direct replay plan after every source transport has been attached.

function ensureEpochFreeHeadroom

virtual bool ensureEpochFreeHeadroom(
uint32_t max_lookahead_cycles
) =0

Reimplemented by: chronon::Connection::ensureEpochFreeHeadroom, chronon::sender::Connection::ensureEpochFreeHeadroom

Try to grow physical lock-free buffers enough for epoch-free run-ahead when the model-visible registered edge is unbounded. A finite declared edge capacity is semantic backpressure and must not be bypassed by resizing the storage ring.

function enableTransparentBroadcastForSource

inline virtual bool enableTransparentBroadcastForSource(
size_t headroom_cycles
)

Reimplemented by: chronon::Connection::enableTransparentBroadcastForSource, chronon::sender::Connection::enableTransparentBroadcastForSource

Enable the shared transport for every connection owned by this edge's source OutPort. Called once per eligible source during initialize().

function destination

virtual Unit * destination() const =0

Reimplemented by: chronon::Connection::destination, chronon::sender::Connection::destination

function destPortPtr

virtual void * destPortPtr() const =0

Reimplemented by: chronon::Connection::destPortPtr, chronon::sender::Connection::destPortPtr

function dependencyOnlyTransport

virtual bool dependencyOnlyTransport() const =0

Reimplemented by: chronon::Connection::dependencyOnlyTransport, chronon::sender::Connection::dependencyOnlyTransport

function delay

virtual uint32_t delay() const =0

Reimplemented by: chronon::Connection::delay, chronon::sender::Connection::delay

function crossThreadHeadroom

inline virtual size_t crossThreadHeadroom() const

Reimplemented by: chronon::Connection::crossThreadHeadroom, chronon::sender::Connection::crossThreadHeadroom

Max producer run-ahead (in cycles) this connection's cross-thread buffer (direct MPSC lane or SPSC lock-free ring) can absorb while the epoch-free path keeps results identical to the reference: roughly threshold / rate - delay + 1, where threshold is the entry count at which transfer() stops accepting (the ring, or the InPort capacity if smaller), rate is the source's per-cycle send cap, and delay accounts for not-yet-due entries the consumer cannot drain. Returns SIZE_MAX for connections with no bounded cross-thread ring (same-thread / unbounded) and 0 when no finite capacity dependency is provably safe. Used to gate the epoch-free lookahead path, which removes the per-epoch drain.

function connId

virtual uint32_t connId() const =0

Reimplemented by: chronon::Connection::connId, chronon::sender::Connection::connId

function configureRegisteredEdge

virtual void configureRegisteredEdge(
std::optional< size_t > capacity,
std::optional< size_t > rate
) =0

Reimplemented by: chronon::Connection::configureRegisteredEdge, chronon::sender::Connection::configureRegisteredEdge

Configure the registered edge modeled by this connection. capacity is the number of entries the producer may have in flight on this edge; rate is the maximum entries this edge can accept per producer cycle.

function cancelInFlight

virtual void cancelInFlight() =0

Reimplemented by: chronon::Connection::cancelInFlight, chronon::sender::Connection::cancelInFlight

Cancel all in-flight messages on this connection.

Advances the cancellation epoch so pending messages are dropped when the receiver tries to consume them.


Updated on 2026-07-23 at 16:24:33 +0000