/home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/variableSize/mpsc/nonlocking/producer.hpp Source File

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/variableSize/mpsc/nonlocking/producer.hpp Source File
HiCR
producer.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 Huawei Technologies Co., Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
24#pragma once
25
27#include <utility>
28
29namespace HiCR::channel::variableSize::MPSC::nonlocking
30{
31
39{
40 public:
41
63 Producer(CommunicationManager &coordinationCommunicationManager,
64 CommunicationManager &payloadCommunicationManager,
65 std::shared_ptr<LocalMemorySlot> sizeInfoBuffer,
66 std::shared_ptr<GlobalMemorySlot> payloadBuffer,
67 std::shared_ptr<GlobalMemorySlot> tokenBuffer,
68 const std::shared_ptr<LocalMemorySlot> &internalCoordinationBufferForCounts,
69 const std::shared_ptr<LocalMemorySlot> &internalCoordinationBufferForPayloads,
70 std::shared_ptr<GlobalMemorySlot> consumerCoordinationBufferForCounts,
71 std::shared_ptr<GlobalMemorySlot> consumerCoordinationBufferForPayloads,
72 const size_t payloadCapacity,
73 const size_t payloadSize,
74 const size_t capacity)
75 : variableSize::SPSC::Producer(coordinationCommunicationManager,
76 payloadCommunicationManager,
77 std::move(sizeInfoBuffer),
78 std::move(payloadBuffer),
79 std::move(tokenBuffer),
80 internalCoordinationBufferForCounts,
81 internalCoordinationBufferForPayloads,
82 std::move(consumerCoordinationBufferForCounts),
83 std::move(consumerCoordinationBufferForPayloads),
84 payloadCapacity,
85 payloadSize,
86 capacity)
87 {}
88 ~Producer() = default;
89};
90
91} // namespace HiCR::channel::variableSize::MPSC::nonlocking
Definition communicationManager.hpp:54
Producer(CommunicationManager &coordinationCommunicationManager, CommunicationManager &payloadCommunicationManager, std::shared_ptr< LocalMemorySlot > sizeInfoBuffer, std::shared_ptr< GlobalMemorySlot > payloadBuffer, std::shared_ptr< GlobalMemorySlot > tokenBuffer, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBufferForCounts, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBufferForPayloads, std::shared_ptr< GlobalMemorySlot > consumerCoordinationBufferForCounts, std::shared_ptr< GlobalMemorySlot > consumerCoordinationBufferForPayloads, const size_t payloadCapacity, const size_t payloadSize, const size_t capacity)
Definition producer.hpp:63
Provides functionality for a var-size SPSC producer channel.