Compute Graph Framework SDK Reference  5.16
SimpleNode.hpp
Go to the documentation of this file.
1
2//
3// Notice
4// ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8//
9// NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10// information or for any infringement of patents or other rights of third parties that may
11// result from its use. No license is granted by implication or otherwise under any patent
12// or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13// expressly authorized by NVIDIA. Details are subject to change without notice.
14// This code supersedes and replaces all information previously supplied.
15// NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16// components in life support devices or systems without express written approval of
17// NVIDIA CORPORATION & AFFILIATES.
18//
19// SPDX-FileCopyrightText: Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21//
22// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23// property and proprietary rights in and to this material, related
24// documentation and any modifications thereto. Any use, reproduction,
25// disclosure or distribution of this material and related documentation
26// without an express license agreement from NVIDIA CORPORATION or
27// its affiliates is strictly prohibited.
28//
30
31#ifndef DW_FRAMEWORK_SIMPLENODE_HPP_
32#define DW_FRAMEWORK_SIMPLENODE_HPP_
33
34#include <dw/core/base/Types.h>
35#include <dwcgf/Exception.hpp>
37#include <dwcgf/pass/Pass.hpp>
38#include <dwcgf/node/Node.hpp>
44
45#include <dwshared/dwfoundation/dw/core/container/BaseString.hpp>
46#include <dwshared/dwfoundation/dw/core/container/HashContainer.hpp>
47#include <dwshared/dwfoundation/dw/core/container/VectorFixed.hpp>
48#include <dwshared/dwfoundation/dw/core/language/Function.hpp>
49
50#include <memory>
51
52namespace dw
53{
54namespace framework
55{
56
58{
59public:
62 size_t maxInputPortCount_,
63 size_t maxOutputPortCount_,
64 size_t maxPassCount_)
65 : maxInputPortCount(maxInputPortCount_)
66 , maxOutputPortCount(maxOutputPortCount_)
67 , maxPassCount(maxPassCount_)
68 {
69 }
72 size_t maxPassCount{};
73};
74
75template <typename NodeT>
76// coverity[autosar_cpp14_a2_10_5_violation] FP: nvbugs/3907242
78{
80 portSize<NodeT, PortDirection::INPUT>(),
81 portSize<NodeT, PortDirection::OUTPUT>(),
82 passSize<NodeT>()};
83 return params;
84}
85
86class SimpleNode : public Node
87{
88public:
91
92 dwStatus reset() override
93 {
94 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::reset() not implemented");
95 }
96
98
101 dwStatus setInputChannel(ChannelObject* channel, size_t portID) override;
102
104
107 dwStatus setOutputChannel(ChannelObject* channel, size_t portID) override;
108
110 dwStatus getInputChannel(const size_t portID, ChannelObject*& channel) const override;
111
113 dwStatus getOutputChannel(const size_t portID, ChannelObject*& channel) const override;
114
115 dwStatus validate() override
116 {
117 throw ExceptionWithStatus(DW_NOT_IMPLEMENTED, "SimpleNode::validate() not implemented");
118 }
119
121
124 dwStatus validate(const char* direction, const PortCollectionDescriptor& collection, dw::core::Function<bool(size_t)> isPortBound);
125
126 dwStatus run() override;
127 size_t getPassCount() const noexcept override;
128 dwStatus runPass(size_t passIndex) override;
129 dwStatus getPass(Pass** pass, size_t index) override;
130 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
131 dwStatus getPasses(VectorFixed<Pass*>& passList) override;
132
133 dwStatus setName(const char* name) final;
134 dwStatus getName(const char** name) override;
135
136 dwStatus collectErrorSignals(dwGraphErrorSignal*& errorSignal, bool updateFromModule = true) override;
137 dwStatus getModuleErrorSignal(dwErrorSignal& errorSignal) override;
138 dwStatus getNodeErrorSignal(dwGraphErrorSignal& errorSignal) override;
139 dwStatus collectHealthSignals(dwGraphHealthSignal*& healthSignal, bool updateFromModule = false) override;
140 dwStatus getModuleHealthSignal(dwHealthSignal& healthSignal) override;
141 dwStatus getNodeHealthSignal(dwGraphHealthSignal& healthSignal) override;
142 dwStatus clearErrorSignal() override;
143 dwStatus clearHealthSignal() override;
144 dwStatus addToErrorSignal(uint32_t error, dwTime_t timestamp = 0L) final;
145 dwStatus addToHealthSignal(uint32_t error, dwTime_t timestamp = 0L) override;
146
147 template <typename Func, typename PortList>
148 void iteratePorts(PortList& portList, Func func)
149 {
150 for (auto& elem : portList)
151 {
152 func(elem);
153 }
154 }
155
156 template <typename Func>
158 {
159 iteratePorts(m_inputPorts, [&func, this](decltype(m_inputPorts)::TElement& elem) {
160 if (nullptr == elem.second.get())
161 {
162 const char* nodeName{nullptr};
163 this->getName(&nodeName);
164 throw ExceptionWithStatus(DW_NOT_INITIALIZED, "SimpleNode: input port not initialized, node ", nodeName, ", port id ", elem.first);
165 }
166 func(*elem.second);
167 });
168 }
169
170 template <typename Func>
172 {
173 iteratePorts(m_outputPorts, [&func, this](decltype(m_outputPorts)::TElement& elem) {
174 if (nullptr == elem.second.get())
175 {
176 const char* nodeName{nullptr};
177 this->getName(&nodeName);
178 throw ExceptionWithStatus(DW_NOT_INITIALIZED, "SimpleNode: output port not initialized, node ", nodeName, ", port id ", elem.first);
179 }
180 func(*elem.second);
181 });
182 }
183
184 template <typename ModuleHandle_t>
185 dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
186 {
187 dwModuleHandle_t moduleHandle;
188
189 if (DW_NULL_HANDLE == handle)
190 {
191 return DW_INVALID_ARGUMENT;
192 }
193
194 dwStatus ret{getModuleHandle(&moduleHandle, handle, context)};
195 if (DW_SUCCESS != ret)
196 {
197 return ret;
198 }
199
200 return setObjectHandle(moduleHandle);
201 }
202
203 virtual dwStatus setObjectHandle(dwModuleHandle_t handle);
204
206 dwStatus getInputPort(const size_t portID, dw::framework::PortBase*& port) const override;
207
209 dwStatus getOutputPort(const size_t portID, dw::framework::PortBase*& port) const override;
210
211protected:
212 dwStatus getModuleHandle(dwModuleHandle_t* moduleHandle, void* handle, dwContextHandle_t context);
213
215
221 template <
222 typename NodeT, size_t PassIndex, typename PassFunctionT>
223 void registerPass(PassFunctionT func, std::initializer_list<std::pair<dwStatus, uint32_t>> const& returnMapping = {})
224 {
225 // if the pass index is invalid the compilation will fail on passProcessorType() below
226 // no need to check with isValidPass<NodeT>(PassIndex) at runtime
227
228 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
229 if (0U == m_passList.size() || m_passList.size() - 1U < PassIndex)
230 {
231 // coverity[autosar_cpp14_a5_1_1_violation] RFD Accepted: TID-2056
232 m_passList.resize(PassIndex + 1U);
233 }
234 // coverity[autosar_cpp14_a5_1_1_violation] FP: nvbugs/3364868
235 if (nullptr != m_passList[PassIndex])
236 {
237 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "registerPass called with a pass id which has been added before: ", PassIndex);
238 }
239 dwProcessorType processorType{passProcessorType<NodeT, PassIndex>()};
240 // coverity[autosar_cpp14_a5_1_1_violation] FP: nvbugs/3364868
241 m_passList[PassIndex] = std::make_unique<PassImpl<PassFunctionT>>(*this, passName<NodeT, PassIndex>(), func, processorType, returnMapping);
242 }
243
245
248 template <
249 typename NodeT, size_t PassIndex, typename PassFunctionT>
250 void registerPass(PassFunctionT func, cudaStream_t const cudaStream, std::initializer_list<std::pair<dwStatus, uint32_t>> const& returnMapping = {})
251 {
252 static_assert(DW_PROCESSOR_TYPE_GPU == passProcessorType<NodeT, PassIndex>(), "The processor type of a pass with a cuda stream must be GPU");
253 registerPass<NodeT, PassIndex>(func, returnMapping);
254 m_passList[PassIndex]->m_cudaStream = cudaStream;
255 }
256
257public:
264
274
284
285protected:
287 {
288 return m_healthSignal;
289 }
290
291private:
292 VectorFixed<std::unique_ptr<Pass>> m_passList;
293 FixedString<MAX_NAME_LEN> m_name;
294 bool m_setupTeardownCreated;
295
297 dwGraphErrorSignal m_errorSignal;
298 dwGraphHealthSignal m_healthSignal;
299
300 dwModuleHandle_t m_object;
301 uint32_t m_iterationCount{};
302 uint32_t m_nodePeriod{};
303
304public:
306
309 template <typename NodeT, size_t PortIndex, typename... Args>
310 void initInputPort(Args&&... args)
311 {
312 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
313 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
314 std::shared_ptr<ManagedPortInput<DataType>> port{std::make_shared<ManagedPortInput<DataType>>(portName<NodeT, PortDirection::INPUT, PortIndex>(), std::forward<Args>(args)...)};
315 if (m_inputPorts.find(PortIndex) != m_inputPorts.end())
316 {
317 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id registered multiple times: ", PortIndex);
318 }
319 m_inputPorts[PortIndex] = port;
320 }
321
323
329 template <typename NodeT, size_t PortIndex, typename... Args>
330 void initInputArrayPorts(Args&&... args)
331 {
332 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
333 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
334 for (size_t i = 0; i < arraySize; ++i)
335 {
336 initInputArrayPort<NodeT, PortIndex>(i, std::forward<Args>(args)...);
337 }
338 }
339
341
346 template <typename NodeT, size_t PortIndex, typename... Args>
347 void initInputArrayPort(size_t arrayIndex, Args&&... args)
348 {
349 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
350 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
351 if (arrayIndex >= descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>())
352 {
353 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Invalid array index ", arrayIndex, " for array input port ", PortIndex);
354 }
355 std::shared_ptr<ManagedPortInput<DataType>> port{std::make_shared<ManagedPortInput<DataType>>(portName<NodeT, PortDirection::INPUT, PortIndex>(arrayIndex), std::forward<Args>(args)...)};
356 if (m_inputPorts.find(PortIndex + arrayIndex) != m_inputPorts.end())
357 {
358 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id registered multiple times: ", PortIndex + arrayIndex);
359 }
360 m_inputPorts[PortIndex + arrayIndex] = port;
361 }
362
364
367 template <typename NodeT, size_t PortIndex, typename... Args>
368 void initOutputPort(Args&&... args)
369 {
370 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
371 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
372 std::shared_ptr<ManagedPortOutput<DataType>> port{std::make_shared<ManagedPortOutput<DataType>>(portName<NodeT, PortDirection::OUTPUT, PortIndex>(), std::forward<Args>(args)...)};
373 if (m_outputPorts.find(PortIndex) != m_outputPorts.end())
374 {
375 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id registered multiple times: ", PortIndex);
376 }
377 m_outputPorts[PortIndex] = port;
378 }
379
381
387 template <typename NodeT, size_t PortIndex, typename... Args>
388 void initOutputArrayPorts(Args&&... args)
389 {
390 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
391 constexpr size_t arraySize{descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>()};
392 for (size_t i{0U}; i < arraySize; ++i)
393 {
394 initOutputArrayPort<NodeT, PortIndex>(i, std::forward<Args>(args)...);
395 }
396 }
397
399
404 template <typename NodeT, size_t PortIndex, typename... Args>
405 void initOutputArrayPort(size_t arrayIndex, Args&&... args)
406 {
407 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
408 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
409 if (arrayIndex >= descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>())
410 {
411 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Invalid array index ", arrayIndex, " for array output port ", PortIndex);
412 }
413 std::shared_ptr<ManagedPortOutput<DataType>> port{std::make_shared<ManagedPortOutput<DataType>>(portName<NodeT, PortDirection::OUTPUT, PortIndex>(arrayIndex), std::forward<Args>(args)...)};
414 if (m_outputPorts.find(PortIndex + arrayIndex) != m_outputPorts.end())
415 {
416 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id registered multiple times: ", PortIndex + arrayIndex);
417 }
418 m_outputPorts[PortIndex + arrayIndex] = port;
419 }
420
422 template <typename NodeT, size_t PortIndex>
424 {
425 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
426 constexpr bool isArray = descriptorPortArray<
427 NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
428 static_assert(!isArray, "Input port is an array, must pass an array index");
429 if (m_inputPorts.find(PortIndex) == m_inputPorts.end())
430 {
431 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id not registered: ", PortIndex);
432 }
433 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
434 using PointerType = ManagedPortInput<DataType>;
435 using ReturnType = std::shared_ptr<PointerType>;
436 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex]);
437 if (!port)
438 {
439 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following input port to its declared type: ", PortIndex);
440 }
441 return *port;
442 }
443
445 template <typename NodeT, size_t PortIndex>
447 {
448 static_assert(PortIndex < portSize<NodeT, PortDirection::INPUT>(), "Invalid port index");
449 constexpr bool isArray = descriptorPortArray<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
450 static_assert(isArray, "Input port is not an array, must not pass an array index");
451 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::INPUT, descriptorIndex<NodeT, PortDirection::INPUT, PortIndex>()>();
452 if (arrayIndex >= arraySize)
453 {
454 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "The array index is out of bound: ", arrayIndex);
455 }
456 if (m_inputPorts.find(PortIndex + arrayIndex) == m_inputPorts.end())
457 {
458 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Input port with the following id not registered: ", PortIndex + arrayIndex);
459 }
460 using DataType = decltype(portType<NodeT, PortDirection::INPUT, PortIndex>());
461 using PointerType = ManagedPortInput<DataType>;
462 using ReturnType = std::shared_ptr<PointerType>;
463 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_inputPorts[PortIndex + arrayIndex]);
464 if (!port)
465 {
466 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following input port to its declared type: ", PortIndex + arrayIndex);
467 }
468 return *port;
469 }
470
472 template <typename NodeT, size_t PortIndex>
474 {
475 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
476 constexpr bool isArray = descriptorPortArray<
477 NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
478 static_assert(!isArray, "Output port is an array, must pass an array index");
479 if (m_outputPorts.find(PortIndex) == m_outputPorts.end())
480 {
481 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id not registered: ", PortIndex);
482 }
483 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
484 using PointerType = ManagedPortOutput<DataType>;
485 using ReturnType = std::shared_ptr<PointerType>;
486 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex]);
487 if (!port)
488 {
489 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following output port to its declared type: ", PortIndex);
490 }
491 return *port;
492 }
493
495 template <typename NodeT, size_t PortIndex>
497 {
498 static_assert(PortIndex - portSize<NodeT, PortDirection::INPUT>() < portSize<NodeT, PortDirection::OUTPUT>(), "Invalid port index");
499 constexpr bool isArray = descriptorPortArray<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
500 static_assert(isArray, "Output port is not an array, must not pass an array index");
501 constexpr size_t arraySize = descriptorPortSize<NodeT, PortDirection::OUTPUT, descriptorIndex<NodeT, PortDirection::OUTPUT, PortIndex>()>();
502 if (arrayIndex >= arraySize)
503 {
504 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "The array index is out of bound: ", arrayIndex);
505 }
506 if (m_outputPorts.find(PortIndex + arrayIndex) == m_outputPorts.end())
507 {
508 throw ExceptionWithStatus(DW_INVALID_ARGUMENT, "Output port with the following id not registered: ", PortIndex + arrayIndex);
509 }
510 using DataType = decltype(portType<NodeT, PortDirection::OUTPUT, PortIndex>());
511 using PointerType = ManagedPortOutput<DataType>;
512 using ReturnType = std::shared_ptr<PointerType>;
513 ReturnType port = std::dynamic_pointer_cast<PointerType>(m_outputPorts[PortIndex + arrayIndex]);
514 if (!port)
515 {
516 throw ExceptionWithStatus(DW_BAD_CAST, "Failed to cast the following output port to its declared type: ", PortIndex + arrayIndex);
517 }
518 return *port;
519 }
520
522
526 dwStatus setup();
527
529
533 dwStatus teardown();
534
536
540 void resetPorts() override;
541
546 dwStatus setIterationCount(uint32_t iterationCount) override;
547
552 dwStatus setNodePeriod(uint32_t period) override;
553
554 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>>& getRegisteredInputPorts() const
555 {
556 return m_inputPorts;
557 }
558
559 const dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>>& getRegisteredOutputPorts() const
560 {
561 return m_outputPorts;
562 }
563
564 uint32_t getIterationCount() const;
565 uint32_t getNodePeriod() const;
570 dwStatus setState(const char* state) override
571 {
572 static_cast<void>(state);
573 return DW_SUCCESS;
574 }
575
576protected:
577 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortInputBase>> m_inputPorts;
578 dw::core::HeapHashMap<size_t, std::shared_ptr<ManagedPortOutputBase>> m_outputPorts;
579
580 std::atomic<bool> m_asyncResetFlag;
581};
582
583} // namespace framework
584} // namespace dw
585
586#endif // DW_FRAMEWORK_SIMPLENODE_HPP_
Basic error signal that gets reported only when there is an error.
Basic health signal that describes the health status of the graph.
Pass is a runnable describes the metadata of a pass.
Definition: Pass.hpp:50
dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortInputBase > > m_inputPorts
Definition: SimpleNode.hpp:577
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >())> & getOutputPort(size_t arrayIndex)
Get one specific ManagedPortOutput from a previously initialized output array port.
Definition: SimpleNode.hpp:496
dwStatus getOutputChannel(const size_t portID, ChannelObject *&channel) const override
Gets the output channel associated with the output port.
dwStatus getInputPort(const size_t portID, dw::framework::PortBase *&port) const override
Gets the input port associated with the input port Id.
void initOutputArrayPorts(Args &&... args)
Initialize an array of ManagedPortOutput which will be owned by the base class and can be retrieved u...
Definition: SimpleNode.hpp:388
dwStatus reset() override
Definition: SimpleNode.hpp:92
void iterateManagedInputPorts(Func func)
Definition: SimpleNode.hpp:157
dwStatus setNodePeriod(uint32_t period) override
dwStatus validate() override
Definition: SimpleNode.hpp:115
void initInputPort(Args &&... args)
Initialize a ManagedPortInput which will be owned by the base class and can be retrieved using getInp...
Definition: SimpleNode.hpp:310
dwStatus updateHealthSignal(const dwGraphHealthSignal &signal)
Adds the provided Health Signal to the Health Signal Array. If the array is full, the new signal will...
dwStatus addToHealthSignal(uint32_t error, dwTime_t timestamp=0L) override
uint32_t getNodePeriod() const
dwStatus getPass(Pass **pass, size_t index) override
dwStatus setInputChannel(ChannelObject *channel, size_t portID) override
Associate an input port with a channel instances.
SimpleNode(NodeAllocationParams params)
Constructor which tailors the preallocated size of the internal collections for ports and passes to t...
void initOutputArrayPort(size_t arrayIndex, Args &&... args)
Initialize one ManagedPortOutput of an array which will be owned by the base class and can be retriev...
Definition: SimpleNode.hpp:405
dwStatus setOutputChannel(ChannelObject *channel, size_t portID) override
Associate an output port with a channel instances.
size_t getPassCount() const noexcept override
dwStatus clearHealthSignal() override
dwStatus setName(const char *name) final
const dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortOutputBase > > & getRegisteredOutputPorts() const
Definition: SimpleNode.hpp:559
uint32_t getIterationCount() const
dwStatus getInputChannel(const size_t portID, ChannelObject *&channel) const override
Gets the input channel associated with the input port.
dwStatus setModuleHandle(ModuleHandle_t handle, dwContextHandle_t context)
Definition: SimpleNode.hpp:185
dwStatus updateCurrentErrorSignal(dwGraphErrorSignal &signal) override
A function that allows user override to update error signal It is automatically called by dwFramework...
const dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortInputBase > > & getRegisteredInputPorts() const
Definition: SimpleNode.hpp:554
void iterateManagedOutputPorts(Func func)
Definition: SimpleNode.hpp:171
dwStatus run() override
dwStatus getNodeErrorSignal(dwGraphErrorSignal &errorSignal) override
void resetPorts() override
Default implementation to reset ports managed by the base class.
dwStatus getNodeHealthSignal(dwGraphHealthSignal &healthSignal) override
dwStatus setState(const char *state) override
Definition: SimpleNode.hpp:570
dwStatus getOutputPort(const size_t portID, dw::framework::PortBase *&port) const override
Gets the output port associated with the output port Id.
dwStatus getName(const char **name) override
dwStatus runPass(size_t passIndex) override
dwStatus collectHealthSignals(dwGraphHealthSignal *&healthSignal, bool updateFromModule=false) override
void registerPass(PassFunctionT func, cudaStream_t const cudaStream, std::initializer_list< std::pair< dwStatus, uint32_t > > const &returnMapping={})
Register a GPU pass function and a cuda stream with the node base class.
Definition: SimpleNode.hpp:250
void registerPass(PassFunctionT func, std::initializer_list< std::pair< dwStatus, uint32_t > > const &returnMapping={})
Register a pass function with the node base class.
Definition: SimpleNode.hpp:223
dwStatus getPasses(VectorFixed< Pass * > &passList) override
dwStatus getModuleHandle(dwModuleHandle_t *moduleHandle, void *handle, dwContextHandle_t context)
dwStatus setup()
Default implementation of the setup pass.
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >())> & getInputPort()
Get a previously initialized non-array ManagedPortInput.
Definition: SimpleNode.hpp:423
void initOutputPort(Args &&... args)
Initialize a ManagedPortOutput which will be owned by the base class and can be retrieved using getOu...
Definition: SimpleNode.hpp:368
void iteratePorts(PortList &portList, Func func)
Definition: SimpleNode.hpp:148
void initInputArrayPort(size_t arrayIndex, Args &&... args)
Initialize one ManagedPortInput of an array which will be owned by the base class and can be retrieve...
Definition: SimpleNode.hpp:347
void initInputArrayPorts(Args &&... args)
Initialize an array of ManagedPortInput which will be owned by the base class and can be retrieved us...
Definition: SimpleNode.hpp:330
dwGraphHealthSignal & getHealthSignal()
Definition: SimpleNode.hpp:286
virtual dwStatus setObjectHandle(dwModuleHandle_t handle)
dwStatus updateCurrentHealthSignal(dwGraphHealthSignal &signal) override
A function that allows user override to update health signal It is automatically called by dwFramewor...
ManagedPortInput< decltype(portType< NodeT, PortDirection::INPUT, PortIndex >())> & getInputPort(size_t arrayIndex)
Get one specific ManagedPortInput from a previously initialized input array port.
Definition: SimpleNode.hpp:446
dwStatus teardown()
Default implementation of the teardown pass.
dwStatus validate(const char *direction, const PortCollectionDescriptor &collection, dw::core::Function< bool(size_t)> isPortBound)
Helper function used by dw::framework::SimpleNodeT::validate.
dwStatus clearErrorSignal() override
dwStatus setIterationCount(uint32_t iterationCount) override
dwStatus getModuleErrorSignal(dwErrorSignal &errorSignal) override
dwStatus getModuleHealthSignal(dwHealthSignal &healthSignal) override
std::atomic< bool > m_asyncResetFlag
Definition: SimpleNode.hpp:580
dwStatus addToErrorSignal(uint32_t error, dwTime_t timestamp=0L) final
dw::core::HeapHashMap< size_t, std::shared_ptr< ManagedPortOutputBase > > m_outputPorts
Definition: SimpleNode.hpp:578
dwStatus collectErrorSignals(dwGraphErrorSignal *&errorSignal, bool updateFromModule=true) override
ManagedPortOutput< decltype(portType< NodeT, PortDirection::OUTPUT, PortIndex >())> & getOutputPort()
Get a previously initialized non-array ManagedPortOutput.
Definition: SimpleNode.hpp:473
constexpr bool descriptorPortArray()
constexpr size_t descriptorPortSize()
constexpr size_t passIndex(dw::core::StringView identifier)
Get the the pass index for a pass identified by name.
NodeAllocationParams createAllocationParams()
Definition: SimpleNode.hpp:77
Definition: Buffer.hpp:40
NodeAllocationParams(size_t maxInputPortCount_, size_t maxOutputPortCount_, size_t maxPassCount_)
Definition: SimpleNode.hpp:61