From 9b35666be531173d8cd6d9b5a948d19065a243cf Mon Sep 17 00:00:00 2001 From: l00444296 Date: Fri, 23 Oct 2020 18:02:55 +0800 Subject: [PATCH 01/27] DTS:DTS2020101202436 Description:Support model_exit in GE Team:HISI_SW Feature or Bugfix:Feature --- ge/CMakeLists.txt | 2 + ge/common/types.cc | 1 + ge/executor/CMakeLists.txt | 1 + ge/executor/module.mk | 1 + ge/ge_inference.mk | 1 + ge/ge_runner.mk | 1 + .../task_info/model_exit_task_info.cc | 54 ++++++++++++++++++++++ .../task_info/model_exit_task_info.h | 37 +++++++++++++++ ge/graph/passes/flow_ctrl_pass.cc | 40 ++++++++++++++-- ge/graph/passes/flow_ctrl_pass.h | 8 ++++ inc/framework/common/types.h | 1 + tests/ut/ge/CMakeLists.txt | 1 + 12 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 ge/graph/load/new_model_manager/task_info/model_exit_task_info.cc create mode 100644 ge/graph/load/new_model_manager/task_info/model_exit_task_info.h diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index fa315516..321e0565 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -88,6 +88,7 @@ set(TRAIN_SRC_LIST "graph/load/new_model_manager/model_utils.cc" "graph/load/new_model_manager/aipp_utils.cc" "graph/load/new_model_manager/task_info/end_graph_task_info.cc" + "graph/load/new_model_manager/task_info/model_exit_task_info.cc" "graph/load/new_model_manager/task_info/event_record_task_info.cc" "graph/load/new_model_manager/task_info/event_wait_task_info.cc" "graph/load/new_model_manager/task_info/fusion_start_task_info.cc" @@ -621,6 +622,7 @@ set(INFER_SRC_LIST "graph/load/new_model_manager/task_info/stream_switch_task_info.cc" "graph/load/new_model_manager/task_info/stream_switchn_task_info.cc" "graph/load/new_model_manager/task_info/end_graph_task_info.cc" + "graph/load/new_model_manager/task_info/model_exit_task_info.cc" "graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" "graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" "single_op/task/op_task.cc" diff --git a/ge/common/types.cc b/ge/common/types.cc index 8baf288a..0d10f8b3 100755 --- a/ge/common/types.cc +++ b/ge/common/types.cc @@ -398,6 +398,7 @@ REGISTER_OPTYPE_DEFINE(MEMCPYASYNC, "MemcpyAsync"); REGISTER_OPTYPE_DEFINE(MEMCPYADDRASYNC, "MemcpyAddrAsync"); REGISTER_OPTYPE_DEFINE(STREAMMERGE, "StreamMerge"); REGISTER_OPTYPE_DEFINE(ENDGRAPH, "EndGraph"); +REGISTER_OPTYPE_DEFINE(MODELEXIT, "ModelExit"); REGISTER_OPTYPE_DEFINE(SEND, "Send"); REGISTER_OPTYPE_DEFINE(RECV, "Recv"); REGISTER_OPTYPE_DEFINE(ENDOFSEQUENCE, "EndOfSequence"); diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 684e49b3..f8a0822e 100755 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -58,6 +58,7 @@ set(SRC_LIST "../graph/load/new_model_manager/task_info/stream_switch_task_info.cc" "../graph/load/new_model_manager/task_info/stream_switchn_task_info.cc" "../graph/load/new_model_manager/task_info/end_graph_task_info.cc" + "../graph/load/new_model_manager/task_info/model_exit_task_info.cc" "../graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" "../graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" "../opskernel_manager/ops_kernel_builder_manager.cc" diff --git a/ge/executor/module.mk b/ge/executor/module.mk index c6831077..27280be7 100755 --- a/ge/executor/module.mk +++ b/ge/executor/module.mk @@ -48,6 +48,7 @@ local_ge_executor_src_files := \ ../graph/load/new_model_manager/task_info/stream_switch_task_info.cc \ ../graph/load/new_model_manager/task_info/stream_switchn_task_info.cc \ ../graph/load/new_model_manager/task_info/end_graph_task_info.cc \ + ../graph/load/new_model_manager/task_info/model_exit_task_info.cc \ ../graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc \ ../graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc \ ../opskernel_manager/ops_kernel_builder_manager.cc \ diff --git a/ge/ge_inference.mk b/ge/ge_inference.mk index ac106346..11c5eea0 100755 --- a/ge/ge_inference.mk +++ b/ge/ge_inference.mk @@ -247,6 +247,7 @@ OME_HOST_SRC_FILES := \ graph/load/new_model_manager/task_info/stream_switch_task_info.cc \ graph/load/new_model_manager/task_info/stream_switchn_task_info.cc \ graph/load/new_model_manager/task_info/end_graph_task_info.cc \ + graph/load/new_model_manager/task_info/model_exit_task_info.cc \ graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc \ graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc \ single_op/task/op_task.cc \ diff --git a/ge/ge_runner.mk b/ge/ge_runner.mk index 6c448a46..504d1e56 100644 --- a/ge/ge_runner.mk +++ b/ge/ge_runner.mk @@ -61,6 +61,7 @@ LIBGE_LOCAL_SRC_FILES := \ graph/load/new_model_manager/model_utils.cc \ graph/load/new_model_manager/aipp_utils.cc \ graph/load/new_model_manager/task_info/end_graph_task_info.cc \ + graph/load/new_model_manager/task_info/model_exit_task_info.cc \ graph/load/new_model_manager/task_info/event_record_task_info.cc \ graph/load/new_model_manager/task_info/event_wait_task_info.cc \ graph/load/new_model_manager/task_info/fusion_start_task_info.cc \ diff --git a/ge/graph/load/new_model_manager/task_info/model_exit_task_info.cc b/ge/graph/load/new_model_manager/task_info/model_exit_task_info.cc new file mode 100644 index 00000000..ff8057aa --- /dev/null +++ b/ge/graph/load/new_model_manager/task_info/model_exit_task_info.cc @@ -0,0 +1,54 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "graph/load/new_model_manager/task_info/model_exit_task_info.h" + +#include "common/properties_manager.h" +#include "framework/common/debug/ge_log.h" +#include "graph/load/new_model_manager/davinci_model.h" + +namespace ge { +Status ModelExitTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davinci_model) { + GELOGI("InitModelExitTaskInfo Init Start."); + if (davinci_model == nullptr) { + GELOGE(PARAM_INVALID, "davinci_model is null!"); + return PARAM_INVALID; + } + + Status ret = SetStream(task_def.stream_id(), davinci_model->GetStreamList()); + if (ret != SUCCESS) { + GELOGE(ret, "SetStream fail, stream_id:%u", task_def.stream_id()); + return ret; + } + + model_ = davinci_model->GetRtModelHandle(); + GELOGI("InitModelExitTaskInfo Init Success, model:%p, stream:%p", model_, stream_); + return SUCCESS; +} + +Status ModelExitTaskInfo::Distribute() { + GELOGI("ModelExitTaskInfo Distribute Start."); + rtError_t rt_ret = rtModelExit(model_, stream_); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "Call rtModelExit failed, ret: 0x%x", rt_ret); + return RT_ERROR_TO_GE_STATUS(rt_ret); + } + GELOGI("ModelExitTaskInfo Distribute Success."); + return SUCCESS; +} + +REGISTER_TASK_INFO(RT_MODEL_TASK_MODEL_EXIT, ModelExitTaskInfo); +} // namespace ge diff --git a/ge/graph/load/new_model_manager/task_info/model_exit_task_info.h b/ge/graph/load/new_model_manager/task_info/model_exit_task_info.h new file mode 100644 index 00000000..c219fcc8 --- /dev/null +++ b/ge/graph/load/new_model_manager/task_info/model_exit_task_info.h @@ -0,0 +1,37 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_MODEL_EXIT_TASK_INFO_H_ +#define GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_MODEL_EXIT_TASK_INFO_H_ + +#include "graph/load/new_model_manager/task_info/task_info.h" + +namespace ge { +class ModelExitTaskInfo : public TaskInfo { + public: + ModelExitTaskInfo() {} + + ~ModelExitTaskInfo() override { model_ = nullptr; } + + Status Init(const domi::TaskDef &task_def, DavinciModel *davinci_model) override; + + Status Distribute() override; + + private: + rtModel_t model_{nullptr}; +}; +} // namespace ge +#endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_TASK_INFO_MODEL_EXIT_TASK_INFO_H_ diff --git a/ge/graph/passes/flow_ctrl_pass.cc b/ge/graph/passes/flow_ctrl_pass.cc index 23e14b43..10ad1c2a 100755 --- a/ge/graph/passes/flow_ctrl_pass.cc +++ b/ge/graph/passes/flow_ctrl_pass.cc @@ -84,6 +84,22 @@ Status FlowCtrlPass::Run(ComputeGraphPtr compute_graph) { return graph_change ? SUCCESS : NOT_CHANGED; } +bool FlowCtrlPass::CheckMultiDataSet(ComputeGraphPtr &compute_graph) { + int data_set_num = 0; + for (auto &node : compute_graph->GetDirectNode()) { + if (node == nullptr) { + continue; + } + string type; + bool is_found = AttrUtils::GetStr(node->GetOpDesc(), ATTR_NAME_FRAMEWORK_ORIGINAL_TYPE, type); + if (is_found && type == "IteratorV2") { + data_set_num++; + } + } + GELOGI("The ComputeGraph contain %d dataSet.", data_set_num); + return (data_set_num > 1) ? true : false; +} + NodePtr FlowCtrlPass::InsertOp(ComputeGraphPtr &compute_graph, const string &node_type, const string &node_name, const std::vector &input_list, const std::vector &output_list) { @@ -310,12 +326,12 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c * loopCond * | * v - * switch --> Assign + * switch --> Assign --> ModelExit * ^ * | * loopReset */ - // Insert Assign node + // Insert Assign node and ctrl edge NodePtr assign_node = InsertAssignOp(compute_graph, ASSIGN, NODE_NAME_FLOWCTRL_LOOP_ASSIGN, loop_cond_node, loop_reset_node); if (assign_node == nullptr || switch_node == nullptr) { @@ -325,13 +341,31 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c GE_CHK_STATUS_RET(SetStreamLabel(assign_node, switch_node->GetName()), "set stream label failed"); - // 3. Insert ctrl edges graphStatus add_ret = GraphUtils::AddEdge(switch_node->GetOutControlAnchor(), assign_node->GetInControlAnchor()); if (add_ret != GRAPH_SUCCESS) { GELOGE(FAILED, "Add switch_node to assign_node ctrl edge failed, add_ret=%u.", add_ret); return FAILED; } + // 2. Insert model exit node and add ctrl edge + if (CheckMultiDataSet(compute_graph)) { + GELOGI("Multi dataSae exist, model_exit node is need."); + string model_exit_name = switch_node->GetName() + "_ModelExit"; + NodePtr model_exit_node = InsertOp(compute_graph, MODELEXIT, model_exit_name, {}, {}); + if (model_exit_node == nullptr) { + GELOGE(FAILED, "Insert model_exit node:%s for IterCtrlTrueStream failed.", model_exit_name.c_str()); + return FAILED; + } + // Must set same stream label with assign_node + GE_CHK_STATUS_RET(SetStreamLabel(model_exit_node, switch_node->GetName()), "set stream label failed"); + + add_ret = GraphUtils::AddEdge(assign_node->GetOutControlAnchor(), model_exit_node->GetInControlAnchor()); + if (add_ret != GRAPH_SUCCESS) { + GELOGE(FAILED, "Add assign_node to model_exit_node ctrl edge failed, add_ret=%u.", add_ret); + return FAILED; + } + } + GELOGI("CreateIterCtrlFalseBranch success."); return SUCCESS; } diff --git a/ge/graph/passes/flow_ctrl_pass.h b/ge/graph/passes/flow_ctrl_pass.h index d01dcd44..35270946 100755 --- a/ge/graph/passes/flow_ctrl_pass.h +++ b/ge/graph/passes/flow_ctrl_pass.h @@ -134,6 +134,14 @@ class FlowCtrlPass : public GraphPass { /// Other: failed /// Status AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr &loop_after_node); + + /// + /// add special iterator ctrl nodes(small cycle). + /// @param compute_graph graph + /// @return true: two or more dataSet exist + /// false: only one dataSet exist + /// + bool CheckMultiDataSet(ComputeGraphPtr &compute_graph); }; } // namespace ge diff --git a/inc/framework/common/types.h b/inc/framework/common/types.h index 91c68434..0644b0f2 100644 --- a/inc/framework/common/types.h +++ b/inc/framework/common/types.h @@ -449,6 +449,7 @@ REGISTER_OPTYPE_DECLARE(MEMCPYASYNC, "MemcpyAsync"); REGISTER_OPTYPE_DECLARE(MEMCPYADDRASYNC, "MemcpyAddrAsync"); REGISTER_OPTYPE_DECLARE(STREAMMERGE, "StreamMerge"); REGISTER_OPTYPE_DECLARE(ENDGRAPH, "EndGraph"); +REGISTER_OPTYPE_DECLARE(MODELEXIT, "ModelExit"); REGISTER_OPTYPE_DECLARE(SEND, "Send"); REGISTER_OPTYPE_DECLARE(RECV, "Recv"); REGISTER_OPTYPE_DECLARE(ENDOFSEQUENCE, "EndOfSequence"); diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 2e3edfd5..541df9a7 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -190,6 +190,7 @@ file(GLOB_RECURSE DISTINCT_GRAPH_LOAD_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR} "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/stream_active_task_info.cc" "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/stream_switch_task_info.cc" "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/end_graph_task_info.cc" + "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/model_exit_task_info.cc" "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" "${GE_SOURCE_DIR}/src/ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" "${GE_SOURCE_DIR}/src/ge/graph/load/output/output.cc" From 57c208f5a7b84a892882e7d7bb089ce44e1fbd4d Mon Sep 17 00:00:00 2001 From: l00444296 Date: Sat, 24 Oct 2020 11:47:05 +0800 Subject: [PATCH 02/27] DTS:DTS2020101202436 Description:Support model_exit in GE Team:HISI_SW Feature or Bugfix:Feature --- third_party/fwkacllib/inc/runtime/base.h | 13 ++++++++----- third_party/fwkacllib/inc/runtime/rt_model.h | 29 +++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/third_party/fwkacllib/inc/runtime/base.h b/third_party/fwkacllib/inc/runtime/base.h index ea32c164..a8341e32 100644 --- a/third_party/fwkacllib/inc/runtime/base.h +++ b/third_party/fwkacllib/inc/runtime/base.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_BASE_H__ #define __CCE_RUNTIME_BASE_H__ @@ -100,6 +100,9 @@ typedef enum tagRtError { RT_ERROR_MODEL_ID, RT_ERROR_MODEL_EXE_FAILED, RT_ERROR_END_OF_SEQUENCE, // end of sequence + RT_ERROR_MODEL_EXIT, + RT_ERROR_MODEL_EXIT_STREAM_UNBIND, + RT_ERROR_MODEL_EXIT_ID, RT_ERROR_EVENT_BASE = 0x07050000, RT_ERROR_EVENT_NULL, diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 59a1ba7d..78bb2321 100644 --- a/third_party/fwkacllib/inc/runtime/rt_model.h +++ b/third_party/fwkacllib/inc/runtime/rt_model.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_MODEL_H__ #define __CCE_RUNTIME_MODEL_H__ @@ -49,6 +49,7 @@ typedef enum tagModelTaskType { RT_MODEL_TASK_MEMCPY_ADDR_ASYNC, RT_MODEL_TASK_STREAM_LABEL_SWITCH_BY_INDEX, RT_MODEL_TASK_STREAM_LABEL_GOTO, + RT_MODEL_TASK_MODEL_EXIT, } rtModelTaskType_t; typedef enum tagModelStreamType { @@ -224,6 +225,13 @@ typedef struct tagrtModelEndGraphTaskInfo { uint32_t reserved[8]; } rtModelEndGraphTaskInfo_t; +typedef struct tagrtModelExitInfo { + uint32_t modelId; + uint32_t streamId; + uint32_t reserved[8]; +} rtModelExitTaskInfo_t; + + typedef struct tagrtStreamLabelSwitchByIndexTask_t { uint64_t indexPtr; uint64_t labelInfoPtr; @@ -256,6 +264,7 @@ typedef struct tagTaskInfo { rtRdmaSendTaskInfo_t rdmaSendTask; rtRdmaDbSendTaskInfo_t rdmaDbSendTask; rtModelEndGraphTaskInfo_t modelEndGraphTask; + rtModelExitTaskInfo_t modelExitTask; rtStreamSwitchNTaskInfo_t streamSwitchNTask; rtStreamLabelSwitchByIndexTask_t streamLabelSwitchIndexTask; rtStreamLabelGotoTask_t streamLabelGotoTask; @@ -391,6 +400,16 @@ RTS_API rtError_t rtModelAbort(rtModel_t model); /** * @ingroup rt_model + * @brief end graph task to model default stream + * @param [in] model model to execute + * @param [in] end graph stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelExit(rtModel_t model, rtStream_t stream); + +/** + * @ingroup rt_model * @brief bind queue * @param [in] model model to bind * @param [in] queueId queueId to bind From df258a2913f15e00d78499ece1a1d5bb07cea14a Mon Sep 17 00:00:00 2001 From: wangwenhua Date: Mon, 26 Oct 2020 11:43:02 +0800 Subject: [PATCH 03/27] aicpu no reuse --- ge/graph/load/new_model_manager/model_utils.cc | 4 +++- ge/graph/load/new_model_manager/task_info/task_info.h | 1 + ge/single_op/task/build_task_utils.cc | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ge/graph/load/new_model_manager/model_utils.cc b/ge/graph/load/new_model_manager/model_utils.cc index efcd2e48..0884ba8b 100755 --- a/ge/graph/load/new_model_manager/model_utils.cc +++ b/ge/graph/load/new_model_manager/model_utils.cc @@ -479,13 +479,15 @@ vector ModelUtils::GetWorkspaceDataAddrs(const RuntimeParam &model_param ge::AttrUtils::GetListInt(op_desc, ATTR_NAME_WORKSPACE_TYPE_LIST, workspace_memory_type); for (size_t i = 0; i < v_workspace_bytes.size(); ++i) { // Temporary solution, the aicpu workspace of multiple images cannot be shared. - if (has_workspace_reuse && i < workspace_reuse_flag.size() && !workspace_reuse_flag[i]) { + if (has_workspace_reuse && i < workspace_reuse_flag.size() + && !workspace_reuse_flag[i] && !model_param.is_single_op) { void *mem_addr = model_param.aicpu_mem_mall->Acquire(v_workspace_offset[i], v_workspace_bytes[i]); v_workspace_data_addr.push_back(mem_addr); GELOGI( "[IMAS]GetWorkspaceDataAddrs graph_%u type[F] name[%s] aicpu workspace[%zu] offset[%ld] bytes[%ld] " "memaddr[%p]", model_param.graph_id, op_desc->GetName().c_str(), i, v_workspace_offset[i], v_workspace_bytes[i], mem_addr); + continue; } else if (has_mem_type_workspace && workspace_memory_type[i] == RT_MEMORY_P2P_DDR) { int64_t p2p_workspace_offset = v_workspace_offset[i]; int64_t p2p_workspace_bytes = v_workspace_bytes[i]; diff --git a/ge/graph/load/new_model_manager/task_info/task_info.h b/ge/graph/load/new_model_manager/task_info/task_info.h index a50b0360..d296d29e 100644 --- a/ge/graph/load/new_model_manager/task_info/task_info.h +++ b/ge/graph/load/new_model_manager/task_info/task_info.h @@ -56,6 +56,7 @@ struct RuntimeParam { uint32_t label_num = 0; uint64_t session_id = 0; uint32_t graph_id = 0; + bool is_single_op = false; std::unique_ptr ts_mem_mall; std::unique_ptr aicpu_mem_mall; diff --git a/ge/single_op/task/build_task_utils.cc b/ge/single_op/task/build_task_utils.cc index 28177dc7..29f1657b 100644 --- a/ge/single_op/task/build_task_utils.cc +++ b/ge/single_op/task/build_task_utils.cc @@ -45,6 +45,7 @@ std::vector> BuildTaskUtils::GetAddresses(const OpDescPtr &o runtime_para.logic_var_base = kLogicVarBase; runtime_para.var_base = kVarBase; runtime_para.session_id = kSessionId; + runtime_para.is_single_op = true; ret.emplace_back(ModelUtils::GetInputDataAddrs(runtime_para, op_desc)); ret.emplace_back(ModelUtils::GetOutputDataAddrs(runtime_para, op_desc)); From f4780aca4e3f039b7a2ed2435095c81e83797245 Mon Sep 17 00:00:00 2001 From: l00444296 Date: Mon, 26 Oct 2020 15:52:59 +0800 Subject: [PATCH 04/27] Description:Support model_exit in GE Team:HISI_SW Feature or Bugfix:Feature --- ge/graph/passes/flow_ctrl_pass.cc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/ge/graph/passes/flow_ctrl_pass.cc b/ge/graph/passes/flow_ctrl_pass.cc index 10ad1c2a..ce114d86 100755 --- a/ge/graph/passes/flow_ctrl_pass.cc +++ b/ge/graph/passes/flow_ctrl_pass.cc @@ -326,7 +326,7 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c * loopCond * | * v - * switch --> Assign --> ModelExit + * switch --> Assign --> active --> ModelExit * ^ * | * loopReset @@ -347,21 +347,39 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c return FAILED; } - // 2. Insert model exit node and add ctrl edge if (CheckMultiDataSet(compute_graph)) { GELOGI("Multi dataSae exist, model_exit node is need."); + // 2. Insert active node and add ctrl edge + string active_name = switch_node->GetName() + "_StreamExitActive"; + NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); + if (active_node == nullptr) { + GELOGE(FAILED, "Insert stream active node:%s for IterCtrlTrueStream failed.", active_name.c_str()); + return FAILED; + } + GE_CHK_STATUS_RET(SetStreamLabel(active_node, switch_node->GetName()), "set stream label failed"); + GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), + DOMI_LOGE("set ATTR_NAME_IS_LOOP_ACTIVE failed"); return FAILED); + string model_exit_name = switch_node->GetName() + "_ModelExit"; + GE_CHK_STATUS_RET(SetActiveLabelList(active_node, { model_exit_name }), "set active label list failed"); + + add_ret = GraphUtils::AddEdge(assign_node->GetOutControlAnchor(), active_node->GetInControlAnchor()); + if (add_ret != GRAPH_SUCCESS) { + GELOGE(FAILED, "Add assign_node to active_node ctrl edge failed, add_ret=%u.", add_ret); + return FAILED; + } + + // 3. Insert model exit node and add ctrl edge NodePtr model_exit_node = InsertOp(compute_graph, MODELEXIT, model_exit_name, {}, {}); if (model_exit_node == nullptr) { GELOGE(FAILED, "Insert model_exit node:%s for IterCtrlTrueStream failed.", model_exit_name.c_str()); return FAILED; } - // Must set same stream label with assign_node - GE_CHK_STATUS_RET(SetStreamLabel(model_exit_node, switch_node->GetName()), "set stream label failed"); + GE_CHK_STATUS_RET(SetStreamLabel(model_exit_node, model_exit_name), "set stream label failed"); - add_ret = GraphUtils::AddEdge(assign_node->GetOutControlAnchor(), model_exit_node->GetInControlAnchor()); + add_ret = GraphUtils::AddEdge(active_node->GetOutControlAnchor(), model_exit_node->GetInControlAnchor()); if (add_ret != GRAPH_SUCCESS) { - GELOGE(FAILED, "Add assign_node to model_exit_node ctrl edge failed, add_ret=%u.", add_ret); + GELOGE(FAILED, "Add active_node to model_exit_node ctrl edge failed, add_ret=%u.", add_ret); return FAILED; } } From 40beb81369eca4e828cf7aa8f12626a2f8db8158 Mon Sep 17 00:00:00 2001 From: l00444296 Date: Mon, 26 Oct 2020 19:21:34 +0800 Subject: [PATCH 05/27] Description:Support model_exit in GE Team:HISI_SW Feature or Bugfix:Feature --- ge/executor/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/executor/module.mk b/ge/executor/module.mk index 27280be7..309feb10 100755 --- a/ge/executor/module.mk +++ b/ge/executor/module.mk @@ -48,7 +48,7 @@ local_ge_executor_src_files := \ ../graph/load/new_model_manager/task_info/stream_switch_task_info.cc \ ../graph/load/new_model_manager/task_info/stream_switchn_task_info.cc \ ../graph/load/new_model_manager/task_info/end_graph_task_info.cc \ - ../graph/load/new_model_manager/task_info/model_exit_task_info.cc \ + ../graph/load/new_model_manager/task_info/model_exit_task_info.cc \ ../graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc \ ../graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc \ ../opskernel_manager/ops_kernel_builder_manager.cc \ From b7928898f318f0d6544076f056b353a310493b71 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Oct 2020 20:43:02 +0800 Subject: [PATCH 06/27] Support for custom operator. --- ge/executor/ge_executor.cc | 8 +++++ ge/graph/load/new_model_manager/model_manager.cc | 43 +++++++++++++++++++++--- ge/graph/load/new_model_manager/model_manager.h | 8 ++--- ge/single_op/single_op_model.cc | 9 ++--- ge/single_op/task/aicpu_kernel_task_builder.cc | 10 ++++++ ge/single_op/task/op_task.cc | 9 +++-- ge/single_op/task/op_task.h | 2 ++ 7 files changed, 71 insertions(+), 18 deletions(-) diff --git a/ge/executor/ge_executor.cc b/ge/executor/ge_executor.cc index 2e668755..12b726ab 100755 --- a/ge/executor/ge_executor.cc +++ b/ge/executor/ge_executor.cc @@ -1058,6 +1058,14 @@ ge::Status GeExecutor::ExecuteAsync(DynamicSingleOp *executor, const vector(rt_err)); + return RT_FAILED; + } + ModelManager::GetInstance()->ClearAICPUSo(rt_cur_ctx); return SingleOpManager::GetInstance().ReleaseResource(stream); } diff --git a/ge/graph/load/new_model_manager/model_manager.cc b/ge/graph/load/new_model_manager/model_manager.cc index 4224d3f2..960b814e 100755 --- a/ge/graph/load/new_model_manager/model_manager.cc +++ b/ge/graph/load/new_model_manager/model_manager.cc @@ -236,6 +236,7 @@ ModelManager::~ModelManager() { std::lock_guard lock(map_mutex_); model_map_.clear(); model_aicpu_kernel_.clear(); + cust_aicpu_so_.clear(); GE_IF_BOOL_EXEC(device_count > 0, GE_CHK_RT(rtDeviceReset(0))); } @@ -399,7 +400,6 @@ Status ModelManager::Unload(uint32_t model_id) { } std::lock_guard lock(exeception_infos_mutex_); exception_infos_.clear(); - cust_aicpu_so_.clear(); return SUCCESS; } @@ -1096,15 +1096,47 @@ Status ModelManager::CreateAicpuSession(uint64_t session_id) { return SUCCESS; } -Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, string so_name) { +Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_name) { + GELOGI("LoadCustAicpuSo in, op name %s, so_name %s.", op_desc->GetName().c_str(), so_name.c_str()); std::lock_guard lock(cust_aicpu_mutex_); - auto it = cust_aicpu_so_.find(so_name); + // get current context + rtContext_t rt_cur_ctx = nullptr; + auto rt_err = rtCtxGetCurrent(&rt_cur_ctx); + if (rt_err != RT_ERROR_NONE) { + GELOGE(RT_FAILED, "get current context failed, runtime result is %d", static_cast(rt_err)); + return RT_FAILED; + } + // use current context as resource key instead + resource_id = reinterpret_cast(rt_cur_ctx); + auto it = cust_aicpu_so_.find(resource_id); if (it == cust_aicpu_so_.end()) { GE_CHK_STATUS_RET(LaunchCustAicpuSo(op_desc, so_name), "LaunchCustAicpuSo failed. op name %s, so_name %s", op_desc->GetName().c_str(), so_name.c_str()); - (void)cust_aicpu_so_.insert(so_name); - GELOGI("LaunchCustAicpuSo op name %s, so_name %s.", op_desc->GetName().c_str(), so_name.c_str()); + std::set so_name_set; + so_name_set.insert(so_name); + cust_aicpu_so_[resource_id] = so_name_set; + GELOGI("LoadCustAicpuSo new aicpu so resource_id %lu.", resource_id); + return SUCCESS; + } + auto it_so_name = it->second.find(so_name); + if (it_so_name == it->second.end()) { + GE_CHK_STATUS_RET(LaunchCustAicpuSo(op_desc, so_name), "LaunchCustAicpuSo failed. op name %s, so_name %s", + op_desc->GetName().c_str(), so_name.c_str()); + it->second.insert(so_name); + GELOGI("LoadCustAicpuSo add aicpu so resource_id %lu.", resource_id); + } + return SUCCESS; +} + +Status ModelManager::ClearAICPUSo(void *ctx) { + auto ctx_id = reinterpret_cast(rt_cur_ctx); + GELOGI("ClearAICPUSo in. resource_id = 0x%lx.", static_cast(ctx_id)); + std::lock_guard lock(cust_aicpu_mutex_); + auto it = cust_aicpu_so_.find(ctx_id); + if (it == cust_aicpu_so_.end()) { + return SUCCESS; } + (void)cust_aicpu_so_.erase(it); return SUCCESS; } @@ -1140,6 +1172,7 @@ Status ModelManager::LaunchCustAicpuSo(const OpDescPtr op_desc, string so_name) GE_CHK_RT(rtStreamCreate(&stream, 0)); GE_CHK_RT(rtCpuKernelLaunch(nullptr, kLoadOpFromBuf, 1, args, args_size, nullptr, stream)); + GELOGI("LaunchCustAicpuSo so buf len %u, so name len %u.", aicpu_data_length, so_name.size()); status = rtStreamSynchronize(stream); if (status != RT_ERROR_NONE) { GELOGE(RT_FAILED, "Call rt stream sync failed, status: 0x%x", status); diff --git a/ge/graph/load/new_model_manager/model_manager.h b/ge/graph/load/new_model_manager/model_manager.h index d4852a53..9e8f61db 100755 --- a/ge/graph/load/new_model_manager/model_manager.h +++ b/ge/graph/load/new_model_manager/model_manager.h @@ -270,9 +270,9 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager { ge::Status DestroyAicpuSessionForInfer(uint32_t model_id); - ge::Status LoadCustAicpuSo(const OpDescPtr op_desc, string so_name); - - ge::Status LaunchCustAicpuSo(const OpDescPtr op_desc, string so_name); + ge::Status LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_name); + ge::Status LaunchCustAicpuSo(const OpDescPtr op_desc, const string &so_name); + ge::Status ClearAICPUSo(void *ctx); ge::Status GetOrigInputInfo(uint32_t model_id, uint32_t index, OriginInputInfo &orig_input_info); @@ -340,7 +340,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager { std::set sess_ids_; std::vector exception_infos_; std::mutex cust_aicpu_mutex_; - std::set cust_aicpu_so_; + std::map> cust_aicpu_so_; static DumpProperties dump_properties_; }; diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 4892b7a1..3c5043cc 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -190,6 +190,7 @@ Status SingleOpModel::LoadAllNodes() { } ge_model->GetTBEKernelStore().LoadTBEKernelBinToOpDesc(op_desc); + ge_model->GetCustAICPUKernelStore().LoadCustAICPUKernelBinToOpDesc(op_desc); } return SUCCESS; @@ -247,7 +248,7 @@ Status SingleOpModel::BuildTaskList(SingleOp &single_op) { single_op.arg_table_.resize(single_op.input_sizes_.size() + single_op.output_sizes_.size()); ParseArgTable(tbe_task, single_op); single_op.tasks_.emplace_back(tbe_task); - } else if (kernel_type == cce::ccKernelType::AI_CPU) { + } else if (kernel_type == cce::ccKernelType::AI_CPU || kernel_type == cce::ccKernelType::CUST_AI_CPU) { GELOGD("Building AICPU_CC task"); OpTask *task = nullptr; auto ret = BuildCpuKernelTask(task_def.kernel(), &task); @@ -256,7 +257,7 @@ Status SingleOpModel::BuildTaskList(SingleOp &single_op) { } single_op.tasks_.emplace_back(task); } else { - GELOGE(UNSUPPORTED, "Only TBE kernel and AI_CPU kernel are supported, but got %u", context.kernel_type()); + GELOGE(UNSUPPORTED, "Only TBE kernel, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type()); return UNSUPPORTED; } } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { @@ -391,13 +392,13 @@ Status SingleOpModel::BuildModelTaskKernel(const TaskDef &task_def, DynamicSingl TbeOpTask *tbe_task = nullptr; GE_CHK_STATUS_RET_NOLOG(BuildKernelTask(task_def.kernel(), &tbe_task)); single_op.op_task_.reset(tbe_task); - } else if (kernel_type == cce::ccKernelType::AI_CPU) { + } else if (kernel_type == cce::ccKernelType::AI_CPU || kernel_type == cce::ccKernelType::CUST_AI_CPU) { GELOGD("Building AICPU_CC task"); OpTask *task = nullptr; GE_CHK_STATUS_RET_NOLOG(BuildCpuKernelTask(task_def.kernel(), &task)); single_op.op_task_.reset(task); } else { - GELOGE(UNSUPPORTED, "Only TBE kernel and AI_CPU kernel are supported, but got %u", context.kernel_type()); + GELOGE(UNSUPPORTED, "Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type()); return UNSUPPORTED; } return SUCCESS; diff --git a/ge/single_op/task/aicpu_kernel_task_builder.cc b/ge/single_op/task/aicpu_kernel_task_builder.cc index fc7a9f97..b9c5b9d0 100755 --- a/ge/single_op/task/aicpu_kernel_task_builder.cc +++ b/ge/single_op/task/aicpu_kernel_task_builder.cc @@ -15,6 +15,8 @@ */ #include "single_op/task/aicpu_kernel_task_builder.h" +#include "cce/taskdown_common.hpp" +#include "graph/load/new_model_manager/model_manager.h" namespace ge { AiCpuCCTaskBuilder::AiCpuCCTaskBuilder(const OpDescPtr &op_desc, const domi::KernelDef &kernel_def) @@ -55,6 +57,14 @@ Status AiCpuCCTaskBuilder::BuildTask(AiCpuCCTask &task) { task.SetkernelName(kernel_name); task.op_desc_ = op_desc_; + const auto &context = kernel_def_.context(); + auto kernel_type = static_cast(context.kernel_type()); + if (kernel_type == cce::ccKernelType::CUST_AI_CPU) { + task.is_custom_ = true; + task.dump_flag_ |= RT_KERNEL_CUSTOM_AICPU; + GE_CHK_STATUS_RET(ModelManager::GetInstance()->LoadCustAicpuSo(op_desc_, so_name), "launch cust aicpu so failed"); + } + task.num_inputs_ = op_desc_->GetInputsSize(); task.num_outputs_ = op_desc_->GetOutputsSize(); diff --git a/ge/single_op/task/op_task.cc b/ge/single_op/task/op_task.cc index b138983a..f1d293d5 100755 --- a/ge/single_op/task/op_task.cc +++ b/ge/single_op/task/op_task.cc @@ -280,8 +280,6 @@ Status AiCpuBaseTask::UpdateExtInfo(const std::vector &input_desc, for (size_t j = 0; j < num_outputs_; ++j) { GE_CHK_STATUS_RET(aicpu_ext_handle_->UpdateOutputShapeAndType(j, output_desc[j]), "Output[%zu] UpdateOutputShapeAndType failed.", j); - // debug code - GELOGD("No input and output, no need update ext info."); } } @@ -669,9 +667,10 @@ Status AiCpuCCTask::LaunchKernel(rtStream_t stream) { kernel_name_.data()); // sm_desc is nullptr, because l2 buffer does not support auto *sm_desc = reinterpret_cast(sm_desc_); - auto ret = - rtCpuKernelLaunch(static_cast(so_name_.data()), static_cast(kernel_name_.data()), - block_dim_, args_.get(), static_cast(arg_size_), sm_desc, stream); + auto ret = rtCpuKernelLaunchWithFlag(static_cast(so_name_.data()), + static_cast(kernel_name_.data()), + block_dim_, args_.get(), static_cast(arg_size_), + sm_desc, stream, dump_flag_); if (ret != RT_ERROR_NONE) { GELOGE(RT_FAILED, "Invoke rtCpuKernelLaunch failed. ret = %d", ret); return RT_FAILED; diff --git a/ge/single_op/task/op_task.h b/ge/single_op/task/op_task.h index 57be92ef..4325da33 100644 --- a/ge/single_op/task/op_task.h +++ b/ge/single_op/task/op_task.h @@ -234,6 +234,8 @@ private: uint32_t block_dim_ = 1; void *sm_desc_ = nullptr; void *io_addr_ = nullptr; + bool is_custom_ = false; + uint32_t dump_flag_ = RT_KERNEL_DEFAULT; }; } // namespace ge From c323cb229a32d2ced20e0b898341669d760e840d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Oct 2020 21:01:46 +0800 Subject: [PATCH 07/27] Support for custom operator. --- ge/graph/load/new_model_manager/model_manager.cc | 8 ++++---- ge/single_op/single_op_model.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ge/graph/load/new_model_manager/model_manager.cc b/ge/graph/load/new_model_manager/model_manager.cc index 960b814e..bdcc40f9 100755 --- a/ge/graph/load/new_model_manager/model_manager.cc +++ b/ge/graph/load/new_model_manager/model_manager.cc @@ -1107,7 +1107,7 @@ Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_n return RT_FAILED; } // use current context as resource key instead - resource_id = reinterpret_cast(rt_cur_ctx); + uintptr_t resource_id = reinterpret_cast(rt_cur_ctx); auto it = cust_aicpu_so_.find(resource_id); if (it == cust_aicpu_so_.end()) { GE_CHK_STATUS_RET(LaunchCustAicpuSo(op_desc, so_name), "LaunchCustAicpuSo failed. op name %s, so_name %s", @@ -1129,8 +1129,8 @@ Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_n } Status ModelManager::ClearAICPUSo(void *ctx) { - auto ctx_id = reinterpret_cast(rt_cur_ctx); - GELOGI("ClearAICPUSo in. resource_id = 0x%lx.", static_cast(ctx_id)); + auto ctx_id = reinterpret_cast(ctx); + GELOGI("ClearAICPUSo in. resource_id = 0x%lx", static_cast(ctx_id)); std::lock_guard lock(cust_aicpu_mutex_); auto it = cust_aicpu_so_.find(ctx_id); if (it == cust_aicpu_so_.end()) { @@ -1140,7 +1140,7 @@ Status ModelManager::ClearAICPUSo(void *ctx) { return SUCCESS; } -Status ModelManager::LaunchCustAicpuSo(const OpDescPtr op_desc, string so_name) { +Status ModelManager::LaunchCustAicpuSo(const OpDescPtr op_desc, const string &so_name) { CustAICPUKernelPtr aicpu_kernel = op_desc->TryGetExtAttr(OP_EXTATTR_CUSTAICPU_KERNEL, CustAICPUKernelPtr()); if (aicpu_kernel == nullptr) { GELOGE(INTERNAL_ERROR, "cust aicpu op %s can't find kernel!", op_desc->GetName().c_str()); diff --git a/ge/single_op/single_op_model.cc b/ge/single_op/single_op_model.cc index 3c5043cc..a1e1e7dd 100755 --- a/ge/single_op/single_op_model.cc +++ b/ge/single_op/single_op_model.cc @@ -257,7 +257,7 @@ Status SingleOpModel::BuildTaskList(SingleOp &single_op) { } single_op.tasks_.emplace_back(task); } else { - GELOGE(UNSUPPORTED, "Only TBE kernel, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type()); + GELOGE(UNSUPPORTED, "Only TBE, AI_CPU, CUST_AI_CPU kernel are supported, but got %u", context.kernel_type()); return UNSUPPORTED; } } else if (task_type == RT_MODEL_TASK_KERNEL_EX) { From e5402ea2646ca38fa7a5cc8e6d8b05017b9c34c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 Oct 2020 21:10:00 +0800 Subject: [PATCH 08/27] Support for custom operator. --- ge/graph/load/new_model_manager/model_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/load/new_model_manager/model_manager.cc b/ge/graph/load/new_model_manager/model_manager.cc index bdcc40f9..8d4cd01e 100755 --- a/ge/graph/load/new_model_manager/model_manager.cc +++ b/ge/graph/load/new_model_manager/model_manager.cc @@ -1130,7 +1130,7 @@ Status ModelManager::LoadCustAicpuSo(const OpDescPtr op_desc, const string &so_n Status ModelManager::ClearAICPUSo(void *ctx) { auto ctx_id = reinterpret_cast(ctx); - GELOGI("ClearAICPUSo in. resource_id = 0x%lx", static_cast(ctx_id)); + GELOGI("ClearAICPUSo in. resource id = 0x%lx", static_cast(ctx_id)); std::lock_guard lock(cust_aicpu_mutex_); auto it = cust_aicpu_so_.find(ctx_id); if (it == cust_aicpu_so_.end()) { From d282bf72c5aec807664cba990b75ec0d68f600b3 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Tue, 27 Oct 2020 15:00:44 +0800 Subject: [PATCH 09/27] Add debug_dir & op_compiler_cache_dir & op_compiler_cache_mode options --- ge/offline/main.cc | 14 ++++ inc/external/ge/ge_api_types.h | 142 +++++++++++++++++++++-------------------- 2 files changed, 86 insertions(+), 70 deletions(-) diff --git a/ge/offline/main.cc b/ge/offline/main.cc index 4eee1b89..2a161cd7 100755 --- a/ge/offline/main.cc +++ b/ge/offline/main.cc @@ -194,6 +194,11 @@ DEFINE_int32(op_debug_level, 0, "Optional; configure debug level of compiler. 0( "1: open TBE compiler, export ccec file and TBE instruction mapping file; 2: open ccec compiler"); DEFINE_string(enable_scope_fusion_passes, "", "Optional; validate the non-general scope fusion pass," "multiple names can be set and separated by ','."); +DEFINE_string(debug_dir, "", "Optional; the path to save the intermediate files of operator compilation"); + +DEFINE_string(op_compiler_cache_dir, "", "Optional; the path to cache operator compilation files"); + +DEFINE_string(op_compiler_cache_mode, "", "Optional; choose the operator compiler cache mode"); class GFlagUtils { public: @@ -999,6 +1004,9 @@ static void SetEnvForSingleOp(std::map &options) { options.emplace(ge::AUTO_TUNE_MODE, FLAGS_auto_tune_mode); options.emplace(ge::GRAPH_MEMORY_MAX_SIZE, kGraphMemoryManagerMallocMaxSize); options.emplace(ge::OP_DEBUG_LEVEL, to_string(FLAGS_op_debug_level)); + options.emplace(ge::DEBUG_DIR, FLAGS_debug_dir); + options.emplace(ge::OP_COMPILER_CACHE_DIR, FLAGS_op_compiler_cache_dir); + options.emplace(ge::OP_COMPILER_CACHE_MODE, FLAGS_op_compiler_cache_mode); } domi::Status GenerateSingleOp(const std::string& json_file_path) { @@ -1131,6 +1139,12 @@ domi::Status GenerateOmModel() { options.insert(std::pair(string(ge::ENABLE_SINGLE_STREAM), FLAGS_enable_single_stream)); + options.insert(std::pair(string(ge::DEBUG_DIR), FLAGS_debug_dir)); + + options.insert(std::pair(string(ge::OP_COMPILER_CACHE_DIR), FLAGS_op_compiler_cache_dir)); + + options.insert(std::pair(string(ge::OP_COMPILER_CACHE_MODE), FLAGS_op_compiler_cache_mode)); + SetDynamicInputSizeOptions(); if (!FLAGS_save_original_model.empty()) { diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h index 1c6b7a3e..113b8bc6 100644 --- a/inc/external/ge/ge_api_types.h +++ b/inc/external/ge/ge_api_types.h @@ -222,6 +222,18 @@ const char *const OPTION_GE_MAX_DUMP_OP_NUM = "ge.maxDumpOpNum"; // Its value should be "0" or "1", default value is "1" const char *const ENABLE_PRINT_OP_PASS = "ge.enablePrintOpPass"; +// Configure operator compilation path +// Its value should be file path, default value is "./" +const char *const DEBUG_DIR = "ge.debugDir"; + +// Configure operator compiler cache path +// Its value should be file path, default value is "./" +const char *const OP_COMPILER_CACHE_DIR = "ge.op_compiler_cache_dir"; + +// Configure operator compiler cache mode +// Its value should be "disable", "enable" or "force", default value is "disable" +const char *const OP_COMPILER_CACHE_MODE = "ge.op_compiler_cache_mode"; + // Configure whether to use single stream. // Its value should be "true" or "false", default value is "false" const char *const ENABLE_SINGLE_STREAM = "ge.enableSingleStream"; @@ -238,10 +250,10 @@ enum GraphRunMode { PREDICTION = 0, TRAIN }; // Input/Output tensor info struct InputTensorInfo { - uint32_t data_type; // data type - std::vector dims; // shape description - void *data; // tensor data - int64_t length; // tensor length + uint32_t data_type; // data type + std::vector dims; // shape description + void *data; // tensor data + int64_t length; // tensor length }; struct OutputTensorInfo { @@ -250,11 +262,8 @@ struct OutputTensorInfo { std::unique_ptr data; // tensor data int64_t length; // tensor length OutputTensorInfo() : data_type(0), dims({}), data(nullptr), length(0) {} - OutputTensorInfo(OutputTensorInfo &&out) : - data_type(out.data_type), - dims(out.dims), - data(std::move(out.data)), - length(out.length) {} + OutputTensorInfo(OutputTensorInfo &&out) + : data_type(out.data_type), dims(out.dims), data(std::move(out.data)), length(out.length) {} OutputTensorInfo &operator=(OutputTensorInfo &&out) { if (this != &out) { @@ -273,67 +282,60 @@ using Status = uint32_t; using RunAsyncCallback = std::function &)>; // for ir build namespace ir_option { - static const char *const INPUT_FORMAT = "input_format"; - static const char *const INPUT_SHAPE = "input_shape"; - static const char *const OP_NAME_MAP = "op_name_map"; - static const char *const DYNAMIC_BATCH_SIZE = kDynamicBatchSize; - static const char *const DYNAMIC_IMAGE_SIZE = kDynamicImageSize; - static const char *const DYNAMIC_DIMS = kDynamicDims; - static const char *const INSERT_OP_FILE = ge::INSERT_OP_FILE.c_str(); - static const char *const PRECISION_MODE = ge::PRECISION_MODE.c_str(); - static const char *const EXEC_DISABLE_REUSED_MEMORY = ge::OPTION_EXEC_DISABLE_REUSED_MEMORY; - static const char *const AUTO_TUNE_MODE = ge::AUTO_TUNE_MODE.c_str(); - static const char *const CORE_TYPE = ge::CORE_TYPE.c_str(); - static const char *const SOC_VERSION = ge::SOC_VERSION.c_str(); - static const char *const ENABLE_SINGLE_STREAM = ge::ENABLE_SINGLE_STREAM; - static const char *const AICORE_NUM = ge::AICORE_NUM.c_str(); - static const char *const FUSION_SWITCH_FILE = ge::FUSION_SWITCH_FILE.c_str(); - static const char *const ENABLE_SMALL_CHANNEL = ge::ENABLE_SMALL_CHANNEL.c_str(); - static const char *const OP_SELECT_IMPL_MODE = ge::OP_SELECT_IMPL_MODE.c_str(); - static const char *const OUTPUT_TYPE = ge::OUTPUT_DATATYPE.c_str(); - static const char *const BUFFER_OPTIMIZE = ge::BUFFER_OPTIMIZE.c_str(); - static const char *const ENABLE_COMPRESS_WEIGHT = ge::ENABLE_COMPRESS_WEIGHT.c_str(); - static const char *const COMPRESS_WEIGHT_CONF = "compress_weight_conf"; - static const char *const OUT_NODES = ge::OUTPUT_NODE_NAME.c_str(); - static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); - static const char *const LOG_LEVEL = "log"; - static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); - - // for interface: aclgrphBuildModel - const std::set ir_builder_suppported_options = { - INPUT_FORMAT, - INPUT_SHAPE, - OP_NAME_MAP, - DYNAMIC_BATCH_SIZE, - DYNAMIC_IMAGE_SIZE, - DYNAMIC_DIMS, - INSERT_OP_FILE, - PRECISION_MODE, - EXEC_DISABLE_REUSED_MEMORY, - AUTO_TUNE_MODE, - OUTPUT_TYPE, - OUT_NODES, - INPUT_FP16_NODES, - LOG_LEVEL - }; - // for interface: aclgrphBuildInitialize - const std::set global_options = { - CORE_TYPE, - SOC_VERSION, - BUFFER_OPTIMIZE, - ENABLE_COMPRESS_WEIGHT, - COMPRESS_WEIGHT_CONF, - PRECISION_MODE, - EXEC_DISABLE_REUSED_MEMORY, - AUTO_TUNE_MODE, - ENABLE_SINGLE_STREAM, - AICORE_NUM, - FUSION_SWITCH_FILE, - ENABLE_SMALL_CHANNEL, - OP_SELECT_IMPL_MODE, - OPTYPELIST_FOR_IMPLMODE - }; -} +static const char *const INPUT_FORMAT = "input_format"; +static const char *const INPUT_SHAPE = "input_shape"; +static const char *const OP_NAME_MAP = "op_name_map"; +static const char *const DYNAMIC_BATCH_SIZE = kDynamicBatchSize; +static const char *const DYNAMIC_IMAGE_SIZE = kDynamicImageSize; +static const char *const DYNAMIC_DIMS = kDynamicDims; +static const char *const INSERT_OP_FILE = ge::INSERT_OP_FILE.c_str(); +static const char *const PRECISION_MODE = ge::PRECISION_MODE.c_str(); +static const char *const EXEC_DISABLE_REUSED_MEMORY = ge::OPTION_EXEC_DISABLE_REUSED_MEMORY; +static const char *const AUTO_TUNE_MODE = ge::AUTO_TUNE_MODE.c_str(); +static const char *const CORE_TYPE = ge::CORE_TYPE.c_str(); +static const char *const SOC_VERSION = ge::SOC_VERSION.c_str(); +static const char *const ENABLE_SINGLE_STREAM = ge::ENABLE_SINGLE_STREAM; +static const char *const AICORE_NUM = ge::AICORE_NUM.c_str(); +static const char *const FUSION_SWITCH_FILE = ge::FUSION_SWITCH_FILE.c_str(); +static const char *const ENABLE_SMALL_CHANNEL = ge::ENABLE_SMALL_CHANNEL.c_str(); +static const char *const OP_SELECT_IMPL_MODE = ge::OP_SELECT_IMPL_MODE.c_str(); +static const char *const OUTPUT_TYPE = ge::OUTPUT_DATATYPE.c_str(); +static const char *const BUFFER_OPTIMIZE = ge::BUFFER_OPTIMIZE.c_str(); +static const char *const ENABLE_COMPRESS_WEIGHT = ge::ENABLE_COMPRESS_WEIGHT.c_str(); +static const char *const COMPRESS_WEIGHT_CONF = "compress_weight_conf"; +static const char *const OUT_NODES = ge::OUTPUT_NODE_NAME.c_str(); +static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); +static const char *const LOG_LEVEL = "log"; +static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); +static const char *const DEBUG_DIR = ge::DEBUG_DIR; +static const char *const OP_COMPILER_CACHE_DIR = ge::OP_COMPILER_CACHE_DIR; +static const char *const OP_COMPILER_CACHE_MODE = ge::OP_COMPILER_CACHE_MODE; +// for interface: aclgrphBuildModel +const std::set ir_builder_suppported_options = { + INPUT_FORMAT, INPUT_SHAPE, OP_NAME_MAP, + DYNAMIC_BATCH_SIZE, DYNAMIC_IMAGE_SIZE, DYNAMIC_DIMS, + INSERT_OP_FILE, PRECISION_MODE, EXEC_DISABLE_REUSED_MEMORY, + AUTO_TUNE_MODE, OUTPUT_TYPE, OUT_NODES, + INPUT_FP16_NODES, LOG_LEVEL}; +// for interface: aclgrphBuildInitialize +const std::set global_options = {CORE_TYPE, + SOC_VERSION, + BUFFER_OPTIMIZE, + ENABLE_COMPRESS_WEIGHT, + COMPRESS_WEIGHT_CONF, + PRECISION_MODE, + EXEC_DISABLE_REUSED_MEMORY, + AUTO_TUNE_MODE, + ENABLE_SINGLE_STREAM, + AICORE_NUM, + FUSION_SWITCH_FILE, + ENABLE_SMALL_CHANNEL, + OP_SELECT_IMPL_MODE, + OPTYPELIST_FOR_IMPLMODE, + DEBUG_DIR, + OP_COMPILER_CACHE_DIR, + OP_COMPILER_CACHE_MODE}; +} // namespace ir_option } // namespace ge #endif // INC_EXTERNAL_GE_GE_API_TYPES_H_ From 60f30d7ceb6760c9f8d4d06384f22db78cad40e5 Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Tue, 27 Oct 2020 16:24:21 +0800 Subject: [PATCH 10/27] add mark agnostic pass --- ge/CMakeLists.txt | 2 ++ ge/ge_inference.mk | 1 + ge/ge_runner.mk | 1 + ge/graph/passes/mark_agnostic_pass.cc | 28 ++++++++++++++++++++++++---- ge/graph/preprocess/graph_preprocess.cc | 2 ++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index fa315516..51ef2009 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -137,6 +137,7 @@ set(TRAIN_SRC_LIST "graph/passes/atomic_addr_clean_pass.cc" "graph/passes/mark_same_addr_pass.cc" "graph/passes/mark_graph_unknown_status_pass.cc" + "graph/passes/mark_agnostic_pass.cc" "graph/partition/dynamic_shape_partition.cc" "graph/partition/stage_partition.cc" "graph/passes/base_pass.cc" @@ -488,6 +489,7 @@ set(INFER_SRC_LIST "graph/passes/atomic_addr_clean_pass.cc" "graph/passes/mark_same_addr_pass.cc" "graph/passes/mark_graph_unknown_status_pass.cc" + "graph/passes/mark_agnostic_pass.cc" "graph/common/omg_util.cc" "graph/common/bcast.cc" "graph/common/local_context.cc" diff --git a/ge/ge_inference.mk b/ge/ge_inference.mk index ac106346..bbf18b90 100755 --- a/ge/ge_inference.mk +++ b/ge/ge_inference.mk @@ -109,6 +109,7 @@ OMG_HOST_SRC_FILES := \ graph/passes/atomic_addr_clean_pass.cc \ graph/passes/mark_same_addr_pass.cc \ graph/passes/mark_graph_unknown_status_pass.cc \ + graph/passes/mark_agnostic_pass.cc \ graph/common/omg_util.cc \ graph/common/bcast.cc \ graph/common/local_context.cc \ diff --git a/ge/ge_runner.mk b/ge/ge_runner.mk index 6c448a46..2af4cbc6 100644 --- a/ge/ge_runner.mk +++ b/ge/ge_runner.mk @@ -110,6 +110,7 @@ LIBGE_LOCAL_SRC_FILES := \ graph/passes/atomic_addr_clean_pass.cc \ graph/passes/mark_same_addr_pass.cc \ graph/passes/mark_graph_unknown_status_pass.cc \ + graph/passes/mark_agnostic_pass.cc \ graph/partition/dynamic_shape_partition.cc \ graph/partition/stage_partition.cc \ graph/passes/base_pass.cc \ diff --git a/ge/graph/passes/mark_agnostic_pass.cc b/ge/graph/passes/mark_agnostic_pass.cc index 0275bc9f..77fa64fb 100644 --- a/ge/graph/passes/mark_agnostic_pass.cc +++ b/ge/graph/passes/mark_agnostic_pass.cc @@ -15,20 +15,40 @@ */ #include "graph/passes/mark_agnostic_pass.h" -#include "utils/node_utils.h" +#include "graph/utils/node_utils.h" namespace ge { Status MarkAgnosticPass::Run(ComputeGraphPtr graph) { for (const auto &node : graph->GetDirectNode()) { auto node_type = NodeUtils::GetNodeType(*node); if (node_type == SWITCH || node_type == REFSWITCH || node_type == SWITCHN) { - GELOGD("Mark format agnostic for switch ndoe %s", node->GetName().c_str()); + GELOGD("Mark format agnostic and continuous for switch node %s", node->GetName().c_str()); + const OpDescPtr op_desc = node->GetOpDesc(); + const GeTensorDescPtr op_tensor = op_desc->MutableInputDesc(0); + if (op_tensor == nullptr) { + GELOGD("Op: %s, Index:0,has no input", node->GetName().c_str()); + continue; + } + AttrUtils::SetInt(op_tensor, "_format_continuous", 1); + AttrUtils::SetInt(node->GetOpDesc(), "_format_agnostic", 1); + AttrUtils::SetListInt(node->GetOpDesc(), "_format_agnostic_except_input", std::vector({1})); + continue; + } + if (node_type == IDENTITY) { + GELOGD("Mark format agnostic for identity node %s", node->GetName().c_str()); AttrUtils::SetInt(node->GetOpDesc(), "_format_agnostic", 1); AttrUtils::SetListInt(node->GetOpDesc(), "_format_agnostic_except_input", std::vector({1})); continue; } if (node_type == MERGE || node_type == REFMERGE) { - GELOGD("Mark format agnostic for merge node %s", node->GetName().c_str()); + GELOGD("Mark format agnostic and continuous for merge node %s", node->GetName().c_str()); + const OpDescPtr op_desc = node->GetOpDesc(); + const GeTensorDescPtr op_tensor = op_desc->MutableOutputDesc(0); + if (op_tensor == nullptr) { + GELOGD("Op: %s, Index:0,has no output", node->GetName().c_str()); + continue; + } + AttrUtils::SetInt(op_tensor, "_format_continuous", 1); AttrUtils::SetInt(node->GetOpDesc(), "_format_agnostic", 1); AttrUtils::SetListInt(node->GetOpDesc(), "_format_agnostic_except_output", std::vector({1})); continue; @@ -36,4 +56,4 @@ Status MarkAgnosticPass::Run(ComputeGraphPtr graph) { } return SUCCESS; } -} \ No newline at end of file +} // namespace ge \ No newline at end of file diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index f90c0d80..20964b6c 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -92,6 +92,7 @@ #include "graph/passes/unused_op_remove_pass.h" #include "graph/passes/var_is_initialized_op_pass.h" #include "graph/passes/variable_prepare_op_pass.h" +#include "graph/passes/mark_agnostic_pass.h" #include "graph/preprocess/insert_op/util_insert_aipp_op.h" #include "graph/types.h" #include "graph/utils/tensor_utils.h" @@ -1626,6 +1627,7 @@ Status GraphPrepare::PrepareOptimize() { try { (void)original_graph_passes.AddPass("PrepareOptimize::ShapeOperateOpRemovePass", new ShapeOperateOpRemovePass); (void)original_graph_passes.AddPass("PrepareOptimize::ReplaceTransShapePass", new ReplaceTransShapePass); + (void)original_graph_passes.AddPass("PrepareOptimize::MarkAgnosticPass", new MarkAgnosticPass); } catch (std::bad_alloc &e) { GELOGE(INTERNAL_ERROR, "Add pass failed, bad memory allocation occurs."); return INTERNAL_ERROR; From c807dae9be52584c0950467bfbbc76710c4c6972 Mon Sep 17 00:00:00 2001 From: zhengyuanhua Date: Tue, 27 Oct 2020 17:29:51 +0800 Subject: [PATCH 11/27] aipp config add related input name and modify proto --- ge/client/proto/insert_op.proto | 3 + ge/common/proto/insert_op.proto | 3 + ge/executor/proto/insert_op.proto | 3 + ge/graph/preprocess/insert_op/ge_aipp_op.cc | 37 +++++++++ ge/graph/preprocess/insert_op/ge_aipp_op.h | 1 + .../preprocess/insert_op/util_insert_aipp_op.cc | 91 +++++++++++++++++++--- .../preprocess/insert_op/util_insert_aipp_op.h | 4 + ge/offline/proto/insert_op.proto | 3 + ge/proto/insert_op.proto | 3 + ge/session/omg.cc | 2 + inc/framework/omg/omg_inner_types.h | 2 + inc/framework/omg/parser/parser_inner_ctx.h | 11 ++- metadef | 2 +- parser | 2 +- 14 files changed, 153 insertions(+), 14 deletions(-) diff --git a/ge/client/proto/insert_op.proto b/ge/client/proto/insert_op.proto index c635ca14..bf918b20 100644 --- a/ge/client/proto/insert_op.proto +++ b/ge/client/proto/insert_op.proto @@ -45,6 +45,9 @@ message AippOpParams { // ±êʶ¶ÔÄ£Ð͵ĵڼ¸¸öÊäÈë×öAIPP´¦Àí£¬ÀýÈçÄ£ÐÍÓÐÁ½¸öÊäÈ룬ÐèÒª¶ÔµÚ2¸öÊäÈë×öAIPP£¬ÔòÅäÖÃrelated_input_rankΪ1¡£ uint32 related_input_rank = 2; + // related_input_name is optional and the top name of data node which inserts aipp + string related_input_name = 6; + // input_edge_idx²ÎÊýΪ¿ÉÑ¡£¬ÀàÐÍΪÕûÐÍ£¬ÅäÖ÷¶Î§Îª>=0¡£ // ÅäÖøòÎÊýµÄ×÷Óã¬ÔÚÓÚ¶ÔDataËã×Ó²»Í¬µÄÊä³ö×ö²»Í¬µÄAIPP´¦Àí£¬Èç¹û¸Ã²ÎÊýûÓÐÅäÖã¬Ä¬È϶Ôrelated_input_rankÖ¸¶¨µÄÄ£ÐÍÊäÈëµÄËùÓÐÊä³ö±ß×öAIPP¡£ // ÅäÖÃÖµ <= DataËã×ÓÊä³ö±ßµÄ¸öÊý¡£ diff --git a/ge/common/proto/insert_op.proto b/ge/common/proto/insert_op.proto index c635ca14..bf918b20 100644 --- a/ge/common/proto/insert_op.proto +++ b/ge/common/proto/insert_op.proto @@ -45,6 +45,9 @@ message AippOpParams { // ±êʶ¶ÔÄ£Ð͵ĵڼ¸¸öÊäÈë×öAIPP´¦Àí£¬ÀýÈçÄ£ÐÍÓÐÁ½¸öÊäÈ룬ÐèÒª¶ÔµÚ2¸öÊäÈë×öAIPP£¬ÔòÅäÖÃrelated_input_rankΪ1¡£ uint32 related_input_rank = 2; + // related_input_name is optional and the top name of data node which inserts aipp + string related_input_name = 6; + // input_edge_idx²ÎÊýΪ¿ÉÑ¡£¬ÀàÐÍΪÕûÐÍ£¬ÅäÖ÷¶Î§Îª>=0¡£ // ÅäÖøòÎÊýµÄ×÷Óã¬ÔÚÓÚ¶ÔDataËã×Ó²»Í¬µÄÊä³ö×ö²»Í¬µÄAIPP´¦Àí£¬Èç¹û¸Ã²ÎÊýûÓÐÅäÖã¬Ä¬È϶Ôrelated_input_rankÖ¸¶¨µÄÄ£ÐÍÊäÈëµÄËùÓÐÊä³ö±ß×öAIPP¡£ // ÅäÖÃÖµ <= DataËã×ÓÊä³ö±ßµÄ¸öÊý¡£ diff --git a/ge/executor/proto/insert_op.proto b/ge/executor/proto/insert_op.proto index c635ca14..bf918b20 100644 --- a/ge/executor/proto/insert_op.proto +++ b/ge/executor/proto/insert_op.proto @@ -45,6 +45,9 @@ message AippOpParams { // ±êʶ¶ÔÄ£Ð͵ĵڼ¸¸öÊäÈë×öAIPP´¦Àí£¬ÀýÈçÄ£ÐÍÓÐÁ½¸öÊäÈ룬ÐèÒª¶ÔµÚ2¸öÊäÈë×öAIPP£¬ÔòÅäÖÃrelated_input_rankΪ1¡£ uint32 related_input_rank = 2; + // related_input_name is optional and the top name of data node which inserts aipp + string related_input_name = 6; + // input_edge_idx²ÎÊýΪ¿ÉÑ¡£¬ÀàÐÍΪÕûÐÍ£¬ÅäÖ÷¶Î§Îª>=0¡£ // ÅäÖøòÎÊýµÄ×÷Óã¬ÔÚÓÚ¶ÔDataËã×Ó²»Í¬µÄÊä³ö×ö²»Í¬µÄAIPP´¦Àí£¬Èç¹û¸Ã²ÎÊýûÓÐÅäÖã¬Ä¬È϶Ôrelated_input_rankÖ¸¶¨µÄÄ£ÐÍÊäÈëµÄËùÓÐÊä³ö±ß×öAIPP¡£ // ÅäÖÃÖµ <= DataËã×ÓÊä³ö±ßµÄ¸öÊý¡£ diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index a511dca0..729c47de 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -183,6 +183,11 @@ Status AippOp::InsertAippToGraph(ComputeGraphPtr &graph, std::string &aippConfig GE_CHECK_NOTNULL(graph); NodePtr target_input = nullptr; std::vector> target_edges; + + if (this->ConvertRelatedInputNameToRank() != SUCCESS) { + GELOGE(FAILED, "AippOp: convert related input name to rank failed."); + return FAILED; + } GE_CHK_STATUS_RET(this->GetTargetPosition(graph, target_input, target_edges), "Get data nodes position failed"); std::map out_anchors_to_aipp; @@ -410,6 +415,38 @@ Status AippOp::GetStaticTargetNode(const ComputeGraphPtr &graph, NodePtr &data_n return SUCCESS; } +Status AippOp::ConvertRelatedInputNameToRank() { + GE_CHECK_NOTNULL(aipp_params_); + + string related_input_name = aipp_params_->related_input_name(); + if(related_input_name.empty()) { + return SUCCESS; + } + + std::vector data_top_names = domi::GetContext().data_top_names; + GELOGI("Convert name to rank start: data size[%zu]", data_top_names.size()); + uint32_t index = 0; + bool convert_flag = false; + for (const auto &data_top_name : data_top_names) { + if (related_input_name == data_top_name) { + aipp_params_->set_related_input_rank(index); + convert_flag = true; + GELOGI("AippOp: rank: %u, top name: %s.", index, data_top_name.c_str()); + break; + } + index++; + } + if (!convert_flag) { + string error_msg = "Top name " + related_input_name + "convert rank failed, Please" + " ensure top name in aipp config is the top name of data node."; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); + GELOGE(PARAM_INVALID, "Top name[%s] converts rank failed.", related_input_name.c_str()); + return PARAM_INVALID; + } + + return SUCCESS; +} + Status AippOp::GetTargetPosition(ComputeGraphPtr graph, NodePtr &target_input, std::vector> &target_edges) { diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.h b/ge/graph/preprocess/insert_op/ge_aipp_op.h index 22ae0cea..5e509dda 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.h +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.h @@ -82,6 +82,7 @@ class AippOp : public InsertOpBase { Status AddNodeToGraph(const NodePtr &aipp_node, int64_t max_dynamic_aipp_size); Status AddAippAttrbutes(const OpDescPtr &op_desc, const std::string &aipp_cfg_path, const uint32_t &index); Status AddAttrToAippData(const OpDescPtr &aipp_data_op_desc); + Status ConvertRelatedInputNameToRank(); domi::AippOpParams *aipp_params_ = nullptr; ge::NodePtr aipp_node_ = nullptr; diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 8274ce8c..57929f83 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -34,6 +34,7 @@ #include "graph/utils/op_desc_utils.h" #include "graph/utils/tensor_utils.h" #include "graph/utils/type_utils.h" +#include "util_insert_aipp_op.h" using domi::AippOpParams; @@ -115,22 +116,94 @@ void InsertNewOpUtil::ClearNewOps() { } } -Status InsertNewOpUtil::CheckPositionNotRepeat() { +Status InsertNewOpUtil::CheckInputNamePositionNotRepeat() { + for (int i = 0; i < insert_op_conf_->aipp_op_size(); i++) { + const domi::AippOpParams *item = insert_op_conf_->mutable_aipp_op(i); + GE_CHECK_NOTNULL(item); + + for (int j = i + 1; j < insert_op_conf_->aipp_op_size(); j++) { + const domi::AippOpParams *another_item = insert_op_conf_->mutable_aipp_op(j); + GE_CHECK_NOTNULL(another_item); + if (another_item->related_input_name().empty()) { + string error_msg = "Can not both set related_input_name and related_input_rank!" + " Please ensure param is the same with the first aipp config(related_input_name)."; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); + GELOGE(PARAM_INVALID, + "Can not both set related_input_rank and related_input_name!" + " Please ensure param is the same with the first aipp config(related_input_name)."); + return PARAM_INVALID; + } + if (item->related_input_name() == another_item->related_input_name()) { + string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_name" + " param is different in different aipp config."; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); + GELOGE(PARAM_INVALID, + "Can not insert aipp op to the same postion! Please ensure related_input_rank param " + "is different in different aipp config."); + return PARAM_INVALID; + } + } + } + + return SUCCESS; +} + +Status InsertNewOpUtil::CheckInputRankPositionNoRepeat() { for (int i = 0; i < insert_op_conf_->aipp_op_size(); i++) { const domi::AippOpParams *item = insert_op_conf_->mutable_aipp_op(i); + GE_CHECK_NOTNULL(item); for (int j = i + 1; j < insert_op_conf_->aipp_op_size(); j++) { const domi::AippOpParams *another_item = insert_op_conf_->mutable_aipp_op(j); - GE_IF_BOOL_EXEC(item->related_input_rank() == another_item->related_input_rank(), - string errormsg = "Can not insert aipp to the same postion! Please ensure related_input_rank" - " param is different in different aipp config."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, - "Can not insert aipp op to the same postion! Please ensure related_input_rank param " - "is different in different aipp config."); - return PARAM_INVALID;); + GE_CHECK_NOTNULL(another_item); + if (!another_item->related_input_name().empty()) { + string error_msg = "Can not both set related_input_rank and related_input_name!" + " Please ensure param is the same with the first aipp config(related_input_rank)."; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); + GELOGE(PARAM_INVALID, + "Can not both set related_input_rank and related_input_name!" + " Please ensure param is the same with the first aipp config(related_input_rank)."); + return PARAM_INVALID; + } + if (item->related_input_rank() == another_item->related_input_rank()) { + string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_rank" + " param is different in different aipp config."; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); + GELOGE(PARAM_INVALID, + "Can not insert aipp op to the same postion! Please ensure related_input_rank param " + "is different in different aipp config."); + return PARAM_INVALID; + } } } + + return SUCCESS; + +} + +Status InsertNewOpUtil::CheckPositionNotRepeat() { + GE_CHECK_NOTNULL(insert_op_conf_); + + if (insert_op_conf_->aipp_op_size() <= 1) { + GELOGI("Aipp op size[%d] less than 2, no need to check position repeat.", insert_op_conf_->aipp_op_size()); + return SUCCESS; + } + + const domi::AippOpParams *item = insert_op_conf_->mutable_aipp_op(0); + GE_CHECK_NOTNULL(item); + + string related_input_name = item->related_input_name(); + Status ret = FAILED; + if (related_input_name.empty()) { + ret = CheckInputRankPositionNoRepeat(); + } else { + ret = CheckInputNamePositionNotRepeat(); + } + if (ret != SUCCESS) { + GELOGE(FAILED, "Check position not repeat failed."); + return FAILED; + } + return SUCCESS; } diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.h b/ge/graph/preprocess/insert_op/util_insert_aipp_op.h index e785da98..52e7ed5d 100644 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.h +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.h @@ -51,6 +51,10 @@ class InsertNewOpUtil { Status GetAippParams(const std::unique_ptr &aippParams, const ge::NodePtr &aipp_node); + Status CheckInputNamePositionNotRepeat(); + + Status CheckInputRankPositionNoRepeat(); + Status CheckGraph(const ge::ComputeGraphPtr &graph); InsertNewOpUtil() = default; diff --git a/ge/offline/proto/insert_op.proto b/ge/offline/proto/insert_op.proto index c635ca14..bf918b20 100644 --- a/ge/offline/proto/insert_op.proto +++ b/ge/offline/proto/insert_op.proto @@ -45,6 +45,9 @@ message AippOpParams { // ±êʶ¶ÔÄ£Ð͵ĵڼ¸¸öÊäÈë×öAIPP´¦Àí£¬ÀýÈçÄ£ÐÍÓÐÁ½¸öÊäÈ룬ÐèÒª¶ÔµÚ2¸öÊäÈë×öAIPP£¬ÔòÅäÖÃrelated_input_rankΪ1¡£ uint32 related_input_rank = 2; + // related_input_name is optional and the top name of data node which inserts aipp + string related_input_name = 6; + // input_edge_idx²ÎÊýΪ¿ÉÑ¡£¬ÀàÐÍΪÕûÐÍ£¬ÅäÖ÷¶Î§Îª>=0¡£ // ÅäÖøòÎÊýµÄ×÷Óã¬ÔÚÓÚ¶ÔDataËã×Ó²»Í¬µÄÊä³ö×ö²»Í¬µÄAIPP´¦Àí£¬Èç¹û¸Ã²ÎÊýûÓÐÅäÖã¬Ä¬È϶Ôrelated_input_rankÖ¸¶¨µÄÄ£ÐÍÊäÈëµÄËùÓÐÊä³ö±ß×öAIPP¡£ // ÅäÖÃÖµ <= DataËã×ÓÊä³ö±ßµÄ¸öÊý¡£ diff --git a/ge/proto/insert_op.proto b/ge/proto/insert_op.proto index c635ca14..bf918b20 100644 --- a/ge/proto/insert_op.proto +++ b/ge/proto/insert_op.proto @@ -45,6 +45,9 @@ message AippOpParams { // ±êʶ¶ÔÄ£Ð͵ĵڼ¸¸öÊäÈë×öAIPP´¦Àí£¬ÀýÈçÄ£ÐÍÓÐÁ½¸öÊäÈ룬ÐèÒª¶ÔµÚ2¸öÊäÈë×öAIPP£¬ÔòÅäÖÃrelated_input_rankΪ1¡£ uint32 related_input_rank = 2; + // related_input_name is optional and the top name of data node which inserts aipp + string related_input_name = 6; + // input_edge_idx²ÎÊýΪ¿ÉÑ¡£¬ÀàÐÍΪÕûÐÍ£¬ÅäÖ÷¶Î§Îª>=0¡£ // ÅäÖøòÎÊýµÄ×÷Óã¬ÔÚÓÚ¶ÔDataËã×Ó²»Í¬µÄÊä³ö×ö²»Í¬µÄAIPP´¦Àí£¬Èç¹û¸Ã²ÎÊýûÓÐÅäÖã¬Ä¬È϶Ôrelated_input_rankÖ¸¶¨µÄÄ£ÐÍÊäÈëµÄËùÓÐÊä³ö±ß×öAIPP¡£ // ÅäÖÃÖµ <= DataËã×ÓÊä³ö±ßµÄ¸öÊý¡£ diff --git a/ge/session/omg.cc b/ge/session/omg.cc index f7c681db..0d8e084e 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -1038,6 +1038,7 @@ void UpdateOmgCtxWithParserCtx() { domi::GetContext().out_top_names = GetParserContext().out_top_names; domi::GetContext().user_out_nodes_top_vec = GetParserContext().user_out_nodes_top_vec; domi::GetContext().default_out_nodes = GetParserContext().default_out_nodes; + domi::GetContext().data_top_names = GetParserContext().data_top_names; } void UpdateParserCtxWithOmgCtx() { @@ -1054,5 +1055,6 @@ void UpdateParserCtxWithOmgCtx() { GetParserContext().input_nodes_format_map = domi::GetContext().input_nodes_format_map; GetParserContext().out_top_names = domi::GetContext().out_top_names; GetParserContext().user_out_nodes_top_vec = domi::GetContext().user_out_nodes_top_vec; + GetParserContext().data_top_names = domi::GetContext().data_top_names; } } // namespace ge diff --git a/inc/framework/omg/omg_inner_types.h b/inc/framework/omg/omg_inner_types.h index c48d1649..6cc4afd3 100644 --- a/inc/framework/omg/omg_inner_types.h +++ b/inc/framework/omg/omg_inner_types.h @@ -100,6 +100,8 @@ struct OmgContext { std::vector net_out_nodes; // net out nodes top names(only caffe has top) std::vector out_top_names; + // net data nodes top names(only caffe has top) + std::vector data_top_names; // preferential format used by the entire network domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; domi::FrameworkType type = domi::FRAMEWORK_RESERVED; diff --git a/inc/framework/omg/parser/parser_inner_ctx.h b/inc/framework/omg/parser/parser_inner_ctx.h index b57420eb..b92c6155 100644 --- a/inc/framework/omg/parser/parser_inner_ctx.h +++ b/inc/framework/omg/parser/parser_inner_ctx.h @@ -49,6 +49,8 @@ struct ParserContext { std::vector user_out_nodes_top_vec; // net out nodes (where user_out_nodes or leaf nodes) std::vector net_out_nodes; + // net data nodes top names(only caffe has top) + std::vector data_top_names; // net out nodes top names(only caffe has top) std::vector out_top_names; // Whether to use dynamic batch size or dynamic image size @@ -57,9 +59,12 @@ struct ParserContext { domi::domiTensorFormat_t format = domi::DOMI_TENSOR_ND; domi::FrameworkType type = domi::FRAMEWORK_RESERVED; RunMode run_mode = ONLY_PRE_CHECK; - std::string custom_proto_path; // save caffe custom proto path, used by caffe parse - std::string caffe_proto_path; // save caffe proto path, used by caffe parse - std::string enable_scope_fusion_passes; // name of the pass that needs to take effect + // save caffe custom proto path, used by caffe parse + std::string custom_proto_path; + // save caffe proto path, used by caffe parse + std::string caffe_proto_path; + // name of the pass that needs to take effect + std::string enable_scope_fusion_passes; }; ParserContext &GetParserContext(); diff --git a/metadef b/metadef index 1cc55bca..5d06bc75 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 1cc55bcae09902b3d158993dd57bfbd1d3337066 +Subproject commit 5d06bc7547189f24195b3cedcb0bfc3d787c80a5 diff --git a/parser b/parser index db4e6070..5af5c72f 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit db4e6070bb2cec01cead264a44ceae07e7f3048e +Subproject commit 5af5c72fba1315f3d52113a5e88dc618d68e7dbc From a9db5bc32de49420e83bd35ca00c309d95ff224e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Oct 2020 21:43:35 +0800 Subject: [PATCH 12/27] Correct workspace reuse judge. --- ge/graph/build/memory/block_mem_assigner.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ge/graph/build/memory/block_mem_assigner.cc b/ge/graph/build/memory/block_mem_assigner.cc index 90c82870..2d30c57e 100755 --- a/ge/graph/build/memory/block_mem_assigner.cc +++ b/ge/graph/build/memory/block_mem_assigner.cc @@ -866,12 +866,10 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size, string ge_disable_reuse_mem_env = "0"; (void)ge::GetContext().GetOption(OPTION_EXEC_DISABLE_REUSED_MEMORY, ge_disable_reuse_mem_env); if (ge_disable_reuse_mem_env != "1") { - bool reuse_mem_flag = !((workspace_reuse_flag.size() > out_index) && !workspace_reuse_flag[out_index]); + bool reuse_mem_flag = (mem_type == kOutput) ? IsPreReuse(n, out_index) : + !((workspace_reuse_flag.size() > out_index) && !workspace_reuse_flag[out_index]); is_reuse_memory = !node_op_desc->HasAttr(kL2FusionDynamicConvergeOp) && - !node_op_desc->HasAttr(kOpNoReuseMem) && - reuse_mem_flag && - is_op_reuse_mem && - (IsPreReuse(n, out_index)); + !node_op_desc->HasAttr(kOpNoReuseMem) && reuse_mem_flag && is_op_reuse_mem; auto stream_id = node_op_desc->GetStreamId(); if (is_reuse_memory && !continuous && !reusable_blocks_[memory_type].empty()) { for (auto it = reusable_blocks_[memory_type][stream_id].begin(); From 09fed7e9981f5fe66c48256078c9ca809bcf9d51 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Tue, 27 Oct 2020 21:54:55 +0800 Subject: [PATCH 13/27] update build.sh and thirdparty include --- CMakeLists.txt | 13 ++- build.sh | 75 +++++++++++++- metadef | 2 +- parser | 2 +- third_party/fwkacllib/inc/mmpa/mmpa_api.h | 18 ++-- .../fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h | 69 +++++++++++++ .../inc/mmpa/sub_inc/mmpa_typedef_linux.h | 3 + .../fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_win.h | 6 +- third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h | 84 +++++++++++++++- third_party/fwkacllib/inc/ops/aipp.h | 2 +- third_party/fwkacllib/inc/ops/all_ops.h | 2 +- third_party/fwkacllib/inc/ops/array_ops.h | 2 +- third_party/fwkacllib/inc/ops/audio_ops.h | 2 +- third_party/fwkacllib/inc/ops/batch_ops.h | 2 +- third_party/fwkacllib/inc/ops/bitwise_ops.h | 2 +- third_party/fwkacllib/inc/ops/boosted_trees_ops.h | 2 +- .../fwkacllib/inc/ops/candidate_sampling_ops.h | 2 +- third_party/fwkacllib/inc/ops/condtake_ops.h | 2 +- third_party/fwkacllib/inc/ops/control_flow_ops.h | 2 +- third_party/fwkacllib/inc/ops/ctc_ops.h | 2 +- third_party/fwkacllib/inc/ops/data_flow_ops.h | 2 +- .../fwkacllib/inc/ops/elewise_calculation_ops.h | 2 +- third_party/fwkacllib/inc/ops/functional_ops.h | 2 +- third_party/fwkacllib/inc/ops/get_data_ops.h | 2 +- third_party/fwkacllib/inc/ops/hcom_ops.h | 2 +- third_party/fwkacllib/inc/ops/hvd_ops.h | 2 +- third_party/fwkacllib/inc/ops/image_ops.h | 2 +- third_party/fwkacllib/inc/ops/internal_ops.h | 2 +- third_party/fwkacllib/inc/ops/linalg_ops.h | 2 +- third_party/fwkacllib/inc/ops/logging_ops.h | 2 +- third_party/fwkacllib/inc/ops/lookup_ops.h | 2 +- third_party/fwkacllib/inc/ops/math_ops.h | 2 +- .../fwkacllib/inc/ops/matrix_calculation_ops.h | 2 +- third_party/fwkacllib/inc/ops/max_pool_v3.h | 77 --------------- third_party/fwkacllib/inc/ops/max_pool_v3_grad.h | 80 --------------- third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h | 2 +- third_party/fwkacllib/inc/ops/nn_calculation_ops.h | 2 +- third_party/fwkacllib/inc/ops/nn_detect_ops.h | 2 +- third_party/fwkacllib/inc/ops/nn_norm_ops.h | 2 +- third_party/fwkacllib/inc/ops/nn_ops.h | 2 +- third_party/fwkacllib/inc/ops/nn_pooling_ops.h | 108 ++++++++++++++++++++- third_party/fwkacllib/inc/ops/nn_training_ops.h | 2 +- third_party/fwkacllib/inc/ops/no_op.h | 2 +- third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h | 2 +- third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h | 2 +- third_party/fwkacllib/inc/ops/outfeed_ops.h | 2 +- third_party/fwkacllib/inc/ops/pad_ops.h | 4 +- third_party/fwkacllib/inc/ops/parsing_ops.h | 2 +- third_party/fwkacllib/inc/ops/quantize_ops.h | 2 +- third_party/fwkacllib/inc/ops/ragged_array_ops.h | 2 +- .../fwkacllib/inc/ops/ragged_conversion_ops.h | 2 +- third_party/fwkacllib/inc/ops/ragged_math_ops.h | 2 +- third_party/fwkacllib/inc/ops/random_ops.h | 2 +- third_party/fwkacllib/inc/ops/reduce_ops.h | 2 +- .../fwkacllib/inc/ops/resource_variable_ops.h | 2 +- third_party/fwkacllib/inc/ops/rnn.h | 2 +- third_party/fwkacllib/inc/ops/rpn_ops.h | 2 +- third_party/fwkacllib/inc/ops/save_ops.h | 2 +- third_party/fwkacllib/inc/ops/sdca_ops.h | 2 +- third_party/fwkacllib/inc/ops/selection_ops.h | 4 +- third_party/fwkacllib/inc/ops/set_ops.h | 2 +- third_party/fwkacllib/inc/ops/sparse_ops.h | 2 +- third_party/fwkacllib/inc/ops/spectral_ops.h | 2 +- .../fwkacllib/inc/ops/split_combination_ops.h | 2 +- third_party/fwkacllib/inc/ops/state_ops.h | 2 +- .../fwkacllib/inc/ops/stateful_random_ops.h | 2 +- .../fwkacllib/inc/ops/stateless_random_ops.h | 2 +- third_party/fwkacllib/inc/ops/string_ops.h | 2 +- third_party/fwkacllib/inc/ops/swap_co_ops.h | 2 +- third_party/fwkacllib/inc/ops/transformation_ops.h | 2 +- .../fwkacllib/inc/ops/warp_perspective_ops.h | 2 +- .../fwkacllib/inc/register/op_kernel_registry.h | 1 + third_party/fwkacllib/inc/runtime/base.h | 13 ++- third_party/fwkacllib/inc/runtime/config.h | 10 +- third_party/fwkacllib/inc/runtime/context.h | 10 +- third_party/fwkacllib/inc/runtime/dev.h | 10 +- third_party/fwkacllib/inc/runtime/dvfsprofile.h | 10 +- third_party/fwkacllib/inc/runtime/event.h | 10 +- third_party/fwkacllib/inc/runtime/kernel.h | 10 +- third_party/fwkacllib/inc/runtime/mem.h | 12 ++- third_party/fwkacllib/inc/runtime/rt.h | 10 +- third_party/fwkacllib/inc/runtime/rt_model.h | 29 +++++- third_party/fwkacllib/inc/runtime/stream.h | 10 +- third_party/fwkacllib/inc/tdt/status.h | 2 +- .../fwkacllib/inc/toolchain/adx_datadump_server.h | 22 ++--- 85 files changed, 505 insertions(+), 313 deletions(-) delete mode 100644 third_party/fwkacllib/inc/ops/max_pool_v3.h delete mode 100644 third_party/fwkacllib/inc/ops/max_pool_v3_grad.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c5f5ef4b..41aad1a9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,14 +89,18 @@ if (ENABLE_OPEN_SRC) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) - if(NOT PRODUCT STREQUAL "flr3") + if(PRODUCT STREQUAL "flr3") + find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) + elseif(PRODUCT STREQUAL "flr1") + find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver) + find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR}) + elseif(PRODUCT STREQUAL "flr2") + # flr2 ascend_hal_stub limsprof ? + else() find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}) find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR}) - else() - find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) endif() elseif(PLATFORM STREQUAL "all") - #mdc没有 dc在driver目录 find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR}) find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR}) find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR}) @@ -106,7 +110,6 @@ if (ENABLE_OPEN_SRC) find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR}) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) - #mdc没有 dc在driver/lib64/driver find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver) find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) else() diff --git a/build.sh b/build.sh index 60ca950c..51c5e999 100644 --- a/build.sh +++ b/build.sh @@ -95,6 +95,9 @@ checkopts() } checkopts "$@" +git submodule update --init metadef +git submodule update --init parser + mk_dir() { local create_dir="$1" # the target to make @@ -134,7 +137,7 @@ build_graphengine() echo "execute command: cmake ${CMAKE_ARGS} .. failed." return 1 fi - COMMON_TARGET="ge_common engine fmk_parser parser_common _caffe_parser fmk_onnx_parser graph register " + COMMON_TARGET="ge_common engine fmk_parser parser_common _caffe_parser fmk_onnx_parser graph register engine_conf.json optimizer_priority.pbtxt " TARGET=${COMMON_TARGET} if [ "x${PLATFORM}" = "xtrain" ] then @@ -211,14 +214,80 @@ generate_package() cd "${BASEPATH}" GRAPHENGINE_LIB_PATH="lib" + ACL_PATH="acllib/lib64" + FWK_PATH="fwkacllib/lib64" + ATC_PATH="atc/lib64" + ATC_BIN_PATH="atc/bin" + NNENGINE_PATH="plugin/nnengine/ge_config" + OPSKERNEL_PATH="plugin/opskernel" + + ATC_LIB=("libc_sec.so" "libge_common.so" "libge_compiler.so" "libgraph.so" "libregister.so") + FWK_LIB=("libge_common.so" "libge_runner.so" "libgraph.so" "libregister.so") + PLUGIN_OPSKERNEL=("libge_local_engine.so" "libge_local_opskernel_builder.so" "libhost_cpu_engine.so" "libhost_cpu_opskernel_builder.so" "optimizer_priority.pbtxt") + PARSER_LIB=("lib_caffe_parser.so" "libfmk_onnx_parser.so" "libfmk_parser.so" "libparser_common.so") + rm -rf ${OUTPUT_PATH:?}/${FWK_PATH}/ + rm -rf ${OUTPUT_PATH:?}/${ACL_PATH}/ + rm -rf ${OUTPUT_PATH:?}/${ATC_PATH}/ + rm -rf ${OUTPUT_PATH:?}/${ATC_BIN_PATH}/ + + mk_dir "${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}" + mk_dir "${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH}" + mk_dir "${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}" + mk_dir "${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH}" + mk_dir "${OUTPUT_PATH}/${ACL_PATH}" + mk_dir "${OUTPUT_PATH}/${ATC_BIN_PATH}" + cd "${OUTPUT_PATH}" find ./ -name graphengine_lib.tar -exec rm {} \; - find ./bin -name atc -exec cp {} "${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}" \; + cp ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}/engine_conf.json ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH} + cp ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}/engine_conf.json ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH} + + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}/../ \; + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}/../ \; + + MAX_DEPTH=1 + if [ "x${PLATFORM}" = "xall" ] || [ "x${PLATFORM}" = "xinference" ] + then + MAX_DEPTH=2 + fi + for lib in "${PLUGIN_OPSKERNEL[@]}"; + do + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth ${MAX_DEPTH} -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH} \; + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth ${MAX_DEPTH} -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH} \; + done + + for lib in "${PARSER_LIB[@]}"; + do + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; + done + + for lib in "${FWK_LIB[@]}"; + do + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; + done + + for lib in "${ATC_LIB[@]}"; + do + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \; + done + + find ./bin -name atc -exec cp {} "${OUTPUT_PATH}/${ATC_BIN_PATH}" \; + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "libregister.a" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; - tar -cf graphengine_lib.tar "${GRAPHENGINE_LIB_PATH}" + if [ "x${PLATFORM}" = "xtrain" ] + then + tar -cf graphengine_lib.tar fwkacllib + elif [ "x${PLATFORM}" = "xinference" ] + then + tar -cf graphengine_lib.tar acllib atc + elif [ "x${PLATFORM}" = "xall" ] + then + tar -cf graphengine_lib.tar fwkacllib acllib atc + fi } if [[ "X$ENABLE_GE_UT" = "Xoff" ]]; then diff --git a/metadef b/metadef index 5d06bc75..d4d3655d 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 5d06bc7547189f24195b3cedcb0bfc3d787c80a5 +Subproject commit d4d3655d2257c8e3e78b338aa02af47bdcfda21b diff --git a/parser b/parser index 5af5c72f..702254b9 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 5af5c72fba1315f3d52113a5e88dc618d68e7dbc +Subproject commit 702254b9d482d38ef8eaa9ca894327286b4da118 diff --git a/third_party/fwkacllib/inc/mmpa/mmpa_api.h b/third_party/fwkacllib/inc/mmpa/mmpa_api.h index f1e30538..f5b80269 100644 --- a/third_party/fwkacllib/inc/mmpa/mmpa_api.h +++ b/third_party/fwkacllib/inc/mmpa/mmpa_api.h @@ -17,10 +17,10 @@ #ifndef _MMPA_API_H_ #define _MMPA_API_H_ -#define LINUX 0 -#define WIN 1 +#define LINUX 0 +#define WIN 1 -#if(OS_TYPE == LINUX) +#if(OS_TYPE == LINUX) //lint !e553 #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -75,6 +75,7 @@ #include #include #include +#include #include "securec.h" @@ -84,7 +85,7 @@ #endif -#if(OS_TYPE == WIN) +#if(OS_TYPE == WIN) //lint !e553 #include #include #include "Windows.h" @@ -103,16 +104,19 @@ #include #include "shlwapi.h" #include -#include "sub_inc/mmpa_typedef_win.h" -#include "sub_inc/mmpa_win.h" #include #include #include #include - +#include #include #include +#include "securec.h" + +#include "sub_inc/mmpa_typedef_win.h" +#include "sub_inc/mmpa_win.h" + #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "mswsock.lib") #pragma comment(lib, "Kernel32.lib") diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h index 6ac8f8f6..aced4968 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h @@ -30,18 +30,26 @@ typedef pthread_t mmThread; typedef pthread_mutex_t mmMutex_t; typedef pthread_cond_t mmCond; typedef pthread_mutex_t mmMutexFC; +typedef pthread_rwlock_t mmRWLock_t; typedef signed int mmProcess; typedef int mmPollHandle; typedef int mmPipeHandle; +typedef int mmFileHandle; typedef int mmComPletionKey; typedef int mmCompletionHandle; +typedef int mmErrorMsg; +typedef int mmFd_t; typedef VOID *mmExitCode; typedef key_t mmKey_t; typedef int mmMsgid; typedef struct dirent mmDirent; +typedef struct shmid_ds mmshmId_ds; typedef int (*mmFilter)(const mmDirent *entry); typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); +typedef size_t mmSize_t; +typedef off_t mmOfft_t; +typedef pid_t mmPid_t; typedef VOID *(*userProcFunc)(VOID *pulArg); @@ -51,6 +59,16 @@ typedef struct { } mmUserBlock_t; typedef struct { + const char *dli_fname; + void *dli_fbase; + const char *dli_sname; + void *dli_saddr; + size_t dli_size; /* ELF only */ + int dli_bind; /* ELF only */ + int dli_type; +} mmDlInfo; + +typedef struct { int wSecond; // Seconds. [0-60] (1 leap second) int wMinute; // Minutes. [0-59] int wHour; // Hours. [0-23] @@ -73,6 +91,7 @@ typedef pthread_key_t mmThreadKey; typedef int mmOverLap; typedef ssize_t mmSsize_t; +typedef size_t mmSize; // size typedef struct { UINT32 createFlag; @@ -201,6 +220,17 @@ typedef struct { #define M_RDWR O_RDWR #define M_CREAT O_CREAT #define M_BINARY O_RDONLY +#define M_TRUNC O_TRUNC +#define M_IRWXU S_IRWXU + +#define M_IN_CREATE IN_CREATE +#define M_IN_CLOSE_WRITE IN_CLOSE_WRITE +#define M_IN_IGNORED IN_IGNORED + +#define M_OUT_CREATE IN_CREATE +#define M_OUT_CLOSE_WRITE IN_CLOSE_WRITE +#define M_OUT_IGNORED IN_IGNORED +#define M_OUT_ISDIR IN_ISDIR #define M_IREAD S_IREAD #define M_IRUSR S_IRUSR @@ -236,13 +266,20 @@ typedef struct { #define MMPA_OPTIONAL_ARGUMENT 2 #define MMPA_MAX_PATH PATH_MAX +#define M_NAME_MAX MAX_FNAME #define M_F_OK F_OK #define M_R_OK R_OK #define M_W_OK W_OK +#define MMPA_STDIN STDIN_FILENO +#define MMPA_STDOUT STDOUT_FILENO +#define MMPA_STDERR STDERR_FILENO + #define MMPA_RTLD_NOW RTLD_NOW #define MMPA_RTLD_GLOBAL RTLD_GLOBAL +#define MMPA_RTLD_LAZY RTLD_LAZY +#define MMPA_RTLD_NODELETE RTLD_NODELETE #define MMPA_DL_EXT_NAME ".so" @@ -250,6 +287,7 @@ extern INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); extern INT32 mmJoinTask(mmThread *threadHandle); extern INT32 mmMutexInit(mmMutex_t *mutex); extern INT32 mmMutexLock(mmMutex_t *mutex); +extern INT32 mmMutexTryLock(mmMutex_t *mutex); extern INT32 mmMutexUnLock(mmMutex_t *mutex); extern INT32 mmMutexDestroy(mmMutex_t *mutex); extern INT32 mmCondInit(mmCond *cond); @@ -257,6 +295,14 @@ extern INT32 mmCondLockInit(mmMutexFC *mutex); extern INT32 mmCondLock(mmMutexFC *mutex); extern INT32 mmCondUnLock(mmMutexFC *mutex); extern INT32 mmCondLockDestroy(mmMutexFC *mutex); +extern INT32 mmRWLockInit(mmRWLock_t *rwLock); +extern INT32 mmRWLockRDLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockWRLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); +extern INT32 mmRDLockUnLock(mmRWLock_t *rwLock); +extern INT32 mmWRLockUnLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockDestroy(mmRWLock_t *rwLock); extern INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); extern INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); extern INT32 mmCondNotify(mmCond *cond); @@ -266,6 +312,7 @@ extern INT32 mmGetPid(); extern INT32 mmGetTid(); extern INT32 mmGetPidHandle(mmProcess *processHandle); extern INT32 mmGetLocalTime(mmSystemTime_t *sysTime); +extern INT32 mmGetSystemTime(mmSystemTime_t *sysTime); extern INT32 mmSemInit(mmSem_t *sem, UINT32 value); extern INT32 mmSemWait(mmSem_t *sem); @@ -273,7 +320,9 @@ extern INT32 mmSemPost(mmSem_t *sem); extern INT32 mmSemDestroy(mmSem_t *sem); extern INT32 mmOpen(const CHAR *pathName, INT32 flags); extern INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); +extern FILE *mmPopen(CHAR *command, CHAR *type); extern INT32 mmClose(INT32 fd); +extern INT32 mmPclose(FILE *stream); extern mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); extern mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); extern mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); @@ -284,9 +333,22 @@ extern INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLe extern INT32 mmCloseSocket(mmSockHandle sockFd); extern mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); extern mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); +extern INT32 mmSocketSendTo(mmSockHandle sockFd, + VOID *sendMsg, + INT32 sendLen, + UINT32 sendFlag, + const mmSockAddr* addr, + INT32 tolen); +extern mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, + VOID *recvBuf, + mmSize recvLen, + UINT32 recvFlag, + mmSockAddr* addr, + mmSocklen_t *FromLen); extern INT32 mmSAStartup(); extern INT32 mmSACleanup(); extern VOID *mmDlopen(const CHAR *fileName, INT32 mode); +extern INT32 mmDladdr(VOID *addr, mmDlInfo *info); extern VOID *mmDlsym(VOID *handle, CHAR *funcName); extern INT32 mmDlclose(VOID *handle); extern CHAR *mmDlerror(); @@ -294,6 +356,7 @@ extern INT32 mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock extern INT32 mmDeleteTimer(mmTimer timerHandle); extern INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); extern INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); +extern INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); extern INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); extern INT32 mmSleep(UINT32 milliSecond); @@ -337,6 +400,7 @@ extern VOID mmCloseCompletionPort(mmCompletionHandle handle); extern INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, pmmPollData polledData, mmPollBack pollBack); extern INT32 mmGetErrorCode(); +extern CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); extern INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); extern mmTimespec mmGetTickCount(); extern INT32 mmGetRealPath(CHAR *path, CHAR *realPath); @@ -382,6 +446,7 @@ extern INT32 mmTlsDelete(mmThreadKey key); extern INT32 mmGetOsType(); extern INT32 mmFsync(mmProcess fd); +extern INT32 mmFsync2(INT32 fd); extern INT32 mmChdir(const CHAR *path); extern INT32 mmUmask(INT32 pmode); extern INT32 mmThreadKill(mmThread id); @@ -439,6 +504,10 @@ extern INT32 mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const c extern INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, const mmThreadAttr *threadAttr); +extern mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); +extern INT32 mmShmUnlink(const CHAR *name); +extern VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); +extern INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); #define MMPA_DLL_API #ifdef __cplusplus diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_linux.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_linux.h index fc862a72..9df5b9ce 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_linux.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_linux.h @@ -79,6 +79,8 @@ typedef long LONG; #define MMPA_THREAD_SCHED_OTHER SCHED_OTHER #define MMPA_THREAD_MIN_STACK_SIZE PTHREAD_STACK_MIN +#define MM_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + #define MMPA_MAX_NI 19 #define MMPA_MIN_NI (-20) @@ -86,6 +88,7 @@ typedef long LONG; #define EN_ERR 1 #define EN_ERROR (-1) #define EN_INVALID_PARAM (-2) +#define EN_TIMEOUT (-3) #ifdef __cplusplus #if __cplusplus diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_win.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_win.h index fc1b4858..8200bea6 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_win.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_typedef_win.h @@ -1,4 +1,4 @@ -/** +/** * Copyright 2019-2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ extern "C" { #define EN_ERR 1 #define EN_ERROR (-1) #define EN_INVALID_PARAM (-2) +#define EN_TIMEOUT (-3) #define HANDLE_INVALID_VALUE (-1) #define INVALID_SOCKET_HANDLE INVALID_SOCKET @@ -60,6 +61,7 @@ extern "C" { #define MMPA_MIDDLE_NI 5 #define MMPA_LOW_NI (-5) #define MMPA_MIN_NI (-20) +#define MMPA_MAX_FILE 128 #define MMPA_MAX_THREAD_PIO 99 #define MMPA_MIDDLE_THREAD_PIO 66 @@ -71,6 +73,8 @@ extern "C" { #define MMPA_THREAD_SCHED_OTHER 0 #define MMPA_THREAD_MIN_STACK_SIZE 0 +#define MM_MUTEX_INITIALIZER NULL + #ifdef __cplusplus #if __cplusplus } diff --git a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h index 68a70c27..6adc1426 100644 --- a/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h +++ b/third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h @@ -1,4 +1,4 @@ -/** +/** * Copyright 2019-2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,8 +43,9 @@ typedef HANDLE mmThread; typedef HANDLE mmProcess; typedef HANDLE mmPollHandle; typedef HANDLE mmPipeHandle; +typedef HANDLE mmFileHandle; typedef HANDLE mmCompletionHandle; - +typedef HANDLE mmFd_t; typedef CRITICAL_SECTION mmMutexFC; typedef CONDITION_VARIABLE mmCond; @@ -59,15 +60,22 @@ typedef SYSTEMTIME mmSystemTime_t; typedef HANDLE mmSem_t; typedef SOCKET mmSockHandle; +typedef SRWLOCK mmRWLock_t; typedef struct sockaddr mmSockAddr; typedef int mmSocklen_t; typedef int mmSemTimeout_t; typedef long mmAtomicType; typedef DWORD mmExitCode; +typedef DWORD mmErrorMsg; typedef int mmKey_t; typedef HANDLE mmMsgid; +typedef long int mmOfft_t; +typedef int mmPid_t; typedef INT32 mmSsize_t; +typedef int mmSize; // size +typedef size_t mmSize_t; +typedef VOID mmshmId_ds; typedef enum { DT_DIR = FILE_ATTRIBUTE_DIRECTORY, @@ -182,6 +190,16 @@ typedef struct { } mmDiskSize; typedef struct { + const char *dli_fname; + void *dli_fbase; + const char *dli_sname; + void *dli_saddr; + size_t dli_size; /* ELF only */ + int dli_bind; /* ELF only */ + int dli_type; +} mmDlInfo; + +typedef struct { char addr[MMPA_MACINFO_DEFAULT_SIZE]; // ex:aa-bb-cc-dd-ee-ff\0 } mmMacInfo; @@ -223,8 +241,10 @@ typedef VOID (*mmPf)(VOID); #define M_RDONLY _O_RDONLY #define M_WRONLY _O_WRONLY #define M_RDWR _O_RDWR +#define M_IRWXU _O_RDWR #define M_CREAT _O_CREAT #define M_BINARY _O_BINARY +#define M_TRUNC _O_TRUNC #define M_IREAD _S_IREAD #define M_IRUSR _S_IREAD @@ -232,6 +252,15 @@ typedef VOID (*mmPf)(VOID); #define M_IWUSR _S_IWRITE #define M_IXUSR 0 +#define M_IN_CREATE FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME +#define M_IN_CLOSE_WRITE FILE_NOTIFY_CHANGE_LAST_WRITE +#define M_IN_IGNORED FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME + +#define M_OUT_CREATE 0x00000100 +#define M_OUT_CLOSE_WRITE 0x00000008 +#define M_OUT_IGNORED 0x00008000 +#define M_OUT_ISDIR 0x40000000 + #define M_MSG_CREAT 1 #define M_MSG_EXCL 2 #define M_MSG_NOWAIT 3 @@ -251,6 +280,16 @@ typedef VOID (*mmPf)(VOID); #define M_UMASK_GRPEXEC 0 #define M_UMASK_OTHEXEC 0 +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 + #define mmConstructor(x) __declspec(allocate(".CRT$XCU")) mmPf con = x #define mmDestructor(x) __declspec(allocate(".CRT$XPU")) mmPf de = x @@ -269,13 +308,20 @@ typedef VOID (*mmPf)(VOID); #define MMPA_EMSG "" #define MMPA_MAX_PATH MAX_PATH +#define M_NAME_MAX _MAX_FNAME #define M_F_OK 0 #define M_W_OK 2 #define M_R_OK 4 +#define MMPA_STDIN stdin +#define MMPA_STDOUT stdout +#define MMPA_STDERR stderr + #define MMPA_RTLD_NOW 0 #define MMPA_RTLD_GLOBAL 0 +#define MMPA_RTLD_LAZY 0 +#define MMPA_RTLD_NODELETE 0 #define MMPA_DL_EXT_NAME ".dll" @@ -285,6 +331,7 @@ _declspec(dllexport) INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *f _declspec(dllexport) INT32 mmJoinTask(mmThread *threadHandle); _declspec(dllexport) INT32 mmMutexInit(mmMutex_t *mutex); _declspec(dllexport) INT32 mmMutexLock(mmMutex_t *mutex); +_declspec(dllexport) INT32 mmMutexTryLock(mmMutex_t *mutex); _declspec(dllexport) INT32 mmMutexUnLock(mmMutex_t *mutex); _declspec(dllexport) INT32 mmMutexDestroy(mmMutex_t *mutex); _declspec(dllexport) INT32 mmCondInit(mmCond *cond); @@ -292,6 +339,14 @@ _declspec(dllexport) INT32 mmCondLockInit(mmMutexFC *mutex); _declspec(dllexport) INT32 mmCondLock(mmMutexFC *mutex); _declspec(dllexport) INT32 mmCondUnLock(mmMutexFC *mutex); _declspec(dllexport) INT32 mmCondLockDestroy(mmMutexFC *mutex); +_declspec(dllexport) INT32 mmRWLockInit(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockRDLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockWRLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRDLockUnLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmWRLockUnLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockDestroy(mmRWLock_t *rwLock); _declspec(dllexport) INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); _declspec(dllexport) INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); @@ -302,13 +357,16 @@ _declspec(dllexport) INT32 mmGetPid(VOID); _declspec(dllexport) INT32 mmGetTid(VOID); _declspec(dllexport) INT32 mmGetPidHandle(mmProcess *processHandle); _declspec(dllexport) INT32 mmGetLocalTime(mmSystemTime_t *sysTime); +_declspec(dllexport) INT32 mmGetSystemTime(mmSystemTime_t *sysTime); _declspec(dllexport) INT32 mmSemInit(mmSem_t *sem, UINT32 value); _declspec(dllexport) INT32 mmSemWait(mmSem_t *sem); _declspec(dllexport) INT32 mmSemPost(mmSem_t *sem); _declspec(dllexport) INT32 mmSemDestroy(mmSem_t *sem); _declspec(dllexport) INT32 mmOpen(const CHAR *pathName, INT32 flags); _declspec(dllexport) INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); +_declspec(dllexport) FILE *mmPopen(CHAR *command, CHAR *type); _declspec(dllexport) INT32 mmClose(INT32 fd); +_declspec(dllexport) INT32 mmPclose(FILE *stream); _declspec(dllexport) mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); _declspec(dllexport) mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); _declspec(dllexport) mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); @@ -319,9 +377,22 @@ _declspec(dllexport) INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSo _declspec(dllexport) INT32 mmCloseSocket(mmSockHandle sockFd); _declspec(dllexport) mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); _declspec(dllexport) mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); +_declspec(dllexport) INT32 mmSocketSendTo(mmSockHandle sockFd, + VOID *sendMsg, + INT32 sendLen, + UINT32 sendFlag, + const mmSockAddr* addr, + INT32 tolen); +_declspec(dllexport) mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, + VOID *recvBuf, + mmSize recvLen, + UINT32 recvFlag, + mmSockAddr* addr, + mmSocklen_t *FromLen); _declspec(dllexport) INT32 mmSAStartup(VOID); _declspec(dllexport) INT32 mmSACleanup(VOID); _declspec(dllexport) VOID *mmDlopen(const CHAR *fileName, INT mode); +_declspec(dllexport) INT32 mmDladdr(VOID *addr, mmDlInfo *info); _declspec(dllexport) VOID *mmDlsym(VOID *handle, CHAR *fileName); _declspec(dllexport) INT32 mmDlclose(VOID *handle); _declspec(dllexport) CHAR *mmDlerror(VOID); @@ -330,6 +401,7 @@ _declspec(dllexport) INT32 _declspec(dllexport) INT32 mmDeleteTimer(mmTimer timerHandle); _declspec(dllexport) INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); _declspec(dllexport) INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); +_declspec(dllexport) INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); _declspec(dllexport) INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); _declspec(dllexport) INT32 mmSleep(UINT32 milliSecond); _declspec(dllexport) INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); @@ -371,6 +443,7 @@ _declspec(dllexport) INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, m pmmPollData polledData, mmPollBack pollBack); _declspec(dllexport) INT32 mmGetErrorCode(); +_declspec(dllexport) CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); _declspec(dllexport) INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); _declspec(dllexport) mmTimespec mmGetTickCount(); _declspec(dllexport) INT32 mmGetRealPath(CHAR *path, CHAR *realPath); @@ -407,7 +480,7 @@ _declspec(dllexport) INT32 mmTlsDelete(mmThreadKey key); _declspec(dllexport) INT32 mmGetOsType(); _declspec(dllexport) INT32 mmFsync(mmProcess fd); - +_declspec(dllexport) INT32 mmFsync2(INT32 fd); _declspec(dllexport) INT32 mmChdir(const CHAR *path); _declspec(dllexport) INT32 mmUmask(INT32 pmode); _declspec(dllexport) INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); @@ -455,7 +528,10 @@ _declspec(dllexport) INT32 _declspec(dllexport) INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, const mmThreadAttr *threadAttr); - +_declspec(dllexport) mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); +_declspec(dllexport) INT32 mmShmUnlink(const CHAR *name); +_declspec(dllexport) VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); +_declspec(dllexport) INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); #ifdef __cplusplus #if __cplusplus } diff --git a/third_party/fwkacllib/inc/ops/aipp.h b/third_party/fwkacllib/inc/ops/aipp.h index bed984bd..478f6c83 100644 --- a/third_party/fwkacllib/inc/ops/aipp.h +++ b/third_party/fwkacllib/inc/ops/aipp.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/all_ops.h b/third_party/fwkacllib/inc/ops/all_ops.h index 1ac83783..614b06e2 100644 --- a/third_party/fwkacllib/inc/ops/all_ops.h +++ b/third_party/fwkacllib/inc/ops/all_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/array_ops.h b/third_party/fwkacllib/inc/ops/array_ops.h index e1f64421..691b51f6 100644 --- a/third_party/fwkacllib/inc/ops/array_ops.h +++ b/third_party/fwkacllib/inc/ops/array_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/audio_ops.h b/third_party/fwkacllib/inc/ops/audio_ops.h index d9883253..f05135d1 100644 --- a/third_party/fwkacllib/inc/ops/audio_ops.h +++ b/third_party/fwkacllib/inc/ops/audio_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/batch_ops.h b/third_party/fwkacllib/inc/ops/batch_ops.h index 8a1c5a7b..a4786cd3 100644 --- a/third_party/fwkacllib/inc/ops/batch_ops.h +++ b/third_party/fwkacllib/inc/ops/batch_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/bitwise_ops.h b/third_party/fwkacllib/inc/ops/bitwise_ops.h index 5c83e161..39a28cf3 100644 --- a/third_party/fwkacllib/inc/ops/bitwise_ops.h +++ b/third_party/fwkacllib/inc/ops/bitwise_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/boosted_trees_ops.h b/third_party/fwkacllib/inc/ops/boosted_trees_ops.h index 550e8b7d..08e54824 100644 --- a/third_party/fwkacllib/inc/ops/boosted_trees_ops.h +++ b/third_party/fwkacllib/inc/ops/boosted_trees_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h b/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h index e20607bf..890c52ae 100644 --- a/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h +++ b/third_party/fwkacllib/inc/ops/candidate_sampling_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/condtake_ops.h b/third_party/fwkacllib/inc/ops/condtake_ops.h index 5e91eb07..029cffbf 100644 --- a/third_party/fwkacllib/inc/ops/condtake_ops.h +++ b/third_party/fwkacllib/inc/ops/condtake_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/control_flow_ops.h b/third_party/fwkacllib/inc/ops/control_flow_ops.h index 7196b14f..c0b6ad72 100644 --- a/third_party/fwkacllib/inc/ops/control_flow_ops.h +++ b/third_party/fwkacllib/inc/ops/control_flow_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/ctc_ops.h b/third_party/fwkacllib/inc/ops/ctc_ops.h index 2c75fd09..c6a265cc 100644 --- a/third_party/fwkacllib/inc/ops/ctc_ops.h +++ b/third_party/fwkacllib/inc/ops/ctc_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/data_flow_ops.h b/third_party/fwkacllib/inc/ops/data_flow_ops.h index 461b3617..02d2bfdd 100644 --- a/third_party/fwkacllib/inc/ops/data_flow_ops.h +++ b/third_party/fwkacllib/inc/ops/data_flow_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h b/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h index 536dea63..07fab272 100644 --- a/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h +++ b/third_party/fwkacllib/inc/ops/elewise_calculation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/functional_ops.h b/third_party/fwkacllib/inc/ops/functional_ops.h index 598d3ad3..b09ac058 100644 --- a/third_party/fwkacllib/inc/ops/functional_ops.h +++ b/third_party/fwkacllib/inc/ops/functional_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/get_data_ops.h b/third_party/fwkacllib/inc/ops/get_data_ops.h index 33dc4f14..e5518ef8 100644 --- a/third_party/fwkacllib/inc/ops/get_data_ops.h +++ b/third_party/fwkacllib/inc/ops/get_data_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/hcom_ops.h b/third_party/fwkacllib/inc/ops/hcom_ops.h index 1fe9055c..a8fc1106 100644 --- a/third_party/fwkacllib/inc/ops/hcom_ops.h +++ b/third_party/fwkacllib/inc/ops/hcom_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/hvd_ops.h b/third_party/fwkacllib/inc/ops/hvd_ops.h index a49ec5ed..00299ef7 100644 --- a/third_party/fwkacllib/inc/ops/hvd_ops.h +++ b/third_party/fwkacllib/inc/ops/hvd_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/image_ops.h b/third_party/fwkacllib/inc/ops/image_ops.h index ce3262f9..a29c8553 100644 --- a/third_party/fwkacllib/inc/ops/image_ops.h +++ b/third_party/fwkacllib/inc/ops/image_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/internal_ops.h b/third_party/fwkacllib/inc/ops/internal_ops.h index 9dde14a5..bcc3f1c3 100644 --- a/third_party/fwkacllib/inc/ops/internal_ops.h +++ b/third_party/fwkacllib/inc/ops/internal_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/linalg_ops.h b/third_party/fwkacllib/inc/ops/linalg_ops.h index 7a6fbc59..d8f45c5d 100644 --- a/third_party/fwkacllib/inc/ops/linalg_ops.h +++ b/third_party/fwkacllib/inc/ops/linalg_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/logging_ops.h b/third_party/fwkacllib/inc/ops/logging_ops.h index bc8ae2b8..03be7757 100644 --- a/third_party/fwkacllib/inc/ops/logging_ops.h +++ b/third_party/fwkacllib/inc/ops/logging_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/lookup_ops.h b/third_party/fwkacllib/inc/ops/lookup_ops.h index b37ab048..5d928e5a 100644 --- a/third_party/fwkacllib/inc/ops/lookup_ops.h +++ b/third_party/fwkacllib/inc/ops/lookup_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/math_ops.h b/third_party/fwkacllib/inc/ops/math_ops.h index 2b0783bf..330d85e7 100644 --- a/third_party/fwkacllib/inc/ops/math_ops.h +++ b/third_party/fwkacllib/inc/ops/math_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h b/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h index ed23d3f6..daf0939c 100644 --- a/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h +++ b/third_party/fwkacllib/inc/ops/matrix_calculation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/max_pool_v3.h b/third_party/fwkacllib/inc/ops/max_pool_v3.h deleted file mode 100644 index 960ea03e..00000000 --- a/third_party/fwkacllib/inc/ops/max_pool_v3.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_H_ -#define BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_H_ - -#include "graph/operator_reg.h" - -namespace ge { - -/** -* @brief Performs max pooling on the input . \n - -* @par Inputs: -* One input: -* x: An NC1HWC0 Tensor. Supported type:float16, float32, double, int8, int16, -* int32, int64, uint8, uint16, qint8 - -* @par Attributes: -* @li ksize: A required list of int8, int16, int32, or int64 values, -* specifying the size of the window for each dimension of the input tensor. -* No default value. -* @li strides: A required list of int8, int16, int32, or int64 values, -* specifying the stride of the sliding window for each dimension of -* the input tensor. No default value. -* @li padding_mode: A required string. Defaults to "CALCULATED". -* @li pads:A required list of int8, int16, int32, or int64 values, -* a data to caculate when padding_mode is "SAME" and "CALCULATED". -* @li data_format: An optional string. Defaults to "NHWC" . -* @li global_pooling bool, Whether to use the global pooling. -* If global_pooling = true, kernel size and paddings will be ignored. -* Default False -* @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. -* If global_pooling = true, kernel size and paddings will be ignored. -* Default False \n - -* @par Outputs: -* y: A Tensor. Has the same type and format as input "x" . \n - -* @attention Constraints: -* @li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, -* ksize[1] * ksize[2] <= 255. -* @li "stride is a list that has length 4: strides[0] = 1 or strides[3] = 1, -* strides[1] <= 63, strides[0] >= 1, strides[2] <= 63, strides[2] >= 1. -* @li "padding" is "SAME" "VALID" or "CACULATE" . - - -* @par Third-party framework compatibility -* Compatible with the TensorFlow operator MaxPool. -*/ -REG_OP(MaxPoolV3) - .INPUT(x,TensorType({DT_FLOAT16, DT_FLOAT32})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32})) - .REQUIRED_ATTR(ksize, ListInt) - .REQUIRED_ATTR(strides, ListInt) - .ATTR(padding_mode, String, "CALCULATED") - .ATTR(pads, ListInt, {0,0,0,0}) - .ATTR(data_format, String, "NCHW") - .ATTR(global_pooling,Bool,false) - .ATTR(ceil_mode, Bool, false) - .OP_END_FACTORY_REG(MaxPoolV3) -} // namespace ge - -#endif // OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_H_ diff --git a/third_party/fwkacllib/inc/ops/max_pool_v3_grad.h b/third_party/fwkacllib/inc/ops/max_pool_v3_grad.h deleted file mode 100644 index fbb96bdf..00000000 --- a/third_party/fwkacllib/inc/ops/max_pool_v3_grad.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/*! - *\file max_pool_v3_grad.h - *\brief - */ -#ifndef OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_GRAD_H_ -#define OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_GRAD_H_ - -#include "graph/operator_reg.h" - -namespace ge { - -/** -* @brief Computes gradients of the maxpooling function . \n - -* @par Inputs: -* @li orig_input: A mutable NC1HWC0 tensor of type RealNumberType. -* @li orig_output: A mutable NC1HWC0 tensor of type RealNumberTypex. -* @li grad: A mutable NC1HWC0 tensor of type RealNumberType . \n - -* @par Attributes: -* @li ksize: A required list of int8, int16, int32, or int64 values, -* specifying the size of the window for each dimension of the input tensor. -* No default value. -* @li strides: A required list of int8, int16, int32, or int64 values, -* specifying the stride of the sliding window for each dimension of -* the input tensor. No default value. -* @li padding_mode: A required string. Defaults to "CALCULATED". -* @li pads:A required list of int8, int16, int32, or int64 values, -* a data to caculate when padding_mode is "SAME" and "CALCULATED". -* @li data_format: An optional string. Defaults to "NHWC" . -* @li global_pooling bool, Whether to use the global pooling. -* If global_pooling = true, kernel size and paddings will be ignored. -* Default False -* @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. -* If global_pooling = true, kernel size and paddings will be ignored. -* Default False \n - -* @par Outputs: -* y: A mutable tensor. Has the same shape and type as "x1" . \n - -* @attention Constraints: -* @li Computing gradients of global pooling is not supported, which means -* "ksize < x1". -* @li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] - -* @par Third-party framework compatibility -* Compatible with the TensorFlow operator MaxPoolGrad. -*/ -REG_OP(MaxPoolV3Grad) - .INPUT(orig_input, TensorType::RealNumberType()) - .INPUT(orig_output, TensorType::RealNumberType()) - .INPUT(grad, TensorType::RealNumberType()) - .OUTPUT(out_grad, TensorType::RealNumberType()) - .REQUIRED_ATTR(ksize, ListInt) - .REQUIRED_ATTR(strides, ListInt) - .ATTR(padding_mod, String, "CALCULATED") - .ATTR(pads, ListInt, {0, 0, 0, 0}) - .ATTR(data_format, String, "NCHW") - .ATTR(global_pooling, Bool, false) - .ATTR(ceil_mode, Bool, false) - .OP_END_FACTORY_REG(MaxPoolV3Grad) -} // namespace ge - -#endif // OPS_BUILT_IN_OP_PROTO_INC_MAX_POOL_V3_GRAD_H_ diff --git a/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h b/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h index 0c6a5dff..a35cee03 100644 --- a/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/nn_calculation_ops.h b/third_party/fwkacllib/inc/ops/nn_calculation_ops.h index e2d610c5..bd361f5d 100644 --- a/third_party/fwkacllib/inc/ops/nn_calculation_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_calculation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/nn_detect_ops.h b/third_party/fwkacllib/inc/ops/nn_detect_ops.h index a013fb33..476704e5 100644 --- a/third_party/fwkacllib/inc/ops/nn_detect_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_detect_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/nn_norm_ops.h b/third_party/fwkacllib/inc/ops/nn_norm_ops.h index 35c4c7d4..0fdf27e3 100644 --- a/third_party/fwkacllib/inc/ops/nn_norm_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_norm_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/nn_ops.h b/third_party/fwkacllib/inc/ops/nn_ops.h index 9edc469a..16552eee 100644 --- a/third_party/fwkacllib/inc/ops/nn_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/nn_pooling_ops.h b/third_party/fwkacllib/inc/ops/nn_pooling_ops.h index 6615d2f5..473e94b7 100644 --- a/third_party/fwkacllib/inc/ops/nn_pooling_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_pooling_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1190,6 +1190,108 @@ REG_OP(MaxPoolGradWithArgmaxV2) .ATTR(dilation, ListInt, {1,1,1,1}) .ATTR(ceil_mode, Bool, false) .OP_END_FACTORY_REG(MaxPoolGradWithArgmaxV2) -} // namespace ge -#endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H_ +/** +* @brief Performs max pooling on the input . \n + +* @par Inputs: +* One input: +* x: An NC1HWC0 Tensor. Supported type:float16, float32, double, int8, int16, +* int32, int64, uint8, uint16, qint8 + +* @par Attributes: +* @li ksize: A required list of int8, int16, int32, or int64 values, +* specifying the size of the window for each dimension of the input tensor. +* No default value. +* @li strides: A required list of int8, int16, int32, or int64 values, +* specifying the stride of the sliding window for each dimension of +* the input tensor. No default value. +* @li padding_mode: A required string. Defaults to "CALCULATED". +* @li pads:A required list of int8, int16, int32, or int64 values, +* a data to caculate when padding_mode is "SAME" and "CALCULATED". +* @li data_format: An optional string. Defaults to "NHWC" . +* @li global_pooling bool, Whether to use the global pooling. +* If global_pooling = true, kernel size and paddings will be ignored. +* Default False +* @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. +* If global_pooling = true, kernel size and paddings will be ignored. +* Default False \n + +* @par Outputs: +* y: A Tensor. Has the same type and format as input "x" . \n + +* @attention Constraints: +* @li "ksize" is a list that has length 4: ksize[0] = 1 or ksize[3] = 1, +* ksize[1] * ksize[2] <= 255. +* @li "stride is a list that has length 4: strides[0] = 1 or strides[3] = 1, +* strides[1] <= 63, strides[0] >= 1, strides[2] <= 63, strides[2] >= 1. +* @li "padding" is "SAME" "VALID" or "CACULATE" . + + +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator MaxPool. +*/ +REG_OP(MaxPoolV3) + .INPUT(x,TensorType({DT_FLOAT16, DT_FLOAT32})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT32})) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .ATTR(padding_mode, String, "CALCULATED") + .ATTR(pads, ListInt, {0,0,0,0}) + .ATTR(data_format, String, "NCHW") + .ATTR(global_pooling,Bool,false) + .ATTR(ceil_mode, Bool, false) + .OP_END_FACTORY_REG(MaxPoolV3) + +/** +* @brief Computes gradients of the maxpooling function . \n + +* @par Inputs: +* @li orig_input: A mutable NC1HWC0 tensor of type RealNumberType. +* @li orig_output: A mutable NC1HWC0 tensor of type RealNumberTypex. +* @li grad: A mutable NC1HWC0 tensor of type RealNumberType . \n + +* @par Attributes: +* @li ksize: A required list of int8, int16, int32, or int64 values, +* specifying the size of the window for each dimension of the input tensor. +* No default value. +* @li strides: A required list of int8, int16, int32, or int64 values, +* specifying the stride of the sliding window for each dimension of +* the input tensor. No default value. +* @li padding_mode: A required string. Defaults to "CALCULATED". +* @li pads:A required list of int8, int16, int32, or int64 values, +* a data to caculate when padding_mode is "SAME" and "CALCULATED". +* @li data_format: An optional string. Defaults to "NHWC" . +* @li global_pooling bool, Whether to use the global pooling. +* If global_pooling = true, kernel size and paddings will be ignored. +* Default False +* @li ceil_mode:global_pooling (bool) – (bool) Whether to use the global pooling. +* If global_pooling = true, kernel size and paddings will be ignored. +* Default False \n + +* @par Outputs: +* y: A mutable tensor. Has the same shape and type as "x1" . \n + +* @attention Constraints: +* @li Computing gradients of global pooling is not supported, which means +* "ksize < x1". +* @li "ksize" is in the range [1, 255]. "strides" is in the range [1, 63] + +* @par Third-party framework compatibility +* Compatible with the TensorFlow operator MaxPoolGrad. +*/ +REG_OP(MaxPoolV3Grad) + .INPUT(orig_input, TensorType::RealNumberType()) + .INPUT(orig_output, TensorType::RealNumberType()) + .INPUT(grad, TensorType::RealNumberType()) + .OUTPUT(out_grad, TensorType::RealNumberType()) + .REQUIRED_ATTR(ksize, ListInt) + .REQUIRED_ATTR(strides, ListInt) + .ATTR(padding_mode, String, "CALCULATED") + .ATTR(pads, ListInt, {0, 0, 0, 0}) + .ATTR(data_format, String, "NCHW") + .ATTR(global_pooling, Bool, false) + .ATTR(ceil_mode, Bool, false) + .OP_END_FACTORY_REG(MaxPoolV3Grad) +} // namespace ge +#endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H \ No newline at end of file diff --git a/third_party/fwkacllib/inc/ops/nn_training_ops.h b/third_party/fwkacllib/inc/ops/nn_training_ops.h index 047fd6da..92074872 100644 --- a/third_party/fwkacllib/inc/ops/nn_training_ops.h +++ b/third_party/fwkacllib/inc/ops/nn_training_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/no_op.h b/third_party/fwkacllib/inc/ops/no_op.h index 7834591c..b27b1fa0 100644 --- a/third_party/fwkacllib/inc/ops/no_op.h +++ b/third_party/fwkacllib/inc/ops/no_op.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h b/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h index e0e5dfc6..ce8383db 100644 --- a/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h +++ b/third_party/fwkacllib/inc/ops/nonlinear_fuc_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h b/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h index 8d7ef9f9..f36d2935 100644 --- a/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h +++ b/third_party/fwkacllib/inc/ops/npu_loss_scale_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/outfeed_ops.h b/third_party/fwkacllib/inc/ops/outfeed_ops.h index e0b783bc..53b9d701 100644 --- a/third_party/fwkacllib/inc/ops/outfeed_ops.h +++ b/third_party/fwkacllib/inc/ops/outfeed_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/pad_ops.h b/third_party/fwkacllib/inc/ops/pad_ops.h index 625c1e09..92dca17c 100644 --- a/third_party/fwkacllib/inc/ops/pad_ops.h +++ b/third_party/fwkacllib/inc/ops/pad_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -343,7 +343,7 @@ REG_OP(AscendPadding) */ REG_OP(EmbeddingRankId) .INPUT(addr_table, TensorType({DT_UINT64})) - .INPUT(index, TensorType({DT_UINT32})) + .INPUT(index, TensorType({DT_INT64,DT_INT32,DT_UINT64})) .OUTPUT(rank_id, TensorType({DT_UINT64})) .ATTR(row_memory, Int, 320) .ATTR(mode, String, "mod") diff --git a/third_party/fwkacllib/inc/ops/parsing_ops.h b/third_party/fwkacllib/inc/ops/parsing_ops.h index 5c7adfd8..9a5cf504 100644 --- a/third_party/fwkacllib/inc/ops/parsing_ops.h +++ b/third_party/fwkacllib/inc/ops/parsing_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/quantize_ops.h b/third_party/fwkacllib/inc/ops/quantize_ops.h index b53cfeb6..806e28df 100644 --- a/third_party/fwkacllib/inc/ops/quantize_ops.h +++ b/third_party/fwkacllib/inc/ops/quantize_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/ragged_array_ops.h b/third_party/fwkacllib/inc/ops/ragged_array_ops.h index 9b31aa8e..20484623 100644 --- a/third_party/fwkacllib/inc/ops/ragged_array_ops.h +++ b/third_party/fwkacllib/inc/ops/ragged_array_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h b/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h index 13488a25..020e3da4 100644 --- a/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h +++ b/third_party/fwkacllib/inc/ops/ragged_conversion_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/ragged_math_ops.h b/third_party/fwkacllib/inc/ops/ragged_math_ops.h index 8af4f867..258b0ca1 100644 --- a/third_party/fwkacllib/inc/ops/ragged_math_ops.h +++ b/third_party/fwkacllib/inc/ops/ragged_math_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/random_ops.h b/third_party/fwkacllib/inc/ops/random_ops.h index b46da435..847b0768 100644 --- a/third_party/fwkacllib/inc/ops/random_ops.h +++ b/third_party/fwkacllib/inc/ops/random_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/reduce_ops.h b/third_party/fwkacllib/inc/ops/reduce_ops.h index 6f44093e..cd448c8d 100644 --- a/third_party/fwkacllib/inc/ops/reduce_ops.h +++ b/third_party/fwkacllib/inc/ops/reduce_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/resource_variable_ops.h b/third_party/fwkacllib/inc/ops/resource_variable_ops.h index 1b60d42a..74ac83f8 100644 --- a/third_party/fwkacllib/inc/ops/resource_variable_ops.h +++ b/third_party/fwkacllib/inc/ops/resource_variable_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/rnn.h b/third_party/fwkacllib/inc/ops/rnn.h index 4010707b..e33f3677 100644 --- a/third_party/fwkacllib/inc/ops/rnn.h +++ b/third_party/fwkacllib/inc/ops/rnn.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/rpn_ops.h b/third_party/fwkacllib/inc/ops/rpn_ops.h index b7649a44..089af326 100644 --- a/third_party/fwkacllib/inc/ops/rpn_ops.h +++ b/third_party/fwkacllib/inc/ops/rpn_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/save_ops.h b/third_party/fwkacllib/inc/ops/save_ops.h index 0ce473b7..5ce6c2e0 100644 --- a/third_party/fwkacllib/inc/ops/save_ops.h +++ b/third_party/fwkacllib/inc/ops/save_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/sdca_ops.h b/third_party/fwkacllib/inc/ops/sdca_ops.h index cbd9839d..34c6a268 100644 --- a/third_party/fwkacllib/inc/ops/sdca_ops.h +++ b/third_party/fwkacllib/inc/ops/sdca_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/selection_ops.h b/third_party/fwkacllib/inc/ops/selection_ops.h index 7c4802a6..e7f35e02 100644 --- a/third_party/fwkacllib/inc/ops/selection_ops.h +++ b/third_party/fwkacllib/inc/ops/selection_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -825,7 +825,7 @@ REG_OP(SliceD) * @attention Constraints: * @li k =< 5120 -* @li Size of the last dimension =< 65500 +* @li Size of the last dimension =< 1458176 * @li sorted = true * @li It's unstable sorted indices on the platform of Ascend310 diff --git a/third_party/fwkacllib/inc/ops/set_ops.h b/third_party/fwkacllib/inc/ops/set_ops.h index 1d02fa15..04e04f1b 100644 --- a/third_party/fwkacllib/inc/ops/set_ops.h +++ b/third_party/fwkacllib/inc/ops/set_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/sparse_ops.h b/third_party/fwkacllib/inc/ops/sparse_ops.h index d7512790..09d8ced9 100644 --- a/third_party/fwkacllib/inc/ops/sparse_ops.h +++ b/third_party/fwkacllib/inc/ops/sparse_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/spectral_ops.h b/third_party/fwkacllib/inc/ops/spectral_ops.h index 64fa7814..be3d7d00 100644 --- a/third_party/fwkacllib/inc/ops/spectral_ops.h +++ b/third_party/fwkacllib/inc/ops/spectral_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/split_combination_ops.h b/third_party/fwkacllib/inc/ops/split_combination_ops.h index efe4715d..f1a93fa6 100644 --- a/third_party/fwkacllib/inc/ops/split_combination_ops.h +++ b/third_party/fwkacllib/inc/ops/split_combination_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/state_ops.h b/third_party/fwkacllib/inc/ops/state_ops.h index db1f5353..3c8e32b6 100644 --- a/third_party/fwkacllib/inc/ops/state_ops.h +++ b/third_party/fwkacllib/inc/ops/state_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/stateful_random_ops.h b/third_party/fwkacllib/inc/ops/stateful_random_ops.h index 366112d6..c2f65c6a 100644 --- a/third_party/fwkacllib/inc/ops/stateful_random_ops.h +++ b/third_party/fwkacllib/inc/ops/stateful_random_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/stateless_random_ops.h b/third_party/fwkacllib/inc/ops/stateless_random_ops.h index dad3c379..ff9daaa3 100644 --- a/third_party/fwkacllib/inc/ops/stateless_random_ops.h +++ b/third_party/fwkacllib/inc/ops/stateless_random_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/string_ops.h b/third_party/fwkacllib/inc/ops/string_ops.h index 4a88bc79..ec84cc83 100644 --- a/third_party/fwkacllib/inc/ops/string_ops.h +++ b/third_party/fwkacllib/inc/ops/string_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/swap_co_ops.h b/third_party/fwkacllib/inc/ops/swap_co_ops.h index a1bf4f8b..6e8eaac3 100644 --- a/third_party/fwkacllib/inc/ops/swap_co_ops.h +++ b/third_party/fwkacllib/inc/ops/swap_co_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/transformation_ops.h b/third_party/fwkacllib/inc/ops/transformation_ops.h index 5d77c75d..9338a636 100644 --- a/third_party/fwkacllib/inc/ops/transformation_ops.h +++ b/third_party/fwkacllib/inc/ops/transformation_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/ops/warp_perspective_ops.h b/third_party/fwkacllib/inc/ops/warp_perspective_ops.h index e19cbd7c..8ef69d8b 100644 --- a/third_party/fwkacllib/inc/ops/warp_perspective_ops.h +++ b/third_party/fwkacllib/inc/ops/warp_perspective_ops.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/third_party/fwkacllib/inc/register/op_kernel_registry.h b/third_party/fwkacllib/inc/register/op_kernel_registry.h index 2c479e92..5fed8960 100644 --- a/third_party/fwkacllib/inc/register/op_kernel_registry.h +++ b/third_party/fwkacllib/inc/register/op_kernel_registry.h @@ -41,6 +41,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpKernelRegistry { private: OpKernelRegistry(); class OpKernelRegistryImpl; + /*lint -e148*/ std::unique_ptr impl_; }; } // namespace ge diff --git a/third_party/fwkacllib/inc/runtime/base.h b/third_party/fwkacllib/inc/runtime/base.h index ea32c164..a8341e32 100644 --- a/third_party/fwkacllib/inc/runtime/base.h +++ b/third_party/fwkacllib/inc/runtime/base.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_BASE_H__ #define __CCE_RUNTIME_BASE_H__ @@ -100,6 +100,9 @@ typedef enum tagRtError { RT_ERROR_MODEL_ID, RT_ERROR_MODEL_EXE_FAILED, RT_ERROR_END_OF_SEQUENCE, // end of sequence + RT_ERROR_MODEL_EXIT, + RT_ERROR_MODEL_EXIT_STREAM_UNBIND, + RT_ERROR_MODEL_EXIT_ID, RT_ERROR_EVENT_BASE = 0x07050000, RT_ERROR_EVENT_NULL, diff --git a/third_party/fwkacllib/inc/runtime/config.h b/third_party/fwkacllib/inc/runtime/config.h index 6de84c02..f1a70eaa 100644 --- a/third_party/fwkacllib/inc/runtime/config.h +++ b/third_party/fwkacllib/inc/runtime/config.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_CONFIG_H__ #define __CCE_RUNTIME_CONFIG_H__ diff --git a/third_party/fwkacllib/inc/runtime/context.h b/third_party/fwkacllib/inc/runtime/context.h index 21296ca2..ffcf7e4b 100644 --- a/third_party/fwkacllib/inc/runtime/context.h +++ b/third_party/fwkacllib/inc/runtime/context.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_CONTEXT_H__ #define __CCE_RUNTIME_CONTEXT_H__ diff --git a/third_party/fwkacllib/inc/runtime/dev.h b/third_party/fwkacllib/inc/runtime/dev.h index dddb1e10..f3f2937c 100644 --- a/third_party/fwkacllib/inc/runtime/dev.h +++ b/third_party/fwkacllib/inc/runtime/dev.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_DEVICE_H__ #define __CCE_RUNTIME_DEVICE_H__ diff --git a/third_party/fwkacllib/inc/runtime/dvfsprofile.h b/third_party/fwkacllib/inc/runtime/dvfsprofile.h index e27cd832..6e451695 100644 --- a/third_party/fwkacllib/inc/runtime/dvfsprofile.h +++ b/third_party/fwkacllib/inc/runtime/dvfsprofile.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_DVFSPROFILE_H__ #define __CCE_RUNTIME_DVFSPROFILE_H__ diff --git a/third_party/fwkacllib/inc/runtime/event.h b/third_party/fwkacllib/inc/runtime/event.h index af7b16d8..c8a227e8 100644 --- a/third_party/fwkacllib/inc/runtime/event.h +++ b/third_party/fwkacllib/inc/runtime/event.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_EVENT_H__ #define __CCE_RUNTIME_EVENT_H__ diff --git a/third_party/fwkacllib/inc/runtime/kernel.h b/third_party/fwkacllib/inc/runtime/kernel.h index 2030634a..de806a9e 100644 --- a/third_party/fwkacllib/inc/runtime/kernel.h +++ b/third_party/fwkacllib/inc/runtime/kernel.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_KERNEL_H__ #define __CCE_RUNTIME_KERNEL_H__ diff --git a/third_party/fwkacllib/inc/runtime/mem.h b/third_party/fwkacllib/inc/runtime/mem.h index 0d9e20ce..22a00ac6 100644 --- a/third_party/fwkacllib/inc/runtime/mem.h +++ b/third_party/fwkacllib/inc/runtime/mem.h @@ -1,23 +1,25 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_MEM_H__ #define __CCE_RUNTIME_MEM_H__ +/*lint -e7*/ #include +/*lint +e7*/ #include "base.h" #include "config.h" #include "stream.h" diff --git a/third_party/fwkacllib/inc/runtime/rt.h b/third_party/fwkacllib/inc/runtime/rt.h index c1872941..d3d5956f 100644 --- a/third_party/fwkacllib/inc/runtime/rt.h +++ b/third_party/fwkacllib/inc/runtime/rt.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_RT_H__ #define __CCE_RUNTIME_RT_H__ diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 59a1ba7d..78bb2321 100644 --- a/third_party/fwkacllib/inc/runtime/rt_model.h +++ b/third_party/fwkacllib/inc/runtime/rt_model.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_MODEL_H__ #define __CCE_RUNTIME_MODEL_H__ @@ -49,6 +49,7 @@ typedef enum tagModelTaskType { RT_MODEL_TASK_MEMCPY_ADDR_ASYNC, RT_MODEL_TASK_STREAM_LABEL_SWITCH_BY_INDEX, RT_MODEL_TASK_STREAM_LABEL_GOTO, + RT_MODEL_TASK_MODEL_EXIT, } rtModelTaskType_t; typedef enum tagModelStreamType { @@ -224,6 +225,13 @@ typedef struct tagrtModelEndGraphTaskInfo { uint32_t reserved[8]; } rtModelEndGraphTaskInfo_t; +typedef struct tagrtModelExitInfo { + uint32_t modelId; + uint32_t streamId; + uint32_t reserved[8]; +} rtModelExitTaskInfo_t; + + typedef struct tagrtStreamLabelSwitchByIndexTask_t { uint64_t indexPtr; uint64_t labelInfoPtr; @@ -256,6 +264,7 @@ typedef struct tagTaskInfo { rtRdmaSendTaskInfo_t rdmaSendTask; rtRdmaDbSendTaskInfo_t rdmaDbSendTask; rtModelEndGraphTaskInfo_t modelEndGraphTask; + rtModelExitTaskInfo_t modelExitTask; rtStreamSwitchNTaskInfo_t streamSwitchNTask; rtStreamLabelSwitchByIndexTask_t streamLabelSwitchIndexTask; rtStreamLabelGotoTask_t streamLabelGotoTask; @@ -391,6 +400,16 @@ RTS_API rtError_t rtModelAbort(rtModel_t model); /** * @ingroup rt_model + * @brief end graph task to model default stream + * @param [in] model model to execute + * @param [in] end graph stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelExit(rtModel_t model, rtStream_t stream); + +/** + * @ingroup rt_model * @brief bind queue * @param [in] model model to bind * @param [in] queueId queueId to bind diff --git a/third_party/fwkacllib/inc/runtime/stream.h b/third_party/fwkacllib/inc/runtime/stream.h index ab542d89..81810a21 100644 --- a/third_party/fwkacllib/inc/runtime/stream.h +++ b/third_party/fwkacllib/inc/runtime/stream.h @@ -1,18 +1,18 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * http://www.apache.org/licenses/LICENSE-2.0 - * + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ #ifndef __CCE_RUNTIME_STREAM_H__ #define __CCE_RUNTIME_STREAM_H__ diff --git a/third_party/fwkacllib/inc/tdt/status.h b/third_party/fwkacllib/inc/tdt/status.h index 185d2b9c..a42f38a5 100644 --- a/third_party/fwkacllib/inc/tdt/status.h +++ b/third_party/fwkacllib/inc/tdt/status.h @@ -1,4 +1,4 @@ -/** +/** * Copyright 2019-2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h b/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h index 67adecd9..a1c39a51 100644 --- a/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h +++ b/third_party/fwkacllib/inc/toolchain/adx_datadump_server.h @@ -1,18 +1,12 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* @file adx_datadump_server.h +* +* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ #ifndef ADX_DATADUMP_SERVER_H #define ADX_DATADUMP_SERVER_H From 9d41dc2f78fe291cba760f4c022ccd1b961cf90c Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Tue, 27 Oct 2020 21:57:02 +0800 Subject: [PATCH 14/27] mstune bugfix for build_step of after merge --- ge/graph/manager/graph_manager.cc | 13 ++++--------- ge/graph/optimize/graph_optimize.cc | 3 ++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 90c0fcec..3f07b47e 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -693,15 +693,10 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vectorGetName().c_str()); - return ret; - } + ret = PreRunOptimizeSubGraph(graph_node, compute_graph, session_id); + if (ret != SUCCESS) { + GELOGE(ret, "Run PreRunOptimizeSubGraph failed for graph:%s.", compute_graph->GetName().c_str()); + return ret; } /// 1. BUILD_MODE_TUNING with BUILD_STEP_BEFORE_UB_MATCH no need PreRunAfterOptimizeSubGraph; diff --git a/ge/graph/optimize/graph_optimize.cc b/ge/graph/optimize/graph_optimize.cc index ebf09afb..d0931e24 100644 --- a/ge/graph/optimize/graph_optimize.cc +++ b/ge/graph/optimize/graph_optimize.cc @@ -101,7 +101,8 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std return SUCCESS; } - if (build_mode_ == BUILD_MODE_TUNING && build_step_ == BUILD_STEP_AFTER_UB_MATCH) { + if (build_mode_ == BUILD_MODE_TUNING && + (build_step_ == BUILD_STEP_AFTER_UB_MATCH || build_step_ == BUILD_STEP_AFTER_MERGE)) { for (auto iter = graph_optimizer.begin(); iter != graph_optimizer.end(); ++iter) { Status ret = (*iter)->OptimizeFusedGraphAfterGraphSlice(*(compute_graph)); if (ret != SUCCESS) { From 7679e80f23857a3555a139c7f16627812869be63 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Tue, 27 Oct 2020 22:16:01 +0800 Subject: [PATCH 15/27] update blue include behind the yellow zone --- ge/CMakeLists.txt | 2 +- ge/executor/CMakeLists.txt | 5 +++-- ge/ge_local_engine/CMakeLists.txt | 15 ++++++++++----- ge/graph/build/memory/CMakeLists.txt | 3 ++- ge/host_cpu_engine/CMakeLists.txt | 15 ++++++++++----- ge/offline/CMakeLists.txt | 5 +++-- ge/plugin/engine/CMakeLists.txt | 3 ++- 7 files changed, 31 insertions(+), 17 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index fa315516..f6761862 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -686,7 +686,7 @@ target_include_directories(ge_compiler PRIVATE ${GE_CODE_DIR}/../inc/external ${GE_CODE_DIR}/../inc/cce ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external - #### blue zone + #### blue zone #### ${ASCEND_DIR}/driver/include ${ASCEND_DIR}/fwkacllib/include ${GE_CODE_DIR}/third_party/fwkacllib/inc diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 684e49b3..8b2cec7c 100755 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -91,7 +91,6 @@ target_include_directories(ge_executor PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -100,7 +99,9 @@ target_include_directories(ge_executor PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc - ${GE_CODE_DIR}/../inc/cce + ${GE_CODE_DIR}/../inc/cce + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(ge_executor PRIVATE diff --git a/ge/ge_local_engine/CMakeLists.txt b/ge/ge_local_engine/CMakeLists.txt index e8aa5453..7a858b29 100755 --- a/ge/ge_local_engine/CMakeLists.txt +++ b/ge/ge_local_engine/CMakeLists.txt @@ -34,7 +34,6 @@ target_include_directories(ge_local_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -43,6 +42,8 @@ target_include_directories(ge_local_engine PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(ge_local_engine PRIVATE @@ -74,7 +75,6 @@ target_include_directories(atc_ge_local_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -83,6 +83,8 @@ target_include_directories(atc_ge_local_engine PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(atc_ge_local_engine PRIVATE @@ -115,7 +117,6 @@ target_include_directories(ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -124,6 +125,8 @@ target_include_directories(ge_local_opskernel_builder PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(ge_local_opskernel_builder PRIVATE @@ -150,7 +153,6 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -159,6 +161,8 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(atc_ge_local_opskernel_builder PRIVATE @@ -190,7 +194,6 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -199,6 +202,8 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(ge_local_opskernel_builder_static PRIVATE diff --git a/ge/graph/build/memory/CMakeLists.txt b/ge/graph/build/memory/CMakeLists.txt index e968d969..c568f2fe 100644 --- a/ge/graph/build/memory/CMakeLists.txt +++ b/ge/graph/build/memory/CMakeLists.txt @@ -31,7 +31,8 @@ target_include_directories(ge_memory PRIVATE ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) diff --git a/ge/host_cpu_engine/CMakeLists.txt b/ge/host_cpu_engine/CMakeLists.txt index a1c19eac..63d219d0 100644 --- a/ge/host_cpu_engine/CMakeLists.txt +++ b/ge/host_cpu_engine/CMakeLists.txt @@ -28,7 +28,6 @@ target_include_directories(host_cpu_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -36,6 +35,8 @@ target_include_directories(host_cpu_engine PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(host_cpu_engine PRIVATE @@ -67,7 +68,6 @@ target_include_directories(atc_host_cpu_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -75,6 +75,8 @@ target_include_directories(atc_host_cpu_engine PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(atc_host_cpu_engine PRIVATE @@ -107,7 +109,6 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -115,6 +116,8 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(host_cpu_opskernel_builder PRIVATE @@ -141,7 +144,6 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -149,6 +151,8 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(atc_host_cpu_opskernel_builder PRIVATE @@ -180,7 +184,6 @@ target_include_directories(host_cpu_opskernel_builder_static PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -188,6 +191,8 @@ target_include_directories(host_cpu_opskernel_builder_static PRIVATE ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(host_cpu_opskernel_builder_static PRIVATE diff --git a/ge/offline/CMakeLists.txt b/ge/offline/CMakeLists.txt index 8e4a7ff0..a5a334bd 100644 --- a/ge/offline/CMakeLists.txt +++ b/ge/offline/CMakeLists.txt @@ -45,11 +45,12 @@ target_include_directories(atc PRIVATE ${PARSER_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/ge - ${GE_CODE_DIR}/third_party/fwkacllib/inc - ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain #### yellow zone #### ${GE_CODE_DIR}/../inc ${GE_CODE_DIR}/../inc/common + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc + ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain ) target_link_libraries(atc PRIVATE diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index 6515bda5..87a6d682 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -21,13 +21,14 @@ target_include_directories(engine PRIVATE ${GE_CODE_DIR}/inc/framework ${GE_CODE_DIR}/inc/framework/common ${GE_CODE_DIR}/inc/external - ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc + #### blue zone #### + ${GE_CODE_DIR}/third_party/fwkacllib/inc ) target_link_libraries(engine PRIVATE From b30f7ecf25affd84d5c27b531d80c280a60d36cd Mon Sep 17 00:00:00 2001 From: chuxing Date: Wed, 28 Oct 2020 14:17:03 +0800 Subject: [PATCH 16/27] fix coredump sync submodule --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index d4d3655d..cc9de48a 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit d4d3655d2257c8e3e78b338aa02af47bdcfda21b +Subproject commit cc9de48a7779cf95cab90a23db608421a691fd12 diff --git a/parser b/parser index 702254b9..e76825c8 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 702254b9d482d38ef8eaa9ca894327286b4da118 +Subproject commit e76825c8dda737508e01999a39ed074d3f8eee2d From d42dabcd43249971d15d3aa16738bb85f5238566 Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Wed, 28 Oct 2020 14:39:52 +0800 Subject: [PATCH 17/27] Bugfix: fix transpose fusion with input&output format check --- ge/graph/passes/transop_without_reshape_fusion_pass.cc | 8 ++++++++ ge/graph/passes/transpose_transdata_pass.cc | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/ge/graph/passes/transop_without_reshape_fusion_pass.cc b/ge/graph/passes/transop_without_reshape_fusion_pass.cc index 61bca6b8..7adee429 100644 --- a/ge/graph/passes/transop_without_reshape_fusion_pass.cc +++ b/ge/graph/passes/transop_without_reshape_fusion_pass.cc @@ -131,6 +131,14 @@ graphStatus TransOpWithoutReshapeFusionPass::GetSubGraphNodesInfo() { sub_graph_has_reshape_node[i] = true; break; } + if (in_node->GetType() == TRANSOPSE || in_node->GetType() == TRANSOPSED) { + auto input_format = in_node->GetOpDesc()->GetInputDescPtr(0)->GetFormat(); + auto output_format = in_node->GetOpDesc()->GetOutputDescPtr(0)->GetFormat(); + if (input_format == output_format) { + sub_graph_has_reshape_node[i] = true; + break; + } + } auto out_anchor = iter->first; GE_CHECK_NOTNULL(out_anchor); diff --git a/ge/graph/passes/transpose_transdata_pass.cc b/ge/graph/passes/transpose_transdata_pass.cc index b9bd59be..e8539f58 100644 --- a/ge/graph/passes/transpose_transdata_pass.cc +++ b/ge/graph/passes/transpose_transdata_pass.cc @@ -46,6 +46,15 @@ Status TransposeTransDataPass::Run(NodePtr &node) { if (op_desc->GetType() != TRANSPOSED) { return SUCCESS; } + auto input_format = op_desc->GetInputDescPtr(0)->GetFormat(); + auto output_format = op_desc->GetOutputDescPtr(0)->GetFormat(); + if (intput_format == output_format) { + GELOGW("Node %s input format is %s, output format is %s, should not happend. Ignore pass.", + op_desc->GetName().c_str(), + TypeUtils::FormatToSerialString(input_format).c_str(), + TypeUtils::FormatToSerialString(output_format).c_str()); + return SUCCESS; + } if (CheckOneInAndOneOutDataAnchor(node) != SUCCESS) { return FAILED; } From 3fa4ecff3fcc3685259105c26d4eeb0491e6cffe Mon Sep 17 00:00:00 2001 From: wangwenhua <89594672@qq.com> Date: Wed, 28 Oct 2020 14:50:29 +0800 Subject: [PATCH 18/27] singleop errormassage modify --- ge/offline/single_op_parser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/offline/single_op_parser.cc b/ge/offline/single_op_parser.cc index 8a86f5c5..b1e2f975 100644 --- a/ge/offline/single_op_parser.cc +++ b/ge/offline/single_op_parser.cc @@ -226,7 +226,7 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { } int index = 0; - for (auto &tensor_desc : op_desc.output_desc) { + for (auto &tensor_desc : op_desc.input_desc) { if ((tensor_desc.type == DT_UNDEFINED && tensor_desc.format != FORMAT_RESERVED) || (tensor_desc.type != DT_UNDEFINED && tensor_desc.format == FORMAT_RESERVED)){ ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "index"}, {"output", std::to_string(index)}); From 61d3f45e9a729d0aff9f5d41eed7b5f29477a0fb Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Wed, 28 Oct 2020 14:39:52 +0800 Subject: [PATCH 19/27] Bugfix: fix transpose fusion with input&output format check --- ge/graph/passes/transpose_transdata_pass.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/passes/transpose_transdata_pass.cc b/ge/graph/passes/transpose_transdata_pass.cc index e8539f58..cf4bd069 100644 --- a/ge/graph/passes/transpose_transdata_pass.cc +++ b/ge/graph/passes/transpose_transdata_pass.cc @@ -48,7 +48,7 @@ Status TransposeTransDataPass::Run(NodePtr &node) { } auto input_format = op_desc->GetInputDescPtr(0)->GetFormat(); auto output_format = op_desc->GetOutputDescPtr(0)->GetFormat(); - if (intput_format == output_format) { + if (input_format == output_format) { GELOGW("Node %s input format is %s, output format is %s, should not happend. Ignore pass.", op_desc->GetName().c_str(), TypeUtils::FormatToSerialString(input_format).c_str(), From 9bde140ac074e8f280ace55493330a17b5fe9af1 Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Wed, 28 Oct 2020 16:15:44 +0800 Subject: [PATCH 20/27] modified: ge/graph/passes/transop_without_reshape_fusion_pass.cc --- ge/graph/passes/transop_without_reshape_fusion_pass.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/passes/transop_without_reshape_fusion_pass.cc b/ge/graph/passes/transop_without_reshape_fusion_pass.cc index 7adee429..81aeb831 100644 --- a/ge/graph/passes/transop_without_reshape_fusion_pass.cc +++ b/ge/graph/passes/transop_without_reshape_fusion_pass.cc @@ -131,7 +131,7 @@ graphStatus TransOpWithoutReshapeFusionPass::GetSubGraphNodesInfo() { sub_graph_has_reshape_node[i] = true; break; } - if (in_node->GetType() == TRANSOPSE || in_node->GetType() == TRANSOPSED) { + if (in_node->GetType() == TRANSPOSE || in_node->GetType() == TRANSPOSED) { auto input_format = in_node->GetOpDesc()->GetInputDescPtr(0)->GetFormat(); auto output_format = in_node->GetOpDesc()->GetOutputDescPtr(0)->GetFormat(); if (input_format == output_format) { From f561e066d5a5f9ed6d79ea0080c8a4a42e952082 Mon Sep 17 00:00:00 2001 From: wangwenhua <89594672@qq.com> Date: Wed, 28 Oct 2020 17:20:23 +0800 Subject: [PATCH 21/27] singleop errormassage modify --- ge/offline/single_op_parser.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ge/offline/single_op_parser.cc b/ge/offline/single_op_parser.cc index b1e2f975..bc1b39f8 100644 --- a/ge/offline/single_op_parser.cc +++ b/ge/offline/single_op_parser.cc @@ -229,7 +229,8 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { for (auto &tensor_desc : op_desc.input_desc) { if ((tensor_desc.type == DT_UNDEFINED && tensor_desc.format != FORMAT_RESERVED) || (tensor_desc.type != DT_UNDEFINED && tensor_desc.format == FORMAT_RESERVED)){ - ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "index"}, {"output", std::to_string(index)}); + ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, + {"intput", "datatype or format", std::to_string(index)}); GELOGE(PARAM_INVALID, "Input's dataType or format is invalid when the index is %d", index); return false; } @@ -239,13 +240,15 @@ bool SingleOpParser::Validate(const SingleOpDesc &op_desc) { index = 0; for (auto &tensor_desc : op_desc.output_desc) { if (tensor_desc.type == DT_UNDEFINED) { - ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "index"}, {"output", std::to_string(index)}); + ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, + {"output", "datatype", std::to_string(index)}); GELOGE(PARAM_INVALID, "Output's dataType is invalid when the index is %d", index); return false; } if (tensor_desc.format == FORMAT_RESERVED) { - ErrorManager::GetInstance().ATCReportErrMessage("E10028", {"input", "index"}, {"output", std::to_string(index)}); + ErrorManager::GetInstance().ATCReportErrMessage("E10027", {"input", "type", "index"}, + {"output", "format", std::to_string(index)}); GELOGE(PARAM_INVALID, "Output's format is invalid when the index is %d", index); return false; } From e5f5218bf503204be17969c277402dba48c1aad9 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Thu, 29 Oct 2020 10:29:53 +0800 Subject: [PATCH 22/27] update build.sh --- build.sh | 4 ++-- ge/CMakeLists.txt | 2 +- metadef | 2 +- parser | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 51c5e999..572b1c3c 100644 --- a/build.sh +++ b/build.sh @@ -262,7 +262,7 @@ generate_package() for lib in "${PARSER_LIB[@]}"; do find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; - find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \; done for lib in "${FWK_LIB[@]}"; @@ -276,7 +276,7 @@ generate_package() done find ./bin -name atc -exec cp {} "${OUTPUT_PATH}/${ATC_BIN_PATH}" \; - find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "libregister.a" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "libascendcl.so" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; if [ "x${PLATFORM}" = "xtrain" ] then diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 219ff406..94eaf08f 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -879,7 +879,7 @@ add_custom_command( set(INSTALL_BASE_DIR "") set(INSTALL_LIBRARY_DIR lib) -install(TARGETS ge_runner ge_compiler OPTIONAL +install(TARGETS ge_runner ge_compiler opensrc_ascendcl OPTIONAL LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} ) diff --git a/metadef b/metadef index cc9de48a..d4d3655d 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit cc9de48a7779cf95cab90a23db608421a691fd12 +Subproject commit d4d3655d2257c8e3e78b338aa02af47bdcfda21b diff --git a/parser b/parser index e76825c8..702254b9 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit e76825c8dda737508e01999a39ed074d3f8eee2d +Subproject commit 702254b9d482d38ef8eaa9ca894327286b4da118 From 1c11a9b56d8493d908431cbbe5f9f0d6abe5e71c Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Thu, 29 Oct 2020 10:55:09 +0800 Subject: [PATCH 23/27] update submodule metadef parser --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index d4d3655d..cc9de48a 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit d4d3655d2257c8e3e78b338aa02af47bdcfda21b +Subproject commit cc9de48a7779cf95cab90a23db608421a691fd12 diff --git a/parser b/parser index 702254b9..f86c7513 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 702254b9d482d38ef8eaa9ca894327286b4da118 +Subproject commit f86c751307835d85329260feb51b559d378b5710 From d498e9893540926fd717f8a9016b13a2df4ee73a Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Thu, 29 Oct 2020 21:57:14 +0800 Subject: [PATCH 24/27] modified: ge/opskernel_manager/optimizer_priority.pbtxt --- ge/opskernel_manager/optimizer_priority.pbtxt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/opskernel_manager/optimizer_priority.pbtxt b/ge/opskernel_manager/optimizer_priority.pbtxt index 1c9522c9..a53184a1 100755 --- a/ge/opskernel_manager/optimizer_priority.pbtxt +++ b/ge/opskernel_manager/optimizer_priority.pbtxt @@ -1 +1 @@ -optimizer:["aicpu_tf_optimizer","AIcoreEngine","VectorEngine","aicpu_ascend_optimizer","hccl_graph_optimizer", "hvd_graph_optimizer", "DNN_VM_RTS_GRAPH_OPTIMIZER_STORE"] +optimizer:["aicpu_tf_optimizer","aicpu_ascend_optimizer","AIcoreEngine","VectorEngine","hccl_graph_optimizer", "hvd_graph_optimizer", "DNN_VM_RTS_GRAPH_OPTIMIZER_STORE"] From 18e5aa79836310b1e251dc0a7444bcfcc5e50f3f Mon Sep 17 00:00:00 2001 From: t00456437 Date: Fri, 30 Oct 2020 09:39:33 +0800 Subject: [PATCH 25/27] update acl compile --- CMakeLists.txt | 8 +++++--- ge/CMakeLists.txt | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41aad1a9..fb526f1b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ if (ENABLE_OPEN_SRC) message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated") endif() set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH}) + set(STATIC_ACL_LIB ${GE_LIB_PATH}) find_module(slog libslog.so ${GE_LIB_PATH}) find_module(mmpa libmmpa.so ${GE_LIB_PATH}) find_module(msprof libmsprof.so ${GE_LIB_PATH}) @@ -53,7 +54,7 @@ if (ENABLE_OPEN_SRC) find_module(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH}) find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH}) find_module(msprofiler libmsprofiler.a ${GE_LIB_PATH}) - find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) + #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() if(DEFINED ENV{ASCEND_CUSTOM_PATH}) set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}) @@ -66,6 +67,7 @@ if (ENABLE_OPEN_SRC) set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64) set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64) set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64) + set(STATIC_ACL_LIB ${ASCEND_ACL_DIR}) find_module(slog libslog.so ${ASCEND_ATC_DIR}) find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR}) if(PLATFORM STREQUAL "train") @@ -88,7 +90,7 @@ if (ENABLE_OPEN_SRC) find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR}) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) - find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) + #find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) if(PRODUCT STREQUAL "flr3") find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) elseif(PRODUCT STREQUAL "flr1") @@ -111,7 +113,7 @@ if (ENABLE_OPEN_SRC) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver) - find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) + #find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) else() message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated") endif() diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index a3f9a865..47d0dd7d 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -718,11 +718,22 @@ target_link_libraries(ge_compiler ) ############ libascendcl.so ############ -file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") -add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) -set(DUMMY_OBJ $) +#file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") +#add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) +#set(DUMMY_OBJ $) -add_library(opensrc_ascendcl SHARED ${DUMMY_OBJ}) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object) + +execute_process( + COMMAND ar x ${STATIC_ACL_LIB}/libascendcl.a + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object +) + +file(GLOB OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object/*.o) + +add_library(opensrc_ascendcl SHARED + ${OBJECT_LIST} +) target_compile_options(opensrc_ascendcl PRIVATE -O2 -fvisibility=hidden @@ -737,7 +748,6 @@ target_link_options(opensrc_ascendcl PRIVATE target_link_libraries(opensrc_ascendcl PRIVATE -Wl,--whole-archive ge_executor - ascendcl_static ge_common_static graph_static protobuf_static From 42b8d4f2e56b183391221bf5efd5e3f4da156e02 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Fri, 30 Oct 2020 10:17:24 +0800 Subject: [PATCH 26/27] revert for --161 mstune bugfix for build_step of after merge --- ge/graph/manager/graph_manager.cc | 14 ++++++++++---- ge/graph/optimize/graph_optimize.cc | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 3f07b47e..727d1490 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -693,10 +693,16 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vectorGetName().c_str()); - return ret; + + // BUILD_MODE_TUNING with BUILD_STEP_AFTER_MERGE no need PreRunOptimizeSubGraph. + bool run_optimize_subgraph = + !((options_.build_mode == BUILD_MODE_TUNING) && (options_.build_step == BUILD_STEP_AFTER_MERGE)); + if (run_optimize_subgraph) { + Status ret = PreRunOptimizeSubGraph(graph_node, compute_graph, session_id); + if (ret != SUCCESS) { + GELOGE(ret, "Run PreRunOptimizeSubGraph failed for graph:%s.", compute_graph->GetName().c_str()); + return ret; + } } /// 1. BUILD_MODE_TUNING with BUILD_STEP_BEFORE_UB_MATCH no need PreRunAfterOptimizeSubGraph; diff --git a/ge/graph/optimize/graph_optimize.cc b/ge/graph/optimize/graph_optimize.cc index d0931e24..ebf09afb 100644 --- a/ge/graph/optimize/graph_optimize.cc +++ b/ge/graph/optimize/graph_optimize.cc @@ -101,8 +101,7 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std return SUCCESS; } - if (build_mode_ == BUILD_MODE_TUNING && - (build_step_ == BUILD_STEP_AFTER_UB_MATCH || build_step_ == BUILD_STEP_AFTER_MERGE)) { + if (build_mode_ == BUILD_MODE_TUNING && build_step_ == BUILD_STEP_AFTER_UB_MATCH) { for (auto iter = graph_optimizer.begin(); iter != graph_optimizer.end(); ++iter) { Status ret = (*iter)->OptimizeFusedGraphAfterGraphSlice(*(compute_graph)); if (ret != SUCCESS) { From 2cc0a729f46d2beab00d299efc24481a0fb77efd Mon Sep 17 00:00:00 2001 From: t00456437 Date: Fri, 30 Oct 2020 09:39:33 +0800 Subject: [PATCH 27/27] update acl compile --- ge/CMakeLists.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 47d0dd7d..e3d231e5 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -718,18 +718,21 @@ target_link_libraries(ge_compiler ) ############ libascendcl.so ############ -#file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") +file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") #add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) #set(DUMMY_OBJ $) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object) -execute_process( - COMMAND ar x ${STATIC_ACL_LIB}/libascendcl.a - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object -) - -file(GLOB OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object/*.o) +if(EXISTS ${STATIC_ACL_LIB}/libascendcl.a) + execute_process( + COMMAND ar x ${STATIC_ACL_LIB}/libascendcl.a + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object + ) + file(GLOB OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object/*.o) +else() + set(OBJECT_LIST ${CMAKE_BINARY_DIR}/dummy.c) +endif() add_library(opensrc_ascendcl SHARED ${OBJECT_LIST}