Line data Source code
1 : // SPDX-License-Identifier: Apache-2.0
2 : /**
3 : * Copyright (C) 2023 Jijoong Moon <jijoong.moon@samsung.com>
4 : *
5 : * @file optimzied_v3_planner.h
6 : * @date 2 January 2023
7 : * @see https://github.com/nnstreamer/nntrainer
8 : * @author Jijoong Moon <jijoong.moon@samsung.com>
9 : * @bug No known bugs except for NYI items
10 : * @brief This is Optimized V3 Memory Planner
11 : *
12 : *
13 : */
14 :
15 : #ifndef __OPTIMIZED_V3_PLANNER_H_
16 : #define __OPTIMIZED_V3_PLANNER_H_
17 :
18 : #include <vector>
19 :
20 : #include <memory_planner.h>
21 :
22 : namespace nntrainer {
23 :
24 : /**
25 : * @class OptimizedV3Planner
26 : * @brief Optimized V3 Memory Planner provides the optimized plan for memory
27 : * layout
28 : * @details optimized planner performs sharing of overlapping memory sharing
29 : * upto certain extent
30 : */
31 : class OptimizedV3Planner : public MemoryPlanner {
32 : public:
33 : /**
34 : * @brief OptimizedV3Planner destructor
35 : *
36 : */
37 : OptimizedV3Planner() = default;
38 :
39 : /**
40 : * @copydoc MemoryPlanner::planLayout(
41 : * const std::vector<size_t> &memory_size,
42 : * const std::vector<std::pair<unsigned int, unsigned int>> &memory_validity,
43 : * std::vector<size_t> &memory_offset,
44 : * std::vector<bool> &memory_is_wgrad);
45 : *
46 : */
47 : size_t planLayout(
48 : const std::vector<size_t> &memory_size,
49 : const std::vector<std::pair<unsigned int, unsigned int>> &memory_validity,
50 : std::vector<size_t> &memory_offset, std::vector<bool> &memory_is_wgrad,
51 : size_t n_wgrad = 0) const;
52 :
53 : /**
54 : * @copydoc MemoryPlanner::getType() const
55 : *
56 : */
57 0 : const std::string getType() const { return type; }
58 :
59 : static constexpr const char *type = "optimized_v3_planner";
60 : };
61 :
62 : } // namespace nntrainer
63 :
64 : #endif /** __OPTIMIZED_V3_PLANNER_H_ */
|