diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h index 6f5bbfbf..ac821281 100644 --- a/inc/external/ge/ge_api_types.h +++ b/inc/external/ge/ge_api_types.h @@ -112,6 +112,7 @@ const char *const ORIGINAL_MODEL_FILE = "ge.originalModelFile"; const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel"; const char *const PERFORMANCE_MODE = "ge.performance_mode"; +const char *const SHAPE_GENERALIZED_BUILD_MODE = "ge.shape_generalized_build_mode"; const char *const MODIFY_MIXLIST = "ge.exec.modify_mixlist"; const char *const OP_PRECISION_MODE = "ge.exec.op_precision_mode"; } // namespace configure_option @@ -325,6 +326,11 @@ const char *const INPUT_SHAPE_RANGE = "input_shape_range"; // high: need to recompile, high execute performance mode const std::string PERFORMANCE_MODE = "ge.performance_mode"; +// For selecting the mode of shape generalization when build graph. +// shape_generalized: Shape will be generalized during graph build. +// shape_precise: Shape will not be generalized, use precise shape. +const std::string SHAPE_GENERALIZED_BUILD_MODE = "ge.shape_generalized_build_mode"; + const std::string MODIFY_MIXLIST = "ge.exec.modify_mixlist"; const std::string OP_PRECISION_MODE = "ge.exec.op_precision_mode"; @@ -407,6 +413,7 @@ static const char *const OP_BANK_PATH = ge::OP_BANK_PATH_FLAG.c_str(); static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str(); static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str(); static const char *const PERFORMANCE_MODE = ge::PERFORMANCE_MODE.c_str(); +static const char *const SHAPE_GENERALIZED_BUILD_MODE = ge::SHAPE_GENERALIZED_BUILD_MODE.c_str(); static const char *const MODIFY_MIXLIST = ge::MODIFY_MIXLIST.c_str(); static const char *const OP_PRECISION_MODE = ge::OP_PRECISION_MODE.c_str(); @@ -437,12 +444,13 @@ const std::set ir_builder_suppported_options = {INPUT_FORMAT, OP_BANK_PATH, OP_BANK_UPDATE, PERFORMANCE_MODE, + SHAPE_GENERALIZED_BUILD_MODE, MODIFY_MIXLIST}; // for interface: aclgrphParse const std::set ir_parser_suppported_options = { - INPUT_FP16_NODES, IS_INPUT_ADJUST_HW_LAYOUT, IS_OUTPUT_ADJUST_HW_LAYOUT, OUTPUT, - OUT_NODES, ENABLE_SCOPE_FUSION_PASSES}; + INPUT_FP16_NODES, IS_INPUT_ADJUST_HW_LAYOUT, IS_OUTPUT_ADJUST_HW_LAYOUT, OUTPUT, + OUT_NODES, ENABLE_SCOPE_FUSION_PASSES}; // for interface: aclgrphBuildInitialize const std::set global_options = {CORE_TYPE, diff --git a/inc/external/runtime/rt_error_codes.h b/inc/external/runtime/rt_error_codes.h index a1392cc6..ef7e2ec7 100644 --- a/inc/external/runtime/rt_error_codes.h +++ b/inc/external/runtime/rt_error_codes.h @@ -97,6 +97,10 @@ static const int32_t ACL_ERROR_RT_VECTOR_CORE_TIMEOUT = 507034; // vecto static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal +static const int32_t ACL_ERROR_RT_DIE_MODE_CHANGE_ERROR = 507038; // can not change die mode +static const int32_t ACL_ERROR_RT_DIE_SET_ERROR = 507039; // single die mode can not set die +static const int32_t ACL_ERROR_RT_INVALID_DIEID = 507040; // invalid die id +static const int32_t ACL_ERROR_RT_DIE_MODE_NOT_SET = 507041; // die mode not set static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error diff --git a/inc/framework/common/ge_compiler_options.h b/inc/framework/common/ge_compiler_options.h index 6876740e..5c947346 100644 --- a/inc/framework/common/ge_compiler_options.h +++ b/inc/framework/common/ge_compiler_options.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/inc/framework/common/ge_types.h b/inc/framework/common/ge_types.h index 64231b8c..83d01c1f 100644 --- a/inc/framework/common/ge_types.h +++ b/inc/framework/common/ge_types.h @@ -41,7 +41,7 @@ enum FrameworkType { }; const std::map kFwkTypeToStr = { - {"0", "Caffe"}, {"1", "MindSpore"}, {"3", "TensorFlow"}, {"4", "Android_NN"}, {"5", "Onnx"}}; + {"0", "Caffe"}, {"1", "MindSpore"}, {"3", "TensorFlow"}, {"4", "Android_NN"}, {"5", "Onnx"}}; enum OpEngineType { ENGINE_SYS = 0, // default engine @@ -230,6 +230,14 @@ class GE_FUNC_VISIBILITY ModelListener { /// virtual Status OnComputeDone(uint32_t model_id, uint32_t data_index, uint32_t result_code, std::vector &outputs) = 0; + + virtual uint32_t GetResultCode() { + return 0; + }; + + virtual Status ResetResult() { + return SUCCESS; + }; }; // OMM configuration item diff --git a/inc/framework/common/profiling/ge_profiling.h b/inc/framework/common/profiling/ge_profiling.h index 58cddc4e..e9b207af 100644 --- a/inc/framework/common/profiling/ge_profiling.h +++ b/inc/framework/common/profiling/ge_profiling.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. @@ -18,32 +18,8 @@ #define INC_FRAMEWORK_COMMON_GE_PROFILING_H_ #include "ge/ge_api_error_codes.h" -#include "toolchain/prof_callback.h" #include "runtime/base.h" -const int MAX_DEV_NUM = 64; - -enum ProfCommandHandleType { - kProfCommandhandleInit = 0, - kProfCommandhandleStart, - kProfCommandhandleStop, - kProfCommandhandleFinalize, - kProfCommandhandleModelSubscribe, - kProfCommandhandleModelUnsubscribe -}; - -struct ProfCommandHandleData { - uint64_t profSwitch; - uint32_t devNums; // length of device id list - uint32_t devIdList[MAX_DEV_NUM]; - uint32_t modelId; -}; - -GE_FUNC_VISIBILITY ge::Status RegProfCtrlCallback(MsprofCtrlCallback func); -GE_FUNC_VISIBILITY ge::Status RegProfSetDeviceCallback(MsprofSetDeviceCallback func); -GE_FUNC_VISIBILITY ge::Status RegProfReporterCallback(MsprofReporterCallback func); -GE_FUNC_VISIBILITY ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t len); - /// /// @brief Output the profiling data of single operator in Pytorch, and does not support multithreading /// @return Status result @@ -52,4 +28,6 @@ GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id GE_FUNC_VISIBILITY ge::Status ProfGetDeviceFormGraphId(uint32_t graph_id, uint32_t &device_id); +GE_FUNC_VISIBILITY void ProfSetGraphIdToDeviceMap(uint32_t graph_id, uint32_t &device_id); + #endif // INC_FRAMEWORK_COMMON_GE_PROFILING_H_ diff --git a/inc/framework/common/profiling/ge_runner_profiling.h b/inc/framework/common/profiling/ge_runner_profiling.h index 1c594c5b..27e19bce 100644 --- a/inc/framework/common/profiling/ge_runner_profiling.h +++ b/inc/framework/common/profiling/ge_runner_profiling.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/inc/framework/common/taskdown_common.h b/inc/framework/common/taskdown_common.h index 81a532dd..f2f731be 100644 --- a/inc/framework/common/taskdown_common.h +++ b/inc/framework/common/taskdown_common.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/inc/framework/ge_runtime/davinci_model.h b/inc/framework/ge_runtime/davinci_model.h deleted file mode 100644 index 91e70159..00000000 --- a/inc/framework/ge_runtime/davinci_model.h +++ /dev/null @@ -1,113 +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 INC_FRAMEWORK_GE_RUNTIME_DAVINCI_MODEL_H_ -#define INC_FRAMEWORK_GE_RUNTIME_DAVINCI_MODEL_H_ - -#include -#include - -#include "ge_runtime/op_info.h" -#include "ge_runtime/task_info.h" - -namespace ge { -namespace model_runner { -class DavinciModel { - public: - DavinciModel(const std::vector> &task_info_list, - const std::vector> &data_info_list, - const std::vector> &output_info_list, - const std::vector> &constant_info_list, - const std::vector &variable_info_list, - const std::vector &wait_active_stream_list, - const std::vector &force_copy_stream_list, uint64_t mem_size = 0, uint64_t weight_size = 0, - uint64_t var_size = 0, uintptr_t logic_mem_base = 0, uintptr_t logic_weight_base = 0, - uintptr_t logic_var_base = 0, uint32_t stream_num = 0, uint32_t batch_num = 0, uint32_t event_num = 0, - int32_t priority = 0) - : task_info_list_(task_info_list), - data_info_list_(data_info_list), - output_info_list_(output_info_list), - constant_info_list_(constant_info_list), - variable_info_list_(variable_info_list), - wait_active_stream_list_(wait_active_stream_list), - force_copy_stream_list_(force_copy_stream_list), - mem_size_(mem_size), - weight_size_(weight_size), - var_size_(var_size), - logic_mem_base_(logic_mem_base), - logic_weight_base_(logic_weight_base), - logic_var_base_(logic_var_base), - stream_num_(stream_num), - batch_num_(batch_num), - event_num_(event_num), - priority_(priority) {} - ~DavinciModel() {} - - uint64_t GetMemSize() const { return mem_size_; } - uint64_t GetWeightSize() const { return weight_size_; } - uint64_t GetVarSize() const { return var_size_; } - - uintptr_t GetLogicMemBase() const { return logic_mem_base_; } - uintptr_t GetLogicWeightBase() const { return logic_weight_base_; } - uintptr_t GetLogicVarBase() const { return logic_var_base_; } - - uint32_t GetStreamNum() const { return stream_num_; } - uint32_t GetBatchNum() const { return batch_num_; } - uint32_t GetEventNum() const { return event_num_; } - - const std::vector &GetWaitActiveStreams() const { return wait_active_stream_list_; } - const std::vector &GetForceCopyStreams() const { return force_copy_stream_list_; } - - int32_t GetPriority() const { return priority_; } - - const std::vector> &GetTaskInfoList() const { return task_info_list_; } - const std::vector> &GetDataInfoList() const { return data_info_list_; } - const std::vector> &GetOutputInfoList() const { return output_info_list_; } - const std::vector> &GetConstantInfoList() const { return output_info_list_; } - const std::vector &GetVariableInfoList() const { return variable_info_list_; } - - private: - std::vector> task_info_list_; - std::vector> data_info_list_; - std::vector> output_info_list_; - std::vector> constant_info_list_; - std::vector variable_info_list_; - - std::vector wait_active_stream_list_; - std::vector force_copy_stream_list_; - - uint64_t mem_size_; - uint64_t weight_size_; - uint64_t var_size_; - - uintptr_t logic_mem_base_; - uintptr_t logic_weight_base_; - uintptr_t logic_var_base_; - - uint32_t stream_num_; - uint32_t batch_num_; - uint32_t event_num_; - - int32_t priority_; - - // Disable to copy constructor and assignment operator - DavinciModel &operator=(const DavinciModel &) = delete; - DavinciModel(const DavinciModel &) = delete; -}; -} // namespace model_runner -} // namespace ge - -#endif // INC_FRAMEWORK_GE_RUNTIME_DAVINCI_MODEL_H_ diff --git a/inc/framework/ge_runtime/model_runner.h b/inc/framework/ge_runtime/model_runner.h deleted file mode 100644 index e495dfdf..00000000 --- a/inc/framework/ge_runtime/model_runner.h +++ /dev/null @@ -1,68 +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 INC_FRAMEWORK_GE_RUNTIME_MODEL_RUNNER_H_ -#define INC_FRAMEWORK_GE_RUNTIME_MODEL_RUNNER_H_ - -#include -#include -#include - -#include "common/ge_inner_error_codes.h" -#include "common/ge_types.h" -#include "ge_runtime/davinci_model.h" - -namespace ge { -namespace model_runner { -class RuntimeModel; -using RuntimeInfo = std::tuple; -class ModelRunner { - public: - static ModelRunner &Instance(); - - bool LoadDavinciModel(uint32_t device_id, uint64_t session_id, uint32_t model_id, - std::shared_ptr davinci_model, std::shared_ptr listener); - - bool DistributeTask(uint32_t model_id); - - bool LoadModelComplete(uint32_t model_id); - - const std::vector &GetTaskIdList(uint32_t model_id) const; - - const std::vector &GetStreamIdList(uint32_t model_id) const; - - const std::map> &GetRuntimeInfoMap(uint32_t model_id) const; - - void *GetModelHandle(uint32_t model_id) const; - - bool UnloadModel(uint32_t model_id); - - bool RunModel(uint32_t model_id, const InputData &input_data, OutputData *output_data); - - bool GetInputOutputDescInfo(uint32_t model_id, bool zero_copy, std::vector *input_desc, - std::vector *output_desc, std::vector *input_format, - std::vector *output_format); - - private: - ModelRunner() = default; - ~ModelRunner() = default; - - std::unordered_map> runtime_models_; -}; -} // namespace model_runner -} // namespace ge - -#endif // INC_FRAMEWORK_GE_RUNTIME_MODEL_RUNNER_H_ diff --git a/inc/framework/ge_runtime/op_info.h b/inc/framework/ge_runtime/op_info.h deleted file mode 100644 index 22c16ed6..00000000 --- a/inc/framework/ge_runtime/op_info.h +++ /dev/null @@ -1,72 +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 INC_FRAMEWORK_GE_RUNTIME_OP_INFO_H_ -#define INC_FRAMEWORK_GE_RUNTIME_OP_INFO_H_ - -#include -#include -#include - -namespace ge { -namespace model_runner { -struct TensorInfo { - int64_t GetShapeSize() const { - int64_t res = 1; - if (dims.empty()) { - return 0; - } - for (auto dim : dims) { - res *= dim; - } - return res; - } - - int64_t GetDim(uint32_t index) { - if (index >= dims.size()) { - return 0; - } - return dims[index]; - } - - std::vector dims; - uint32_t datatype; - uint32_t format; - uint32_t real_dim_cnt; - uint32_t size; - bool is_output; -}; - -struct OpInfo { - uint32_t index; - std::string name; - std::string type; - bool var_is_broadcast; - std::vector input_addrs; - std::vector output_addrs; - std::vector input_tensors; - std::vector output_tensors; - std::vector weight_tensors; - std::vector src_name; - std::vector src_index; - std::string weight_data; -}; - -using TensorInfoPtr = std::shared_ptr; -using OpInfoPtr = std::shared_ptr; -} // namespace model_runner -} // namespace ge -#endif // INC_FRAMEWORK_GE_RUNTIME_OP_INFO_H_ diff --git a/inc/framework/ge_runtime/task_info.h b/inc/framework/ge_runtime/task_info.h deleted file mode 100644 index abc4783d..00000000 --- a/inc/framework/ge_runtime/task_info.h +++ /dev/null @@ -1,529 +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 INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ -#define INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ - -#include -#include -#include -#include -#include - -#include "cce/taskdown_api.h" - -namespace ge { -namespace model_runner { -enum TaskInfoType { - CCE = 0, - TBE, - AICPU, - LABEL_SET, - LABEL_SWITCH, - LABEL_GOTO, - EVENT_RECORD, - EVENT_WAIT, - FUSION_START, - FUSION_END, - HCCL, - PROFILER_TRACE, - MEMCPY_ASYNC, - STREAM_SWITCH, - STREAM_ACTIVE, - // Insert new task type here - REVSERVED = 23 -}; - -class TaskInfo { - public: - virtual ~TaskInfo() {} - uint32_t stream_id() const { - return stream_id_; - } - TaskInfoType type() const { - return type_; - } - std::string op_name() const { - return op_name_; - } - bool dump_flag() const { - return dump_flag_; - } - - protected: - TaskInfo(const std::string &op_name, uint32_t stream_id, TaskInfoType type, bool dump_flag) - : op_name_(op_name), stream_id_(stream_id), type_(type), dump_flag_(dump_flag) {} - - private: - std::string op_name_; - uint32_t stream_id_; - TaskInfoType type_; - bool dump_flag_; -}; - -class CceTaskInfo : public TaskInfo { - public: - CceTaskInfo(const std::string &op_name, uint32_t stream_id, const cce::ccOpContext &ctx, const std::string &stub_func, - uint32_t block_dim, const std::vector &args, uint32_t args_size, - const std::vector &sm_desc, const std::vector &flow_table, - const std::vector &args_offset, bool is_flowtable) - : TaskInfo(op_name, stream_id, TaskInfoType::CCE, false), - ctx_(ctx), - stub_func_(stub_func), - block_dim_(block_dim), - args_(args), - args_size_(args_size), - sm_desc_(sm_desc), - flow_table_(flow_table), - args_offset_(args_offset), - is_flowtable_(is_flowtable) {} - ~CceTaskInfo() override {} - - cce::ccOpContext cc_context() const { - return ctx_; - } - std::string stub_func() const { - return stub_func_; - } - uint32_t block_dim() const { - return block_dim_; - } - const std::vector &args() const { - return args_; - } - uint32_t args_size() const { - return args_size_; - } - const std::vector &sm_desc() const { - return sm_desc_; - } - const std::vector &flow_table() const { - return flow_table_; - } - const std::vector &args_offset() const { - return args_offset_; - } - bool is_flowtable() const { - return is_flowtable_; - } - - private: - cce::ccOpContext ctx_; - std::string stub_func_; - uint32_t block_dim_; - std::vector args_; - uint32_t args_size_; - std::vector sm_desc_; - std::vector flow_table_; - std::vector args_offset_; - bool is_flowtable_; -}; - -class TbeTaskInfo : public TaskInfo { - public: - TbeTaskInfo(const std::string &op_name, uint32_t stream_id, const std::string &stub_func, uint32_t block_dim, - const std::vector &args, uint32_t args_size, const std::vector &sm_desc, void *binary, - uint32_t binary_size, const std::vector &meta_data, const std::vector &input_data_addrs, - const std::vector &output_data_addrs, const std::vector &workspace_addrs, bool dump_flag) - : TaskInfo(op_name, stream_id, TaskInfoType::TBE, dump_flag), - stub_func_(stub_func), - block_dim_(block_dim), - args_(args), - args_size_(args_size), - sm_desc_(sm_desc), - binary_(binary), - binary_size_(binary_size), - meta_data_(meta_data), - input_data_addrs_(input_data_addrs), - output_data_addrs_(output_data_addrs), - workspace_addrs_(workspace_addrs) {} - ~TbeTaskInfo() override {} - - const std::string &stub_func() const { - return stub_func_; - } - uint32_t block_dim() const { - return block_dim_; - } - const std::vector &args() const { - return args_; - } - uint32_t args_size() const { - return args_size_; - } - const std::vector &sm_desc() const { - return sm_desc_; - } - void *binary() const { - return binary_; - } - uint32_t binary_size() const { - return binary_size_; - } - const std::vector &meta_data() const { - return meta_data_; - } - const std::vector &input_data_addrs() const { - return input_data_addrs_; - } - const std::vector &output_data_addrs() const { - return output_data_addrs_; - } - const std::vector &workspace_addrs() const { - return workspace_addrs_; - } - - void SetBinary(void *binary, uint32_t binary_size) { - binary_ = binary; - binary_size_ = binary_size; - } - - private: - std::string stub_func_; - uint32_t block_dim_; - std::vector args_; - uint32_t args_size_; - std::vector sm_desc_; - void *binary_; - uint32_t binary_size_; - std::vector meta_data_; - std::vector input_data_addrs_; - std::vector output_data_addrs_; - std::vector workspace_addrs_; -}; - -class AicpuTaskInfo : public TaskInfo { - public: - AicpuTaskInfo(const std::string &op_name, uint32_t stream_id, const string &so_name, const std::string &kernel_name, - const std::string &node_def, const std::string &ext_info, const std::vector &input_data_addrs, - const std::vector &output_data_addrs, bool dump_flag) - : TaskInfo(op_name, stream_id, TaskInfoType::AICPU, dump_flag), - so_name_(so_name), - kernel_name_(kernel_name), - node_def_(node_def), - ext_info_(ext_info), - input_data_addrs_(input_data_addrs), - output_data_addrs_(output_data_addrs) {} - ~AicpuTaskInfo() override {} - - const std::string &so_name() const { - return so_name_; - } - const std::string &kernel_name() const { - return kernel_name_; - } - const std::string &node_def() const { - return node_def_; - } - const std::vector &input_data_addrs() const { - return input_data_addrs_; - } - const std::vector &output_data_addrs() const { - return output_data_addrs_; - } - const std::string &ext_info() const { - return ext_info_; - } - - private: - std::string so_name_; - std::string kernel_name_; - std::string node_def_; - std::string ext_info_; - std::vector input_data_addrs_; - std::vector output_data_addrs_; -}; - -class LabelSetTaskInfo : public TaskInfo { - public: - LabelSetTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t label_id) - : TaskInfo(op_name, stream_id, TaskInfoType::LABEL_SET, false), label_id_(label_id) {} - ~LabelSetTaskInfo() override {} - uint32_t label_id() const { - return label_id_; - } - - private: - uint32_t label_id_; -}; - -class LabelGotoTaskInfo : public TaskInfo { - public: - LabelGotoTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t label_id) - : TaskInfo(op_name, stream_id, TaskInfoType::LABEL_GOTO, false), label_id_(label_id) {} - ~LabelGotoTaskInfo() override {} - uint32_t label_id() const { - return label_id_; - } - - private: - uint32_t label_id_; -}; - -class LabelSwitchTaskInfo : public TaskInfo { - public: - LabelSwitchTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t label_size, - const std::vector &label_list, void *cond) - : TaskInfo(op_name, stream_id, TaskInfoType::LABEL_SWITCH, false), - label_size_(label_size), - label_list_(label_list), - cond_(cond) {} - ~LabelSwitchTaskInfo() override {} - uint32_t label_size() const { - return label_size_; - } - const std::vector &label_list() const { - return label_list_; - } - void *cond() const { - return cond_; - } - - private: - uint32_t label_size_; - std::vector label_list_; - void *cond_; -}; - -class EventTaskInfo : public TaskInfo { - public: - uint32_t event_id() const { - return event_id_; - } - - protected: - EventTaskInfo(const std::string &op_name, uint32_t stream_id, TaskInfoType type, uint32_t event_id) - : TaskInfo(op_name, stream_id, type, false), event_id_(event_id) {} - ~EventTaskInfo() override {} - - uint32_t event_id_; -}; - -class EventRecordTaskInfo : public EventTaskInfo { - public: - EventRecordTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t event_id) - : EventTaskInfo(op_name, stream_id, TaskInfoType::EVENT_RECORD, event_id) {} - ~EventRecordTaskInfo() override {} -}; - -class EventWaitTaskInfo : public EventTaskInfo { - public: - EventWaitTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t event_id) - : EventTaskInfo(op_name, stream_id, TaskInfoType::EVENT_WAIT, event_id) {} - ~EventWaitTaskInfo() override {} -}; - -class FusionStartTaskInfo : public TaskInfo { - public: - explicit FusionStartTaskInfo(const std::string &op_name, uint32_t stream_id) - : TaskInfo(op_name, stream_id, TaskInfoType::FUSION_START, false) {} - ~FusionStartTaskInfo() override {} -}; - -class FusionEndTaskInfo : public TaskInfo { - public: - explicit FusionEndTaskInfo(const std::string &op_name, uint32_t stream_id) - : TaskInfo(op_name, stream_id, TaskInfoType::FUSION_END, false) {} - ~FusionEndTaskInfo() override {} -}; - -class HcclTaskInfo : public TaskInfo { - public: - HcclTaskInfo(const std::string &op_name, uint32_t stream_id, const std::string hccl_type, void *input_data_addr, - void *output_data_addr, int64_t workspace_size, int64_t hccl_stream_num, - const std::vector &private_def, void *ops_kernel_store, int32_t count, int64_t root_id, - int64_t op_type, int64_t data_type, const std::string &group, bool dump_flag) - : TaskInfo(op_name, stream_id, TaskInfoType::HCCL, dump_flag), - hccl_type_(hccl_type), - input_data_addr_(input_data_addr), - output_data_addr_(output_data_addr), - workspace_size_(workspace_size), - hccl_stream_num_(hccl_stream_num), - private_def_(private_def), - ops_kernel_store_(ops_kernel_store), - count_(count), - root_id_(root_id), - op_type_(op_type), - data_type_(data_type), - group_(group) {} - ~HcclTaskInfo() override {} - - const std::string &hccl_type() const { - return hccl_type_; - } - void *input_data_addr() const { - return input_data_addr_; - } - void *output_data_addr() const { - return output_data_addr_; - } - int64_t workspace_size() const { - return workspace_size_; - } - int64_t hccl_stream_num() const { - return hccl_stream_num_; - } - const std::vector &private_def() const { - return private_def_; - } - void *ops_kernel_store() const { - return ops_kernel_store_; - } - int32_t count() const { - return count_; - } - int64_t root_id() const { - return root_id_; - } - int64_t op_type() const { - return op_type_; - } - int64_t data_type() const { - return data_type_; - } - const std::string &group() const { - return group_; - } - - private: - std::string hccl_type_; - void *input_data_addr_; - void *output_data_addr_; - int64_t workspace_size_; - int64_t hccl_stream_num_; - std::vector private_def_; - void *ops_kernel_store_; - int32_t count_; - int64_t root_id_; - int64_t op_type_; - int64_t data_type_; - std::string group_; -}; - -class ProfilerTraceTaskInfo : public TaskInfo { - public: - ProfilerTraceTaskInfo(const std::string &op_name, uint32_t stream_id, uint64_t log_id, bool notify, uint32_t flat) - : TaskInfo(op_name, stream_id, TaskInfoType::PROFILER_TRACE, false), - log_id_(log_id), - notify_(notify), - flat_(flat) {} - ~ProfilerTraceTaskInfo() override {} - - uint64_t log_id() const { - return log_id_; - } - bool notify() const { - return notify_; - } - uint32_t flat() const { - return flat_; - } - - private: - uint64_t log_id_; - bool notify_; - uint32_t flat_; -}; - -class MemcpyAsyncTaskInfo : public TaskInfo { - public: - MemcpyAsyncTaskInfo(const std::string &op_name, uint32_t stream_id, void *dst, uint64_t dst_max, void *src, - uint64_t count, uint32_t kind, bool dump_flag) - : TaskInfo(op_name, stream_id, TaskInfoType::MEMCPY_ASYNC, dump_flag), - dst_(dst), - dst_max_(dst_max), - src_(src), - count_(count), - kind_(kind) {} - ~MemcpyAsyncTaskInfo() override {} - - void *dst() const { - return dst_; - } - uint64_t dst_max() const { - return dst_max_; - } - void *src() const { - return src_; - } - uint64_t count() const { - return count_; - } - uint32_t kind() const { - return kind_; - } - - private: - void *dst_; - uint64_t dst_max_; - void *src_; - uint64_t count_; - int32_t kind_; -}; - -class StreamSwitchTaskInfo : public TaskInfo { - public: - StreamSwitchTaskInfo(const std::string &op_name, uint32_t stream_id, int64_t true_stream_id, void *input_addr, - void *value_addr, int64_t cond, int64_t data_type) - : TaskInfo(op_name, stream_id, TaskInfoType::STREAM_SWITCH, false), - true_stream_id_(true_stream_id), - input_addr_(input_addr), - value_addr_(value_addr), - cond_(cond), - data_type_(data_type) {} - ~StreamSwitchTaskInfo() override {} - - int64_t true_stream_id() const { - return true_stream_id_; - } - void *input_addr() const { - return input_addr_; - } - void *value_addr() const { - return value_addr_; - } - int64_t cond() const { - return cond_; - } - int64_t data_type() const { - return data_type_; - } - - private: - int64_t true_stream_id_; - void *input_addr_; - void *value_addr_; - int64_t cond_; - int64_t data_type_; -}; - -class StreamActiveTaskInfo : public TaskInfo { - public: - StreamActiveTaskInfo(const std::string &op_name, uint32_t stream_id, uint32_t active_stream_id) - : TaskInfo(op_name, stream_id, TaskInfoType::STREAM_ACTIVE, false), active_stream_id_(active_stream_id) {} - ~StreamActiveTaskInfo() override {} - - uint32_t active_stream_id() const { - return active_stream_id_; - } - - private: - uint32_t active_stream_id_; -}; -} // namespace model_runner -} // namespace ge - -#endif // INC_FRAMEWORK_GE_RUNTIME_TASK_INFO_H_ diff --git a/inc/framework/memory/memory_api.h b/inc/framework/memory/memory_api.h index da36cdd6..a316fd59 100644 --- a/inc/framework/memory/memory_api.h +++ b/inc/framework/memory/memory_api.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/inc/framework/omg/ge_init.h b/inc/framework/omg/ge_init.h index 67ef1082..42fd8979 100644 --- a/inc/framework/omg/ge_init.h +++ b/inc/framework/omg/ge_init.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/inc/framework/omg/omg.h b/inc/framework/omg/omg.h index acd36883..37d9e26b 100644 --- a/inc/framework/omg/omg.h +++ b/inc/framework/omg/omg.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. @@ -101,8 +101,8 @@ GE_FUNC_VISIBILITY Status SetOutputNodeInfo(ge::Graph &graph, const std::string GE_FUNC_VISIBILITY Status GetOutputLeaf(ge::NodePtr node, std::vector> &output_nodes_info); -GE_FUNC_VISIBILITY void GetOutputNodesNameAndIndex(std::vector> &output_nodes_info, - std::vector &output_nodes_name); +GE_FUNC_VISIBILITY void CreateOutputNodesInfo(std::vector> &output_nodes_info, + std::vector &output_nodes_name); GE_FUNC_VISIBILITY void UpdateOmgCtxWithParserCtx(); diff --git a/inc/framework/omg/omg_inner_types.h b/inc/framework/omg/omg_inner_types.h index 0b799bf2..a3621d8b 100644 --- a/inc/framework/omg/omg_inner_types.h +++ b/inc/framework/omg/omg_inner_types.h @@ -73,7 +73,9 @@ struct OMGBufferData { }; struct OmgContext { - OmgContext() { format = DOMI_TENSOR_ND; } + OmgContext() { + format = DOMI_TENSOR_ND; + } domiTensorFormat_t format; // format of the input specified by the command line @@ -96,14 +98,14 @@ struct OmgContext { // default out nodes (this is used for determing the orders) std::vector> default_out_nodes; // save the output node of the network, value = topName, - // topName indicates the output name of the operator. - std::vector user_out_nodes_top_vec; + // tensorName indicates the output name of the operator. + std::vector user_out_tensors; // net out nodes (where user_out_nodes or leaf nodes) 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; + // net out nodes tensor names(caffe or onnx) + std::vector out_tensor_names; + // net data nodes tensor names(caffe or onnx) + std::vector data_tensor_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/model_parser.h b/inc/framework/omg/parser/model_parser.h index d311706d..70444e0a 100644 --- a/inc/framework/omg/parser/model_parser.h +++ b/inc/framework/omg/parser/model_parser.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/inc/framework/omg/parser/op_parser.h b/inc/framework/omg/parser/op_parser.h index 7d02b257..70bec218 100644 --- a/inc/framework/omg/parser/op_parser.h +++ b/inc/framework/omg/parser/op_parser.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/inc/framework/omg/parser/parser_api.h b/inc/framework/omg/parser/parser_api.h index a493e29f..23df0177 100644 --- a/inc/framework/omg/parser/parser_api.h +++ b/inc/framework/omg/parser/parser_api.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/inc/framework/omg/parser/parser_factory.h b/inc/framework/omg/parser/parser_factory.h index 06aaecb7..9d6590c0 100644 --- a/inc/framework/omg/parser/parser_factory.h +++ b/inc/framework/omg/parser/parser_factory.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/inc/framework/omg/parser/parser_inner_ctx.h b/inc/framework/omg/parser/parser_inner_ctx.h index b23da53f..5de54704 100644 --- a/inc/framework/omg/parser/parser_inner_ctx.h +++ b/inc/framework/omg/parser/parser_inner_ctx.h @@ -46,14 +46,14 @@ struct ParserContext { // operator std::map> out_nodes_map; // save the output node of the network, value = topName, - // topName indicates the output name of the operator. - std::vector user_out_nodes_top_vec; + // tensorName indicates the output name of the operator. + std::vector user_out_tensors; // 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; + // net out nodes tensor names(caffe or onnx) + std::vector out_tensor_names; + // net data nodes tensor names(caffe or onnx) + std::vector data_tensor_names; // Whether to use dynamic batch size or dynamic image size bool is_dynamic_input = false; bool train_flag = false; diff --git a/inc/framework/omg/parser/weights_parser.h b/inc/framework/omg/parser/weights_parser.h index a568f927..e4436044 100644 --- a/inc/framework/omg/parser/weights_parser.h +++ b/inc/framework/omg/parser/weights_parser.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/metadef b/metadef index 51418f61..2d1913e6 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 51418f61f26599c85bee2b57328afbbf1c9927c7 +Subproject commit 2d1913e65a016e04a9599e1d2e49fd02136638bd diff --git a/third_party/fwkacllib/inc/ops/aipp.h b/third_party/fwkacllib/inc/ops/aipp.h index 6db4d783..86805f72 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 d63c2daa..b15f2292 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. @@ -77,4 +77,5 @@ #include "transformation_ops.h" #include "condtake_ops.h" #include "warp_perspective_ops.h" +#include "vector_search.h" #endif // OPS_BUILT_IN_OP_PROTO_INC_ALL_OPS_H_ diff --git a/third_party/fwkacllib/inc/ops/array_ops.h b/third_party/fwkacllib/inc/ops/array_ops.h index acac3d6c..4b45f4cf 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. @@ -1221,8 +1221,9 @@ REG_OP(Expand) REG_OP(NonZero) .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT16, \ DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64, DT_BOOL})) - .OUTPUT(y, TensorType({DT_INT64})) + .OUTPUT(y, TensorType({DT_INT64, DT_INT32})) .ATTR(transpose, Bool, false) + .ATTR(dtype, Type, DT_INT64) .OP_END_FACTORY_REG(NonZero) /** @@ -1249,6 +1250,32 @@ REG_OP(ExpandD) .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8})) .REQUIRED_ATTR(shape, ListInt) .OP_END_FACTORY_REG(ExpandD) + +/** +* @brief Calculate buckets limit and offset. \n + +* @par Inputs: +* Three inputs, including: +* @li bucket_list: A 1-D tensor of type int32 with the value of ivf_counts and ivf_offset index. \n +* @li ivf_counts: A 1-D tensor of type int32 with the value of ivf counts. \n +* @li ivf_offset: A 1-D tensor of type int32 with the value of ivf offset. \n + +* @par Attributes: +* total_limit: A int64 type maximum value of the sum of ivf_counts corresponding to bucket_list. \n + +* @par Outputs: +* @li buckets_limit: A 1-D tensor of type int32 with the sum <= total_limit. \n +* @li buckets_offset: A 1-D tensor of type int32 with the value of ivf_offset corresponding to bucket_list. \n +*/ +REG_OP(CalcBucketsLimitAndOffset) + .INPUT(bucket_list, TensorType({DT_INT32})) + .INPUT(ivf_counts, TensorType({DT_INT32})) + .INPUT(ivf_offset, TensorType({DT_INT32})) + .OUTPUT(buckets_limit, TensorType({DT_INT32})) + .OUTPUT(buckets_offset, TensorType({DT_INT32})) + .REQUIRED_ATTR(total_limit, Int) + .OP_END_FACTORY_REG(CalcBucketsLimitAndOffset) + } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_ARRAY_OPS_H_ 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/avg_pool_1d_ops.h b/third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h index 9583eff9..d0800a08 100644 --- a/third_party/fwkacllib/inc/ops/avg_pool_1d_ops.h +++ b/third_party/fwkacllib/inc/ops/avg_pool_1d_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 4b78951d..ca4fe1db 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 d032476d..dac78118 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/case_condition_ops.h b/third_party/fwkacllib/inc/ops/case_condition_ops.h index 85064845..85dba609 100644 --- a/third_party/fwkacllib/inc/ops/case_condition_ops.h +++ b/third_party/fwkacllib/inc/ops/case_condition_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 53a213f7..cd993599 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/coordinates_1d_to_2d_ops.h b/third_party/fwkacllib/inc/ops/coordinates_1d_to_2d_ops.h index 79a64c2c..f52c90b0 100644 --- a/third_party/fwkacllib/inc/ops/coordinates_1d_to_2d_ops.h +++ b/third_party/fwkacllib/inc/ops/coordinates_1d_to_2d_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/correlation.h b/third_party/fwkacllib/inc/ops/correlation.h index c7262cbb..caebba50 100644 --- a/third_party/fwkacllib/inc/ops/correlation.h +++ b/third_party/fwkacllib/inc/ops/correlation.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/ctc_ops.h b/third_party/fwkacllib/inc/ops/ctc_ops.h index 7729432e..6e908091 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 2bbbdd0e..32454d27 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 2246e66a..bcf50058 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. @@ -137,10 +137,10 @@ REG_OP(MinimumGrad) REG_OP(Cast) .INPUT(x, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8, DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64, - DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32})) + DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32, DT_BF16})) .OUTPUT(y, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8, DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64, - DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32})) + DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32, DT_BF16})) .REQUIRED_ATTR(dst_type, Int) .OP_END_FACTORY_REG(Cast) diff --git a/third_party/fwkacllib/inc/ops/functional_ops.h b/third_party/fwkacllib/inc/ops/functional_ops.h index e1fbe6b3..7cfe39c4 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/globalavgpool.h b/third_party/fwkacllib/inc/ops/globalavgpool.h deleted file mode 100644 index b0fff691..00000000 --- a/third_party/fwkacllib/inc/ops/globalavgpool.h +++ /dev/null @@ -1,49 +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 globalavgpool.h - * \brief - */ -#ifndef OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVERAGEPOOL_H_ -#define OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVERAGEPOOL_H_ - -#include "graph/operator_reg.h" - -namespace ge { -/** -*@brief GlobalAveragePool consumes an input tensor X and applies average pooling across the values in the same channel. -This is equivalent to AveragePool with kernel size equal to the spatial dimension of input tensor \n - -*@par Inputs: -*@li x: Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), -where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. -For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. - -*@par Outputs: -*y: Output data tensor from pooling across the input tensor. The output tensor has the same rank as the input. -The first two dimensions of output shape are the same as the input (N x C), while the other dimensions are all 1 - -*@par Restrictions: -*Warning: This operator can be integrated only by configuring INSERT_OP_FILE of aclgrphBuildModel. Please do not use it directly. -*/ -REG_OP(GlobalAveragePool) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) - .OP_END_FACTORY_REG(GlobalAveragePool) -} // namespace ge - -#endif // OPS_BUILT_IN_OP_PROTO_INC_GLOBALAVGPOOL_H_ \ No newline at end of file diff --git a/third_party/fwkacllib/inc/ops/hcom_ops.h b/third_party/fwkacllib/inc/ops/hcom_ops.h index 6db276a9..497f6a68 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 85102c34..2327e76e 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/index_to_addr_ops.h b/third_party/fwkacllib/inc/ops/index_to_addr_ops.h index c6bbaaa8..3af17a45 100644 --- a/third_party/fwkacllib/inc/ops/index_to_addr_ops.h +++ b/third_party/fwkacllib/inc/ops/index_to_addr_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 4975e8c4..f6cc8694 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/list_ops.h b/third_party/fwkacllib/inc/ops/list_ops.h index 53024878..0aa94e73 100644 --- a/third_party/fwkacllib/inc/ops/list_ops.h +++ b/third_party/fwkacllib/inc/ops/list_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 a20370fd..dd565657 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 3fdc01fe..b1fc254f 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 0631b4d1..6eb418d8 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 be6d9f38..e82251bb 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/nn_batch_norm_ops.h b/third_party/fwkacllib/inc/ops/nn_batch_norm_ops.h index 8bcbad14..9629976e 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 452e945e..ed7cb9b5 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 98e18234..0011c72e 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 d66c8948..9ce7abfd 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 a08b610b..5b1a4dd0 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 a0a1abdc..ee599a76 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. @@ -1810,7 +1810,28 @@ REG_OP(GlobalLpPool) .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) .ATTR(p, Float, 2.0) - .OP_END_FACTORY_REG(GlobalLpPool); + .OP_END_FACTORY_REG(GlobalLpPool) + +/** +*@brief GlobalAveragePool consumes an input tensor X and applies average pooling across the values in the same channel. +This is equivalent to AveragePool with kernel size equal to the spatial dimension of input tensor \n + +*@par Inputs: +*@li x: Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), +where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. +For non image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size. + +*@par Outputs: +*y: Output data tensor from pooling across the input tensor. The output tensor has the same rank as the input. +The first two dimensions of output shape are the same as the input (N x C), while the other dimensions are all 1 + +*@par Restrictions: +*Warning: This operator can be integrated only by configuring INSERT_OP_FILE of aclgrphBuildModel. Please do not use it directly. +*/ +REG_OP(GlobalAveragePool) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE})) + .OP_END_FACTORY_REG(GlobalAveragePool); } // namespace ge #endif // OPS_BUILT_IN_OP_PROTO_INC_NN_POOLING_OPS_H diff --git a/third_party/fwkacllib/inc/ops/nn_training_ops.h b/third_party/fwkacllib/inc/ops/nn_training_ops.h index 5b49e947..9dd502cd 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 d46f9c8f..067357de 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. @@ -42,6 +42,45 @@ REG_OP(Gelu) .OP_END_FACTORY_REG(Gelu) /** +* @brief Compute hard_swish of "x" element-wise . \n + +*@par Inputs: +*One input, including: +*x: A Tensor. Must be one of the following types: float16, float32 + +*@par Outputs: +*y: A Tensor. Has the same type as "x". +*@par Third-party framework compatibility +* Compatible with the Torch operator HardSwish. +*/ +REG_OP(HardSwish) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(HardSwish) + +/** +*@brief Computes the for the Swish of "x" . \n + +*@par Inputs: +*One input, including: +*x: A Tensor. Must be one of the following types: float16, float32 + +*@par Outputs: +*y: A Tensor. Has the same type as "x". + +*@par Attributes: +*scale: scalar parameter, default value = 1.0 + +*@par Third-party framework compatibility +*Compatible with the Torch operator Swish +*/ +REG_OP(Swish) + .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) + .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) + .ATTR(scale, Float, 1.0) + .OP_END_FACTORY_REG(Swish) + +/** *@brief Computes the gradient for the gelu of "x" . \n *@par Inputs: @@ -99,23 +138,6 @@ REG_OP(FastGeluGrad) .OP_END_FACTORY_REG(FastGeluGrad) /** -* @brief Compute hardswish of "x" element-wise . \n - -*@par Inputs: -*One input, including: -*x: A Tensor. Must be one of the following types: float16, float32 - -*@par Outputs: -*y: A Tensor. Has the same type as "x". -*@par Third-party framework compatibility -* Compatible with the Torch operator Hardswish. -*/ -REG_OP(Hardswish) - .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) - .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) - .OP_END_FACTORY_REG(Hardswish) - -/** *@brief Computes the gradient for the tanh of "x" . \n *@par Inputs: 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 7780de05..9d0e7a62 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. diff --git a/third_party/fwkacllib/inc/ops/parsing_ops.h b/third_party/fwkacllib/inc/ops/parsing_ops.h index 03024f96..e578997c 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 2a284780..0ed46e80 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 9d116760..5af2dd74 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 2e253ed4..ceaa64e4 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 b2caa0be..4376437f 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 830e775a..66f9b65f 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 c827bec9..1578ba59 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 a5d7f9c3..156f2f34 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 6813ad78..cc0bff00 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 90707602..850b3e5a 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 e8f3e6b6..601b360b 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 ac404e8f..7f7c4fc8 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. @@ -178,7 +178,7 @@ REG_OP(GatherNd) .OP_END_FACTORY_REG(GatherNd) /** -*@brief Gather slices from "x" according to "indices" by corresponding axis . \n +*@brief Gather slices from "x" according to "indices" by corresponding axis . *@par Inputs: *Three inputs, including: @@ -187,16 +187,19 @@ REG_OP(GatherNd) * uint16, complex128, float16, uint32, uint64, complex64, complex128. * @li indices: A Tensor of type int32 or int64. * @li axis: A Tensor of type as int32 or int64, -* Must be in the range [-rank(input_tensor), rank(input_tensor)) . \n +* Must be in the range [-rank(input_tensor), rank(input_tensor)) . + +*@par Attributes: +* batch_dims: An optional int. Defaults to 0. *@par Outputs: -*y: A Tensor. Has the same type as "x" . \n +*y: A Tensor. Has the same type as "x" . *@attention Constraints: *Value in indices must be in range [0, x.shape[axis]) *@par Third-party framework compatibility -* Compatible with the TensorFlow operator GatherV2 . \n +* Compatible with the TensorFlow operator GatherV2 . */ REG_OP(GatherV2) @@ -204,6 +207,7 @@ REG_OP(GatherV2) .INPUT(indices, TensorType::IndexNumberType()) .INPUT(axis, TensorType::IndexNumberType()) .OUTPUT(y, TensorType::BasicType()) + .ATTR(batch_dims, Int, 0) .OP_END_FACTORY_REG(GatherV2) /** @@ -1216,19 +1220,20 @@ REG_OP(StridedSliceAssignD) * @li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, * int64, qint8, quint8, qint32, qint16, quint16, uint16, * float16, uint32, uint64, complex64, complex128. -* @li indices: A Tensor of type int32 or int64 . \n +* @li indices: A Tensor of type int32 or int64 . *@par Attributes: -*validate_indices: A bool specifying whether to verify the argument of "indice" . \n +* @li validate_indices: A bool specifying whether to verify the argument of "indice" . +* @li batch_dims: An optional int. Defaults to 0. *@par Outputs: -*y: A Tensor. Has the same type as "x" . \n +*y: A Tensor. Has the same type as "x" . *@attention Constraints: -* "indices" is in the range [0, x.shape[0]) . \n +* "indices" is in the range [0, x.shape[0]) . *@par Third-party framework compatibility -* Compatible with the TensorFlow operator Gather . \n +* Compatible with the TensorFlow operator Gather . */ REG_OP(Gather) @@ -1236,6 +1241,7 @@ REG_OP(Gather) .INPUT(indices, TensorType::IndexNumberType()) .OUTPUT(y, TensorType::BasicType()) .ATTR(validate_indices, Bool, true) + .ATTR(batch_dims, Int, 0) .OP_END_FACTORY_REG(Gather) /** 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/slice_write_ops.h b/third_party/fwkacllib/inc/ops/slice_write_ops.h index 994f197c..0c161b2d 100644 --- a/third_party/fwkacllib/inc/ops/slice_write_ops.h +++ b/third_party/fwkacllib/inc/ops/slice_write_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 d9fb4d0a..8eb7b521 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 d17cbfdd..ab9e1dec 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 05e38589..98d4d111 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 49029317..d1ec00b5 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 a3d18922..f4eb763c 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 a2699315..a78d63a1 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/target_crop_and_resize.h b/third_party/fwkacllib/inc/ops/target_crop_and_resize.h index 9c61f2c9..9bef1d7b 100644 --- a/third_party/fwkacllib/inc/ops/target_crop_and_resize.h +++ b/third_party/fwkacllib/inc/ops/target_crop_and_resize.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 2151a867..3560db11 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/vector_search.h b/third_party/fwkacllib/inc/ops/vector_search.h new file mode 100644 index 00000000..e3099511 --- /dev/null +++ b/third_party/fwkacllib/inc/ops/vector_search.h @@ -0,0 +1,48 @@ +/** + * Copyright 2021 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 vector_search.h + * \brief + */ +#ifndef OPS_BUILT_IN_OP_PROTO_INC_VECTOR_SEARCH_H_ +#define OPS_BUILT_IN_OP_PROTO_INC_VECTOR_SEARCH_H_ +#include "graph/operator_reg.h" + +namespace ge { +/** +* @brief Generate ADC(asymmetric distance computation) table. \n +* +* @par Inputs: +* Four inputs, including: +* @li query: A Tensor. Must be one of the following types: float16, float32. +* @li code_book: A Tensor. Must be one of the following types: float16, float32. +* @li centroids: A Tensor. Must be one of the following types: float16, float32. +* @li bucket_list: A Tensor. Must be one of the following types: int32, int64. +* +* @par Outputs: +* @li adc_tables: A Tensor. Must be one of the following types: float16, float32. +*/ +REG_OP(GenADC) + .INPUT(query, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(code_book, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(centroids, TensorType({DT_FLOAT16, DT_FLOAT})) + .INPUT(bucket_list, TensorType({DT_INT32, DT_INT64})) + .OUTPUT(adc_tables, TensorType({DT_FLOAT16, DT_FLOAT})) + .OP_END_FACTORY_REG(GenADC) +} // namespace ge + +#endif // OPS_BUILT_IN_OP_PROTO_INC_VECTOR_SEARCH_H_ 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/runtime/base.h b/third_party/fwkacllib/inc/runtime/base.h index 40c7495d..fc2cd038 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__ @@ -38,6 +38,16 @@ static const int32_t RT_ERROR_NONE = 0; // success /** * @ingroup dvrt_base + * @brief device mode. + */ +typedef enum tagRtDeviceMode { + RT_DEVICE_MODE_SINGLE_DIE = 0, + RT_DEVICE_MODE_MULTI_DIE = 1, + RT_DEVICE_MODE_RESERVED +} rtDeviceMode; + +/** + * @ingroup dvrt_base * @brief runtime exception numbers. */ typedef enum tagRtExceptionType { @@ -172,18 +182,6 @@ RTS_API rtError_t rtProfilerConfig(uint16_t type); /** * @ingroup profiling_base - * @brief start rts profiler. - */ -RTS_API rtError_t rtProfilerStart(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList); - -/** - * @ingroup profiling_base - * @brief stop rts profiler. - */ -RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList); - -/** - * @ingroup profiling_base * @brief ts send keypoint profiler log. */ RTS_API rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtStream_t stream); diff --git a/third_party/fwkacllib/inc/runtime/config.h b/third_party/fwkacllib/inc/runtime/config.h index f38be74d..76836e7b 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 66b9b570..bb6bf111 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__ @@ -66,6 +66,17 @@ RTS_API rtError_t rtCtxCreate(rtContext_t *ctx, uint32_t flags, int32_t device); * @param [out] ctx created context * @param [in] flags context creation flag. set to 0. * @param [in] device device to create context on + * @param [in] deviceMode the device mode + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxCreateV2(rtContext_t *ctx, uint32_t flags, int32_t device, rtDeviceMode deviceMode); + +/** + * @ingroup rt_context + * @brief create context and associates it with the calling thread + * @param [out] ctx created context + * @param [in] flags context creation flag. set to 0. + * @param [in] device device to create context on * @return RT_ERROR_NONE for ok */ RTS_API rtError_t rtCtxCreateEx(rtContext_t *ctx, uint32_t flags, int32_t device); diff --git a/third_party/fwkacllib/inc/runtime/dev.h b/third_party/fwkacllib/inc/runtime/dev.h index 3499fd4c..3d3da22e 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__ @@ -154,6 +154,34 @@ RTS_API rtError_t rtSetDevice(int32_t device); * @ingroup dvrt_dev * @brief set target device for current thread * @param [int] device the device id + * @param [int] deviceMode the device mode + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetDeviceV2(int32_t device, rtDeviceMode deviceMode); + +/** + * @ingroup dvrt_dev + * @brief set target die for current thread + * @param [int] die the die id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetDie(int32_t die); + +/** + * @ingroup dvrt_dev + * @brief get target die of current thread + * @param [in|out] die the die id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetDie(int32_t *die); + +/** + * @ingroup dvrt_dev + * @brief set target device for current thread + * @param [int] device the device id * @return RT_ERROR_NONE for ok * @return RT_ERROR_INVALID_VALUE for error input */ diff --git a/third_party/fwkacllib/inc/runtime/dvfsprofile.h b/third_party/fwkacllib/inc/runtime/dvfsprofile.h index 06f5e3c4..33e2f4c1 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 c73274da..81b635c3 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 4d5fc5c9..f33b51d3 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 0afdeec5..b049e762 100644 --- a/third_party/fwkacllib/inc/runtime/mem.h +++ b/third_party/fwkacllib/inc/runtime/mem.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_MEM_H__ #define __CCE_RUNTIME_MEM_H__ diff --git a/third_party/fwkacllib/inc/runtime/rt.h b/third_party/fwkacllib/inc/runtime/rt.h index e4c3a9bb..6c2f5318 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__ @@ -29,5 +29,7 @@ #include "stream.h" #include "rt_stars.h" #include "rt_ffts.h" +#include "rt_ffts_plus.h" +#include "rt_dfx.h" #endif // __CCE_RUNTIME_RT_H__ diff --git a/third_party/fwkacllib/inc/runtime/rt_dfx.h b/third_party/fwkacllib/inc/runtime/rt_dfx.h new file mode 100644 index 00000000..d5927575 --- /dev/null +++ b/third_party/fwkacllib/inc/runtime/rt_dfx.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: dfx interface + */ + +#ifndef CCE_RUNTIME_RT_DFX_H +#define CCE_RUNTIME_RT_DFX_H + +#include "base.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +// max task tag buffer is 1024(include '\0') +#define TASK_TAG_MAX_LEN 1024U + +/** + * @brief set task tag. + * once set is only use by one task and thread local. + * attention: + * 1. it's used for dump current task in active stream now. + * 2. it must be called be for task submit and will be invalid after task submit. + * @param [in] taskTag task tag, usually it's can be node name or task name. + * must end with '\0' and max len is TASK_TAG_MAX_LEN. + * @return RT_ERROR_NONE for ok + * @return other failed + */ +RTS_API rtError_t rtSetTaskTag(const char *taskTag); + +#if defined(__cplusplus) +} +#endif +#endif // CCE_RUNTIME_RT_DFX_H diff --git a/third_party/fwkacllib/inc/runtime/rt_ffts.h b/third_party/fwkacllib/inc/runtime/rt_ffts.h index 5a17b042..f2809218 100644 --- a/third_party/fwkacllib/inc/runtime/rt_ffts.h +++ b/third_party/fwkacllib/inc/runtime/rt_ffts.h @@ -1,17 +1,6 @@ -/** - * 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. +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: ffts interface */ #ifndef __CCE_RUNTIME_FFTS_H diff --git a/third_party/fwkacllib/inc/runtime/rt_ffts_plus.h b/third_party/fwkacllib/inc/runtime/rt_ffts_plus.h new file mode 100644 index 00000000..61eee9f3 --- /dev/null +++ b/third_party/fwkacllib/inc/runtime/rt_ffts_plus.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: ffts plus interface + */ + +#ifndef __CCE_RUNTIME_FFTS_PLUS_H +#define __CCE_RUNTIME_FFTS_PLUS_H + +#include "base.h" +#include "rt_ffts_plus_define.h" +#include "rt_stars_define.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +#pragma pack(push) +#pragma pack (1) + +typedef struct tagFftsPlusTaskInfo { + const rtFftsPlusSqe_t *fftsPlusSqe; + const void *descBuf; // include total context + size_t descBufLen; // the length of descBuf +} rtFftsPlusTaskInfo_t; + +#pragma pack(pop) + +RTS_API rtError_t rtGetAddrAndPrefCntWithHandle(void *handle, const void *devFunc, void **addr, uint32_t *prefetchCnt); +RTS_API rtError_t rtFftsPlusTaskLaunch(rtFftsPlusTaskInfo_t *fftsPlusTaskInfo, rtStream_t stream); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif +#endif // __CCE_RUNTIME_FFTS_H diff --git a/third_party/fwkacllib/inc/runtime/rt_ffts_plus_define.h b/third_party/fwkacllib/inc/runtime/rt_ffts_plus_define.h new file mode 100644 index 00000000..9887b943 --- /dev/null +++ b/third_party/fwkacllib/inc/runtime/rt_ffts_plus_define.h @@ -0,0 +1,715 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: the definition of ffts plus + */ + +#ifndef __CCE_RUNTIME_FFTS_PLUS_DEFINE_H +#define __CCE_RUNTIME_FFTS_PLUS_DEFINE_H + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +#pragma pack(push) +#pragma pack (1) + +// hardware context type +typedef enum tagFftsPlusHwType { + RT_HW_CTX_TYPE_AIC = 0, + RT_HW_CTX_TYPE_AIV = 1, + RT_HW_CTX_TYPE_NOTIFY_WAIT = 3, + RT_HW_CTX_TYPE_NOTIFY_RECORD = 4, + RT_HW_CTX_TYPE_WRITE_VALUE = 5, + RT_HW_CTX_TYPE_MIX_AIC = 6, + RT_HW_CTX_TYPE_MIX_AIV = 7, + RT_HW_CTX_TYPE_SDMA = 8, + RT_HW_CTX_TYPE_FLUSH_DATA = 9, + RT_HW_CTX_TYPE_INVALIDATE_DATA = 10, + RT_HW_CTX_TYPE_WRITEBACK_DATA = 11, + RT_HW_CTX_TYPE_AICPU = 12, + RT_HW_CTX_TYPE_LOAD = 13, + RT_HW_CTX_TYPE_MAX, +} rtFftsPlusHwType_t; + +// hardware context type +typedef enum tagFftsPlusSoftType { + RT_SOFT_CTX_TYPE_COND_SWITCH = 1, + RT_SOFT_CTX_TYPE_CASE_SWITCH = 2, + RT_SOFT_CTX_TYPE_AT_START = 3, + RT_SOFT_CTX_TYPE_AT_END = 4, + RT_SOFT_CTX_TYPE_LABEL = 5, + RT_SOFT_CTX_TYPE_MAX, +} rtFftsPlusSoftType_t; + +typedef enum tagFftsPlusContextType { + RT_CTX_TYPE_AICORE = 0x0000, + RT_CTX_TYPE_AIV = 0x0001, + RT_CTX_TYPE_NOTIFY_WAIT = 0x0003, + RT_CTX_TYPE_NOTIFY_RECORD = 0x0004, + RT_CTX_TYPE_WRITE_VALUE = 0x0005, + RT_CTX_TYPE_MIX_AIC = 0x0006, + RT_CTX_TYPE_MIX_AIV = 0x0007, + RT_CTX_TYPE_SDMA = 0x0008, + RT_CTX_TYPE_FLUSH_DATA = 0x0009, + RT_CTX_TYPE_INVALIDATE_DATA = 0x000A, + RT_CTX_TYPE_WRITEBACK_DATA = 0x000B, + RT_CTX_TYPE_AICPU = 0x000C, + RT_CTX_TYPE_COND_SWITCH = 0x010D, + RT_CTX_TYPE_CASE_SWITCH = 0x020D, + RT_CTX_TYPE_AT_START = 0x0300, + RT_CTX_TYPE_AT_END = 0x0400, + RT_CTX_TYPE_LABEL = 0x0500, +}rtFftsPlusContextType_t; + +// condition type +typedef enum tagFftsPlusCondType { + RT_COND_TYPE_EQUAL = 0, + RT_COND_TYPE_NOTEQUAL = 1, + RT_COND_TYPE_GREATER = 2, + RT_COND_TYPE_GREATER_OR_EQUAL = 3, + RT_COND_TYPE_LESS = 4, + RT_COND_TYPE_LESS_OR_EQUAL = 5, + RT_COND_TYPE_MAX, +} rtFftsPlusCondType_t; + +// the definition of ffts plus context + +#define RT_CTX_SUCCESSOR_NUM 26 + +// ffts plus common context +typedef struct tagFftsPlusComCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t rsv1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t rsv2; + uint8_t rsv3; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t rsv4; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-71 + uint32_t rsv5[2]; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-127 + uint32_t res6[13]; +} rtFftsPlusComCtx_t; + +// aic/aiv context +typedef struct tagFftsPlusAicAivCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t resv : 7; + uint8_t aten : 1; + // 4-7 + uint8_t prefetchConfig; + uint8_t resv1; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t resv2; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t resv3 : 1; + uint16_t schem : 2; + uint16_t icachePrefetchCnt : 5; + uint16_t resv4 : 7; + uint16_t atm : 1; + uint16_t prefetchEnableBitmap : 4; + uint16_t res6 : 4; + uint16_t prefetchOnceBitmap : 4; + uint16_t res7 : 4; + // 68-71 + uint16_t pmg : 2; + uint16_t ns : 1; + uint16_t partId : 8; + uint16_t res8 : 1; + uint16_t qos : 4; + uint16_t res9; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint16_t nonTailBlockdim; + uint16_t tailBlockdim; + // 80-83 + uint32_t taskParamPtrBaseL; + // 84-87 + uint16_t taskParamPtrBaseH; + uint16_t taskParamPtrOffset; + // 88-95 + uint32_t res10; + uint32_t res11; + // 96-103 + uint32_t nonTailTaskStartPcL; + uint16_t nonTailTaskStartPcH; + uint16_t res12; + // 104-111 + uint32_t tailTaskStartPcL; + uint16_t tailTaskStartPcH; + uint16_t res13; + // 112-119 + uint32_t res14; + uint32_t res15; + // 120-127 + uint16_t srcSlot[4]; // src_slot0-3(context ID for source data which is out of subgraph) +} rtFftsPlusAicAivCtx_t; + +// mix aic/aiv context +typedef struct tagFftsPlusMixAicAivCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t reserved1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t prefetchConfig; + uint8_t reserved2; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t reserved3; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t reserved4 : 1; + uint16_t schem : 2; + uint16_t aicIcachePrefetchCnt : 5; + uint16_t aivIcachePrefetchCnt : 5; + uint16_t reserved5 : 2; + uint16_t atm : 1; + uint16_t prefetchEnableBitmap : 4; + uint16_t reserved6 : 4; + uint16_t prefetchOnceBitmap : 4; + uint16_t reserved7 : 4; + // 68-71 + uint16_t pmg : 2; + uint16_t ns : 1; + uint16_t partId : 8; + uint16_t reserved8 : 1; + uint16_t qos : 4; + uint8_t nonTailBlockRatioN; + uint8_t tailBlockRatioN; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint16_t nonTailBlockdim; + uint16_t tailBlockdim; + // 80-87 + uint32_t aicTaskParamPtrL; + uint16_t aicTaskParamPtrH; + uint16_t aicTaskParamPtrOffset; + // 88-95 + uint32_t aivTaskParamPtrL; + uint16_t aivTaskParamPtrH; + uint16_t aivTaskParamPtrOffset; + // 96-103 + uint32_t nonTailAicTaskStartPcL; + uint16_t nonTailAicTaskStartPcH; + uint16_t tailAicTaskStartPcH; + // 104-111 + uint32_t tailAicTaskStartPcL; + uint32_t nonTailAivTaskStartPcL; + // 112-119 + uint16_t nonTailAivTaskStartPcH; + uint16_t tailAivTaskStartPcH; + uint32_t tailAivTaskStartPcL; + // 120-127 + uint16_t srcSlot[4]; // src_slot0-3(context ID for source data which is out of subgraph) +} rtFftsPlusMixAicAivCtx_t; + +// sdma context +typedef struct tagFftsPlusSdmaCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t res1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t res2; + uint8_t res3; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t res4; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint8_t res5; + uint8_t res6 : 7; + uint8_t atm : 1; + uint16_t res7; + // 68-71 + uint16_t pmg : 2; + uint16_t ns : 1; + uint16_t partId : 8; + uint16_t res8 : 1; + uint16_t qos : 4; + uint16_t res9; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint32_t sdmaSqeHeader; // (FORMAT/MPAMNS/PARTID/DRO/SRO/QOS/DNS/SNS/DSSV/SSSV/IE/UPCODE) + // 80-83 + uint16_t sourceStreamId; + uint16_t sourceSubstreamId; + // 84-87 + uint16_t destinationStreamId; + uint16_t destinationSubstreamId; + // 88-127 + uint32_t sourceAddressBaseL; + uint32_t sourceAddressBaseH; + uint32_t sourceAddressOffset; + uint32_t destinationAddressBaseL; + uint32_t destinationAddressBaseH; + uint32_t destinationAddressOffset; + uint32_t nonTailDataLength; + uint32_t tailDataLength; + uint32_t res10[2]; +} rtFftsPlusSdmaCtx_t; + +// ffts plus notify record/wait context +typedef struct tagFftsPlusNotifyCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t res : 7; + uint8_t aten : 1; + // 4-7 + uint8_t res1; + uint8_t res2; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t res3; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t res4 : 14; + uint16_t satm : 1; + uint16_t atm : 1; + uint16_t res6; + // 68-71 + uint32_t res7; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint16_t notifyIdBase; + uint8_t autoWindow; + uint8_t res8; + // 80-127 + uint32_t res9[4]; + uint16_t notifyId[16]; +} rtFftsPlusNotifyCtx_t; + +// write Value context +typedef struct tagFftsPlusWriteValueCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t resv1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t resv2; + uint8_t resv3; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t resv4; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t resv5 : 15; + uint16_t atm : 1; + uint16_t resv6; + // 68-71 + uint32_t resv7; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint8_t awSize : 3; + uint8_t awSnoop : 1; + uint8_t resv8 : 4; + uint8_t awCache : 4; + uint8_t awProt : 3; + uint8_t awVa : 1; + + uint8_t arSize : 3; + uint8_t arSnoop : 1; + uint8_t resv9 : 4; + uint8_t arCache : 4; + uint8_t arProt : 3; + uint8_t arVa : 1; + // 80-83 + uint32_t writeAddressBaseL; + // 84-87 + uint32_t writeAddressBaseH: 17; + uint32_t res10: 15; + // 88-91 + uint32_t writeAddressOffset; + // 92-95 + uint32_t res11; + // 96-111 + uint32_t writeValue[4]; // write_value_00 -> write_value_03 + // 112-127 + uint32_t res12[4]; +} rtFftsPlusWriteValueCtx_t; + +// ai cpu context +typedef struct tagFftsPlusAiCpuCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t res1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t res2; + uint8_t res3; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t res4; + // 12-63 + uint16_t successorContextID[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t res5 : 15; + uint16_t atm : 1; + uint16_t res6; + // 68-71 + uint16_t sqeIndex; + uint8_t kernelType : 7; + uint8_t bm : 1; + uint8_t topicType : 4; + uint8_t qos : 3; + uint8_t res7 : 1; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint16_t nonTailBlockdim; + uint16_t tailBlockdim; + // 80-115 + uint32_t usrData[9]; // usr_data0 -> usr_data8 usr_data2(task_param_base_l) usr_data3(task_param_base_h) + // 116--119 + uint32_t res8; + // 120-123 + uint32_t subtopicId : 12; + uint32_t topicId : 6; + uint32_t groupId : 6; + uint32_t usrDataLength : 8; + // 124-127 + uint32_t taskParamOffset; +} rtFftsPlusAiCpuCtx_t; + +// data context +typedef struct tagFftsPlusDataCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t res1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t res2; + uint8_t res3; + uint8_t cntInit; // cons_cnt_init / prod_cnt_init + uint8_t cnt; // cons_cnt / prod_cnt + // 8-11 + uint32_t res4; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t res5 : 15; + uint16_t atm : 1; + uint16_t res6; + // 68-71 + uint16_t pmg : 2; + uint16_t ns : 1; + uint16_t partId : 8; + uint16_t res7 : 1; + uint16_t qos : 4; + uint16_t res8; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint16_t origConsumerCounter; + uint16_t runConsumerCounter; + // 80-83 + uint32_t addressBaseL; + // 84-87 + uint32_t addressBaseH; + // 88-91 + uint32_t addressOffset; + // 92-95 + uint32_t res9; + // 96-99 + uint16_t nonTailNumOutter; + uint16_t nonTailNumInner; + // 100-103 + uint32_t nonTailLengthInner; + // 104-107 + uint32_t nonTailStrideOutter; + // 108-111 + uint32_t nonTailStrideInner; + // 112-115 + uint16_t tailNumOutter; + uint16_t tailNumInner; + // 116-119 + uint32_t tailLengthInner; + // 120-123 + uint32_t tailStrideOutter; + // 124-127 + uint32_t tailStrideInner; +} rtFftsPlusDataCtx_t; + +// at start context +typedef struct tagFftsPlusAtStartCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t rs1 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t rs2; + uint8_t rs3; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t rs4; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t rs5; + uint16_t rs6; + // 68-71 + uint16_t rs7; + uint16_t rs8; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint16_t threadIdInit; + uint16_t threadWindowSize; + // 80-127 + uint16_t res9[12]; +} rtFftsPlusAtStartCtx_t; + +// at end context +#define RT_CTX_SUCC_AT_START_SLOT_NUM 12 +#define RT_CTX_SUCC_OUT_LABEL_SLOT_NUM 12 + +typedef struct tagFftsPlusAtEndCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t atStartSlotNumber; + uint8_t outLabelSlotNumber : 7; + uint8_t aten : 1; + // 4-7 + uint8_t res1; + uint8_t res2; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t res3; + // 12-59 + uint16_t succAtStartSlot[RT_CTX_SUCC_AT_START_SLOT_NUM]; + uint16_t succOutLabelSlot[RT_CTX_SUCC_OUT_LABEL_SLOT_NUM]; + // 60-63 + uint16_t res4; + uint16_t res5; + // 64-67 + uint16_t res6; + uint16_t res7; + // 68-71 + uint16_t res8; + uint16_t res9; + // 72-75 + uint16_t threadId; + uint16_t res10; + // 76-79 + uint16_t res11; + uint16_t res12; + // 80-127 + uint32_t res13[12]; +} rtFftsPlusAtEndCtx_t; + +// label context +typedef struct tagFftsPlusLabelCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t res1; + // 4-7 + uint8_t res2; + uint8_t res3; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t res4; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-79 + uint16_t res5[8]; + // 80-127 + uint32_t res6[12]; +} rtFftsPlusLabelCtx_t; + +// case switch context +typedef struct tagFftsPlusCaseSwitchCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t resv0 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t startLabelId; + uint8_t labelListLen; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t resv1; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t resv2 : 15; + uint16_t atm : 1; + uint16_t resv3; + // 68-71 + uint32_t resv4; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint8_t arSize : 3; + uint8_t snoop : 1; + uint8_t resv5 : 4; + uint8_t arCache : 4; + uint8_t arProt : 3; + uint8_t va : 1; + uint16_t resv6; + // 80-83 + uint32_t loadAddress0BaseL; + // 84-87 + uint32_t loadAddress0BaseH : 17; + uint32_t resv7 : 14; + uint32_t ld0En : 1; + // 88-91 + uint32_t loadAddress0Offset; + // 92-95 + uint32_t resv8; + // 96-99 + uint32_t loadAddress1BaseL; + // 100-103 + uint32_t loadAddress1BaseH : 17; + uint32_t resv9 : 14; + uint32_t ld1En : 1; + // 104-107 + uint32_t loadAddress1Offset; + // 108-127 + uint32_t resv10[5]; +} rtFftsPlusCaseSwitchCtx_t; + +// case default context +typedef struct tagFftsPlusCaseDefCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t successorNum; + uint8_t rs0 : 7; + uint8_t aten : 1; + // 4-7 + uint8_t startLabelId; + uint8_t labelListLen; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t rs1; + // 12-63 + uint16_t successorList[RT_CTX_SUCCESSOR_NUM]; + // 64-67 + uint16_t rs2; + uint16_t rs3; + // 68-127 + uint32_t rs4[15]; +} rtFftsPlusCaseDefCtx_t; + +// condition switch context +#define RT_CTX_TRUE_SUCCESSOR_NUM 13 +#define RT_CTX_FALSE_SUCCESSOR_NUM 13 + +typedef struct tagFftsPlusCondSwitchCtx { + // 0-3 bytes + uint16_t contextType; + uint8_t trueSuccessorNum; + uint8_t falseSuccessorNum : 7; + uint8_t aten : 1; + // 4-7 + uint8_t condition; + uint8_t res1; + uint8_t predCntInit; + uint8_t predCnt; + // 8-11 + uint32_t res2; + // 12-63 + uint16_t trueSuccessorList[RT_CTX_TRUE_SUCCESSOR_NUM]; + uint16_t falseSuccessorList[RT_CTX_FALSE_SUCCESSOR_NUM]; + // 64-67 + uint16_t res3 : 15; + uint16_t atm : 1; + uint16_t res4; + // 68-71 + uint32_t res5; + // 72-75 + uint16_t threadId; + uint16_t threadDim; + // 76-79 + uint8_t arSize : 3; + uint8_t snoop : 1; + uint8_t res6 : 4; + uint8_t arCache : 4; + uint8_t arProt : 3; + uint8_t va : 1; + uint16_t res7; + // 80-83 + uint32_t loadAddress0BaseL; + // 84-87 + uint32_t loadAddress0BaseH : 17; + uint32_t res8 : 14; + uint32_t ld0En : 1; + // 88-91 + uint32_t loadAddress0Offset; + // 92-95 + uint32_t res9; + // 96-99 + uint32_t loadAddress1BaseL; + // 100-103 + uint32_t loadAddress1BaseH : 17; + uint32_t res10 : 14; + uint32_t ld1En : 1; + // 104-107 + uint32_t loadAddress1Offset; + // 108-127 + uint32_t res11[3]; + uint32_t cmpValue1; + uint32_t cmpValue2; +} rtFftsPlusCondSwitchCtx_t; + +#pragma pack(pop) + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif +#endif // __CCE_RUNTIME_FFTS_PLUS_DEFINE_H diff --git a/third_party/fwkacllib/inc/runtime/rt_model.h b/third_party/fwkacllib/inc/runtime/rt_model.h index 5ef62df3..d0ffe9c8 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__ @@ -53,6 +53,7 @@ typedef enum tagModelTaskType { RT_MODEL_TASK_ALL_KERNEL, RT_MODEL_TASK_PROFILER_TRACE_EX, RT_MODEL_TASK_FFTS_TASK, + RT_MODEL_TASK_FFTS_PLUS_TASK, } rtModelTaskType_t; typedef enum tagModelStreamType { diff --git a/third_party/fwkacllib/inc/runtime/rt_stars.h b/third_party/fwkacllib/inc/runtime/rt_stars.h index 2874058c..016c352a 100644 --- a/third_party/fwkacllib/inc/runtime/rt_stars.h +++ b/third_party/fwkacllib/inc/runtime/rt_stars.h @@ -1,17 +1,6 @@ -/** - * 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. +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: */ #ifndef __CCE_RUNTIME_STARS_H diff --git a/third_party/fwkacllib/inc/runtime/rt_stars_define.h b/third_party/fwkacllib/inc/runtime/rt_stars_define.h new file mode 100644 index 00000000..d77a8a8e --- /dev/null +++ b/third_party/fwkacllib/inc/runtime/rt_stars_define.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + * Description: the definition of stars + */ + +#ifndef __CCE_RUNTIME_STARS_DEFINE__H +#define __CCE_RUNTIME_STARS_DEFINE__H + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +#pragma pack(push) +#pragma pack (1) + +typedef struct tagStarsSqeHeader { + uint8_t type : 6; + uint8_t l1Lock : 1; + uint8_t l1Unlock : 1; + + uint8_t ie : 2; + uint8_t preP : 2; + uint8_t postP : 2; + uint8_t wrCqe : 1; + uint8_t reserved : 1; + + uint16_t blockDim; + + uint16_t rtStreamId; + uint16_t taskId; +} rtStarsSqeHeader_t; + +// ffts+ type +typedef enum tagFftsPlusType { + RT_FFTS_PLUS_TYPE_RES1 = 2, // Reserved + RT_FFTS_PLUS_TYPE_RES2 = 3, // Reserved + RT_FFTS_PLUS_TYPE = 4, // FFTS+ mode +} rtFftsPlusType_t; + +// ffts+ sqe +typedef struct tagFftsPlusSqe { + // 0-7 bytes + rtStarsSqeHeader_t sqeHeader; + // 8-11 bytes + uint16_t fftsType : 3; + uint16_t reserved1 : 9; + uint16_t wrrRatio : 4; + uint16_t reserved2; + // 12-15 bytes + uint16_t sqeIndex; + uint8_t kernelCredit; + uint8_t reserved4; + // 16-23 bytes + uint32_t stackPhyBaseL; + uint32_t stackPhyBaseH; + // 24-31 bytes + uint16_t totalContextNum; + uint16_t readyContextNum; + uint16_t preloadContextNum; + uint16_t reserved5; + // 32-35 bytes + uint16_t reserved6; + uint16_t prefetchOstNum : 5; + uint16_t reserved9 : 3; + uint16_t cmaintOstNum : 5; + uint16_t reserved10 : 3; + // 36-39 bytes + uint16_t aicPrefetchLower : 5; + uint16_t reserved11 : 3; + uint16_t aicPrefetchUpper : 5; + uint16_t reserved12 : 3; + uint16_t aivPrefetchLower : 5; + uint16_t Reserved13 : 3; + uint16_t aivPrefetchUpper : 5; + uint16_t Reserved14 : 3; + // 40-47 bytes + uint32_t contextAddressBaseL; + uint32_t contextAddressBaseH : 17; + uint32_t reserved15 : 15; + // 48-63 bytes + uint32_t reserved16[4]; +} rtFftsPlusSqe_t; + +#pragma pack(pop) + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif +#endif // __CCE_RUNTIME_STARS_DEFINE__H \ No newline at end of file diff --git a/third_party/fwkacllib/inc/runtime/stream.h b/third_party/fwkacllib/inc/runtime/stream.h index 6f45fc4e..3a078e99 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/toolchain/prof_acl_api.h b/third_party/fwkacllib/inc/toolchain/prof_acl_api.h index 11e259b9..d65aac83 100644 --- a/third_party/fwkacllib/inc/toolchain/prof_acl_api.h +++ b/third_party/fwkacllib/inc/toolchain/prof_acl_api.h @@ -115,7 +115,7 @@ typedef struct aclprofSubscribeConfig aclprofSubscribeConfig1; /// @param [in] profSubscribeConfig: pointer to config of model subscribe /// @return Status result of function /// -Status aclgrphProfGraphSubscribe(const uint32_t graphId, +MSVP_PROF_API Status aclgrphProfGraphSubscribe(const uint32_t graphId, const aclprofSubscribeConfig1 *profSubscribeConfig); /// @@ -124,7 +124,7 @@ Status aclgrphProfGraphSubscribe(const uint32_t graphId, /// @param [in] graphId: the graph id subscribed /// @return Status result of function /// -Status aclgrphProfGraphUnSubscribe(const uint32_t graphId); +MSVP_PROF_API Status aclgrphProfGraphUnSubscribe(const uint32_t graphId); /** * @ingroup AscendCL @@ -136,7 +136,7 @@ Status aclgrphProfGraphUnSubscribe(const uint32_t graphId); * @retval graph id of subscription data * @retval 0 for failed */ -size_t aclprofGetGraphId(const void *opInfo, size_t opInfoLen, uint32_t index); +MSVP_PROF_API size_t aclprofGetGraphId(const void *opInfo, size_t opInfoLen, uint32_t index); #ifdef __cplusplus } #endif diff --git a/third_party/fwkacllib/inc/toolchain/prof_callback.h b/third_party/fwkacllib/inc/toolchain/prof_callback.h index dabd41c1..e6ac64bf 100644 --- a/third_party/fwkacllib/inc/toolchain/prof_callback.h +++ b/third_party/fwkacllib/inc/toolchain/prof_callback.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020-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. @@ -12,6 +12,9 @@ * 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 prof_callback.h + * @brief declaraion of profiling callbacks */ #ifndef MSPROFILER_PROF_CALLBACK_H_ @@ -21,6 +24,11 @@ extern "C" { #endif // __cplusplus +#if (OS_TYPE != LINUX) +#define MSVP_PROF_API __declspec(dllexport) +#else +#define MSVP_PROF_API __attribute__((visibility("default"))) +#endif #include "stddef.h" #include "stdint.h" @@ -97,7 +105,6 @@ enum MsprofReporterCallbackType { */ typedef int32_t (*MsprofReporterCallback)(uint32_t moduleId, uint32_t type, void *data, uint32_t len); - #define MSPROF_OPTIONS_DEF_LEN_MAX (2048) /** @@ -118,25 +125,16 @@ enum MsprofCtrlCallbackType { MSPROF_CTRL_INIT_ACL_JSON, // start profiling with acl.json MSPROF_CTRL_INIT_GE_OPTIONS, // start profiling with ge env and options MSPROF_CTRL_FINALIZE, // stop profiling - MSPROF_CTRL_REPORT_FUN_P, // for report callback - MSPROF_CTRL_PROF_SWITCH_ON, // for prof switch on - MSPROF_CTRL_PROF_SWITCH_OFF // for prof switch off + MSPROF_CTRL_INIT_DYNA = 0xFF, // start profiling for dynamic profiling }; -#define PROF_COMMANDHANDLE_TYPE_INIT (0) -#define PROF_COMMANDHANDLE_TYPE_START (1) -#define PROF_COMMANDHANDLE_TYPE_STOP (2) -#define PROF_COMMANDHANDLE_TYPE_FINALIZE (3) -#define PROF_COMMANDHANDLE_TYPE_MODEL_SUBSCRIBE (4) -#define PROF_COMMANDHANDLE_TYPE_MODEL_UNSUBSCRIBE (5) - -#define MSPROF_MAX_DEV_NUM (64) - -struct MsprofCommandHandle { - uint64_t profSwitch; - uint32_t devNums; // length of device id list - uint32_t devIdList[MSPROF_MAX_DEV_NUM]; - uint32_t modelId; +enum MsprofCommandHandleType { + PROF_COMMANDHANDLE_TYPE_INIT = 0, + PROF_COMMANDHANDLE_TYPE_START, + PROF_COMMANDHANDLE_TYPE_STOP, + PROF_COMMANDHANDLE_TYPE_FINALIZE, + PROF_COMMANDHANDLE_TYPE_MODEL_SUBSCRIBE, + PROF_COMMANDHANDLE_TYPE_MODEL_UNSUBSCRIBE }; /** @@ -165,7 +163,7 @@ typedef void (*MsprofSetDeviceCallback)(uint32_t devId, bool isOpenDevice); * @param [in] dataLen: Length of data * @return 0:SUCCESS, >0:FAILED */ -int32_t MsprofInit(uint32_t dataType, void *data, uint32_t dataLen); +MSVP_PROF_API int32_t MsprofInit(uint32_t dataType, void *data, uint32_t dataLen); /* * @name AscendCL @@ -173,7 +171,7 @@ int32_t MsprofInit(uint32_t dataType, void *data, uint32_t dataLen); * @param NULL * @return 0:SUCCESS, >0:FAILED */ -int32_t MsprofFinalize(); +MSVP_PROF_API int32_t MsprofFinalize(); #ifdef __cplusplus } #endif diff --git a/third_party/fwkacllib/inc/toolchain/slog.h b/third_party/fwkacllib/inc/toolchain/slog.h index cc7c83ca..a4680efe 100644 --- a/third_party/fwkacllib/inc/toolchain/slog.h +++ b/third_party/fwkacllib/inc/toolchain/slog.h @@ -204,6 +204,7 @@ enum { FV, MDCMAP, TUNE, + HSS, /**< helper */ INVLID_MOUDLE_ID };