1 /** 2 * Copyright 2019-2020 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 17 #ifndef MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_GE_RUNTIME_DAVINCI_MODEL_H_ 18 #define MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_GE_RUNTIME_DAVINCI_MODEL_H_ 19 20 #include <memory> 21 #include <vector> 22 #include "runtime/device/ascend/ge_runtime/task_info.h" 23 24 namespace mindspore::ge::model_runner { 25 class DavinciModel { 26 public: 27 DavinciModel(const std::vector<std::shared_ptr<TaskInfo>> &task_info_list, 28 const std::vector<uint32_t> &wait_active_stream_list, 29 const std::vector<uint32_t> &force_copy_stream_list, uint64_t mem_size = 0, uint64_t weight_size = 0, 30 uint64_t var_size = 0, uintptr_t logic_mem_base = 0, uintptr_t logic_weight_base = 0, 31 uintptr_t logic_var_base = 0, uint32_t stream_num = 0, uint32_t batch_num = 0, uint32_t event_num = 0, 32 int32_t priority = 0) task_info_list_(task_info_list)33 : task_info_list_(task_info_list), 34 wait_active_stream_list_(wait_active_stream_list), 35 force_copy_stream_list_(force_copy_stream_list), 36 mem_size_(mem_size), 37 weight_size_(weight_size), 38 var_size_(var_size), 39 logic_mem_base_(logic_mem_base), 40 logic_weight_base_(logic_weight_base), 41 logic_var_base_(logic_var_base), 42 stream_num_(stream_num), 43 batch_num_(batch_num), 44 event_num_(event_num), 45 priority_(priority) {} ~DavinciModel()46 ~DavinciModel() {} 47 GetMemSize()48 uint64_t GetMemSize() const { return mem_size_; } GetWeightSize()49 uint64_t GetWeightSize() const { return weight_size_; } GetVarSize()50 uint64_t GetVarSize() const { return var_size_; } 51 GetLogicMemBase()52 uintptr_t GetLogicMemBase() const { return logic_mem_base_; } GetLogicWeightBase()53 uintptr_t GetLogicWeightBase() const { return logic_weight_base_; } GetLogicVarBase()54 uintptr_t GetLogicVarBase() const { return logic_var_base_; } 55 GetStreamNum()56 uint32_t GetStreamNum() const { return stream_num_; } GetBatchNum()57 uint32_t GetBatchNum() const { return batch_num_; } GetEventNum()58 uint32_t GetEventNum() const { return event_num_; } 59 GetWaitActiveStreams()60 const std::vector<uint32_t> &GetWaitActiveStreams() const { return wait_active_stream_list_; } GetForceCopyStreams()61 const std::vector<uint32_t> &GetForceCopyStreams() const { return force_copy_stream_list_; } 62 GetPriority()63 int32_t GetPriority() const { return priority_; } 64 GetTaskInfoList()65 const std::vector<std::shared_ptr<TaskInfo>> &GetTaskInfoList() const { return task_info_list_; } 66 67 private: 68 std::vector<std::shared_ptr<TaskInfo>> task_info_list_; 69 70 std::vector<uint32_t> wait_active_stream_list_; 71 std::vector<uint32_t> force_copy_stream_list_; 72 73 uint64_t mem_size_; 74 uint64_t weight_size_; 75 uint64_t var_size_; 76 77 uintptr_t logic_mem_base_; 78 uintptr_t logic_weight_base_; 79 uintptr_t logic_var_base_; 80 81 uint32_t stream_num_; 82 uint32_t batch_num_; 83 uint32_t event_num_; 84 85 int32_t priority_; 86 87 // Disable to copy constructor and assignment operator 88 DavinciModel &operator=(const DavinciModel &) = delete; 89 DavinciModel(const DavinciModel &) = delete; 90 }; 91 } // namespace mindspore::ge::model_runner 92 #endif // MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_GE_RUNTIME_DAVINCI_MODEL_H_ 93