2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __ONERT_BACKEND_IMEMORY_PLANNER_H__
18 #define __ONERT_BACKEND_IMEMORY_PLANNER_H__
20 #include "ir/OperandIndexMap.h"
30 * @brief Structure to have memory offset and size
39 * @brief Interface to plan memory
43 using MemoryPlans = ir::OperandIndexMap<Block>;
46 * @brief Claim memory for operand
47 * @param[in] index The operand index
48 * @param[in] size The size of the memory
50 virtual void claim(const ir::OperandIndex &, size_t) = 0;
52 * @brief Release memory for operand
53 * @param[in] index The operand index
55 virtual void release(const ir::OperandIndex &) = 0;
57 * @brief Get capacity for memory planning
58 * @return The value of capacity
60 virtual uint32_t capacity() = 0;
62 * @brief Get MemoryPlans
65 virtual MemoryPlans &memory_plans() = 0;
67 virtual ~IMemoryPlanner() = default;
70 } // namespace cpu_common
71 } // namespace backend
74 #endif // __ONERT_BACKEND_IMEMORY_PLANNER_H__