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