data.buffer.accumulating ≡
template < typename T, auto Size, auto BufferCount, auto InputSize = Size, template <typename, auto> typename Container = memory, bool ResetWithInitialValues = false, auto FlitCount = 1 > class multi_accumulating_buffer §
An array of buffers, each of which accumulates a given number of entries and returns them once a specified number are enqueued or when a call to enqueue explicitly requests that the buffered values be flushed.
Parameters
-
typename TType of values stored in the accumulating buffer.
-
auto SizeMaximum number of elements that can be stored in each buffer.
-
auto BufferCountThe number of buffers.
-
auto InputSize = SizeMaximum number of elements that can be appended to a buffer in one call.
-
template <typename, auto> typename Container = memory
Template used to store buffer metadata and data.
-
bool ResetWithInitialValues = false
Reset the buffer metadata with initial values. If false, then the metadata will be reset with a
[[reset]]function. -
auto FlitCount = 1
Number of calls to the output callback for each
Sizeelements.
Types
Methods
-
multi_accumulating_buffer::output enqueue( multi_accumulating_buffer::buffer_index_t buffer_index, T[InputSize] values, count_t<InputSize> value_count, bool flush ) §
Write up to
InputSizevalues to a buffer. If there is now a full flit of accumulated data associated with the specified buffer then the return structure will contain that flit. A caller can also explicitly retrieve a partial flit by setting theflushparameter to true. Returns anoutputin which up to Size values are valid (at most a single flit).Arguments
-
multi_accumulating_buffer::buffer_index_t buffer_index
-
T[InputSize] valuesValues to enqueue.
-
count_t<InputSize> value_count
The number of entries in the values array that are valid. Must be between 0 and
InputSize, inclusive. -
bool flush
If true, return up to Size elements, even if the buffer is not yet full.
-
-
inline void enqueue_with_callback( multi_accumulating_buffer::buffer_index_t buffer_index, multi_accumulating_buffer::input_vec_t values, bool flush, ( index_t<FlitCount>, count_t<FlitCount>, vector<T, Size> ) -> void output_callback ) §
Write up to
InputSizevalues to a buffer. OnceFlitCountflits are accumulated for a given buffer thenoutput_callbackis called once per accumulated flit.Arguments
-
multi_accumulating_buffer::buffer_index_t buffer_index
Which buffer to append to.
-
multi_accumulating_buffer::input_vec_t values
Values to enqueue.
-
bool flush
If true, then call the callback for all buffer values associated with the buffer identified by
buffer_index. The caller must ensure that the number ofbuffered elements + values.size <= FlitCount * Sizewhen true. -
( index_t<FlitCount>, count_t<FlitCount>, vector<T, Size> ) -> void output_callback
Function which is called once per output flit.
-
Invariants
-
(InputSize <= Size)
A single call cannot appened more than
Sizeelements.
template <typename T, auto Size, auto InputSize = Size, auto FlitCount = 1> class accumulating_buffer §
A buffer that accumulates elements into flits (fixed-sized arrays of elements).
Parameters
-
typename TType of values stored in the accumulating buffer.
-
auto SizeMaximum number of elements that can be stored in a flit.
-
auto InputSize = SizeMaximum number of elements that can be appended to the buffer in one call.
-
auto FlitCount = 1
Maximum number of flits that can be stored. The output callback is called once for each
Sizeelements.
Aliases
-
using output = accumulating_buffer::buffer_t::output §
Return type for
enqueue. -
using input_vec_t = vector<T, InputSize> §
Methods
-
accumulating_buffer::output enqueue(T[InputSize] values, count_t<InputSize> value_count, bool flush) §
Write up to
InputSizevalues to the buffer. If there are now full flit of buffered data then the return structure will contain that flit. A caller can also explicitly retrieve a partial flit by setting theflushparameter to true. Returns anoutputin which up to Size values are valid (at most a single flit).Arguments
-
T[InputSize] valuesAn array of values to enqueue.
-
count_t<InputSize> value_count
The number of entries in the values array that are valid. Must be between 0 and
InputSize, inclusive. -
bool flush
If true, return up to Size elements, even if the buffer is not yet full.
-
-
inline void enqueue_with_callback( accumulating_buffer::input_vec_t values, bool flush, ( index_t<FlitCount>, count_t<FlitCount>, vector<T, Size> ) -> void output_callback ) §
Write up to
InputSizevalues to the buffer. OnceFlitCountflits are accumulated thenoutput_callbackis called once per accumulated flit.Arguments
-
accumulating_buffer::input_vec_t values
Values to enqueue.
-
bool flush
If true, then call the callback for all buffer values associated with the buffer identified by
buffer_index. -
( index_t<FlitCount>, count_t<FlitCount>, vector<T, Size> ) -> void output_callback
Function which is called once per output flit.
-
Invariants
-
(InputSize <= Size)
A single call cannot appened more than
Sizeelements.