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_AICPU_TASK_H_ 18 #define MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_GE_RUNTIME_AICPU_TASK_H_ 19 20 #include <vector> 21 #include <memory> 22 #include <string> 23 #include "runtime/device/ascend/ge_runtime/task/task.h" 24 25 namespace mindspore::ge::model_runner { 26 class AicpuTask : public TaskRepeater<AicpuTaskInfo> { 27 public: 28 AicpuTask(const ModelContext &model_context, const std::shared_ptr<AicpuTaskInfo> &task_info); 29 30 ~AicpuTask() override; 31 32 void Distribute() override; 33 Args()34 void *Args() override { return input_output_addr_; } 35 task_name()36 std::string task_name() const override { return task_info_->op_name(); } 37 38 private: 39 static void ReleaseRtMem(void **ptr) noexcept; 40 void SetAicpuParamHead(uint32_t args_size, uint32_t io_addrs_num); 41 void SetInputOutputAddrs(const std::vector<void *> &io_addrs, uint32_t io_addr_offset); 42 void SetNodeDef(uint32_t node_def_len_offset, uint32_t node_def_addr_offset); 43 44 std::shared_ptr<AicpuTaskInfo> task_info_; 45 void *stream_; 46 void *args_; 47 void *ext_info_; 48 void *input_output_addr_; 49 }; 50 } // namespace mindspore::ge::model_runner 51 #endif // MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_GE_RUNTIME_AICPU_TASK_H_ 52