/home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/variableSize/spsc/consumer.hpp Source File
HiCR
|
consumer.hpp
Go to the documentation of this file.
77 : variableSize::Base(communicationManager, internalCoordinationBufferForCounts, internalCoordinationBufferForPayloads, capacity, payloadCapacity),
114 HICR_THROW_LOGIC("Attempting to peek for a token with position (%lu), which is beyond than the channel capacity (%lu)", pos, getCircularBufferForCounts()->getCapacity());
121 HICR_THROW_RUNTIME("Attempting to peek position (%lu) but not enough tokens (%lu) are in the buffer", pos, getCircularBufferForCounts()->getDepth());
124 const size_t bufferPos = (getCircularBufferForCounts()->getTailPosition() + pos) % getCircularBufferForCounts()->getCapacity();
147 HICR_THROW_RUNTIME("Attempting to peek position (%lu) but not enough tokens (%lu) are in the buffer", pos, getCircularBufferForCounts()->getDepth());
151 result[0] = getCircularBufferForPayloads()->getTailPosition() % getCircularBufferForPayloads()->getCapacity();
214 HICR_THROW_LOGIC("Attempting to pop (%lu) tokens, which is larger than the channel capacity (%lu)", n, getCircularBufferForCounts()->getCapacity());
221 HICR_THROW_RUNTIME("Attempting to pop (%lu) tokens, which is more than the number of current tokens in the channel (%lu)", n, getCircularBufferForCounts()->getDepth());
294 [[nodiscard]] std::shared_ptr<GlobalMemorySlot> getPayloadBufferMemorySlot() const { return _payloadBuffer; }
Definition communicationManager.hpp:54
__INLINE__ void memcpy(const std::shared_ptr< LocalMemorySlot > &destination, size_t dst_offset, const std::shared_ptr< LocalMemorySlot > &source, size_t src_offset, size_t size)
Definition communicationManager.hpp:267
__INLINE__ void fence(GlobalMemorySlot::tag_t tag)
Definition communicationManager.hpp:377
__INLINE__ CommunicationManager * getCommunicationManager() const
Definition base.hpp:217
Definition base.hpp:41
__INLINE__ auto getCircularBufferForPayloads() const
Definition base.hpp:99
__INLINE__ auto getCoordinationBufferForPayloads() const
Definition base.hpp:111
__INLINE__ auto getCoordinationBufferForCounts() const
Definition base.hpp:105
__INLINE__ auto getCircularBufferForCounts() const
Definition base.hpp:93
Definition consumer.hpp:42
__INLINE__ void pop(const size_t n=1)
Definition consumer.hpp:211
std::shared_ptr< GlobalMemorySlot > getPayloadBufferMemorySlot() const
Definition consumer.hpp:294
size_t getOldPayloadBytes(size_t n)
Definition consumer.hpp:163
__INLINE__ void updateDepth()
Definition consumer.hpp:250
__INLINE__ size_t basePeek(const size_t pos=0)
Definition consumer.hpp:110
Consumer(CommunicationManager &communicationManager, std::shared_ptr< GlobalMemorySlot > payloadBuffer, std::shared_ptr< GlobalMemorySlot > tokenBuffer, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBufferForCounts, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBufferForPayloads, const std::shared_ptr< GlobalMemorySlot > &producerCoordinationBufferForCounts, std::shared_ptr< GlobalMemorySlot > producerCoordinationBufferForPayloads, const size_t payloadCapacity, const size_t capacity)
Definition consumer.hpp:68
size_t getNewPayloadBytes(size_t n)
Definition consumer.hpp:184
size_t getPayloadDepth()
Definition consumer.hpp:277
__INLINE__ std::array< size_t, 2 > peek(const size_t pos=0)
Definition consumer.hpp:140
extends channel::Base into a base enabling var-size messages
Generated by