Merge pull request !2107 from yanghaoran/r1.6r1.6
| @@ -20,15 +20,28 @@ | |||
| #include <map> | |||
| #include <string> | |||
| #include "ge_error_codes.h" | |||
| #include "ge_api_types.h" | |||
| #include "graph/types.h" | |||
| namespace ge { | |||
| #ifdef __GNUC__ | |||
| #define ATTRIBUTED_DEPRECATED(replacement) __attribute__((deprecated("Please use " #replacement " instead."))) | |||
| #else | |||
| #define ATTRIBUTED_DEPRECATED(replacement) __declspec(deprecated("Please use " #replacement " instead.")) | |||
| #endif | |||
| // Code compose(4 byte), runtime: 2 bit, type: 2 bit, level: 3 bit, sysid: 8 bit, modid: 5 bit, value: 12 bit | |||
| #define GE_ERRORNO(runtime, type, level, sysid, modid, name, value, desc) \ | |||
| constexpr ge::Status name = (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(runtime))) << 30U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(type))) << 28U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(level))) << 25U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(sysid))) << 17U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(modid))) << 12U) | \ | |||
| (static_cast<uint32_t>(0x0FFFU) & (static_cast<uint32_t>(value))); \ | |||
| const ErrorNoRegisterar g_errorno_##name((name), (desc)); | |||
| #define GE_ERRORNO_EXTERNAL(name, desc) const ErrorNoRegisterar g_errorno_##name((name), (desc)); | |||
| namespace ge { | |||
| class GE_FUNC_VISIBILITY StatusFactory { | |||
| public: | |||
| static StatusFactory *Instance() { | |||
| @@ -56,7 +69,7 @@ class GE_FUNC_VISIBILITY StatusFactory { | |||
| } | |||
| std::string GetErrDesc(const uint32_t err) { | |||
| const auto iter_find = err_desc_.find(err); | |||
| const std::map<uint32_t, std::string>::const_iterator iter_find = err_desc_.find(err); | |||
| if (iter_find == err_desc_.end()) { | |||
| return ""; | |||
| } | |||
| @@ -82,19 +95,6 @@ class GE_FUNC_VISIBILITY ErrorNoRegisterar { | |||
| ~ErrorNoRegisterar() {} | |||
| }; | |||
| // Code compose(4 byte), runtime: 2 bit, type: 2 bit, level: 3 bit, sysid: 8 bit, modid: 5 bit, value: 12 bit | |||
| #define GE_ERRORNO(runtime, type, level, sysid, modid, name, value, desc) \ | |||
| constexpr ge::Status(name) = (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(runtime))) << 30U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(type))) << 28U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(level))) << 25U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(sysid))) << 17U) | \ | |||
| (static_cast<uint32_t>(0xFFU & (static_cast<uint32_t>(modid))) << 12U) | \ | |||
| (static_cast<uint32_t>(0x0FFFU) & (static_cast<uint32_t>(value))); | |||
| #define GE_ERRORNO_EXTERNAL(name, desc) constexpr ErrorNoRegisterar g_errorno_##name(name, desc); | |||
| using Status = uint32_t; | |||
| // General error code | |||
| GE_ERRORNO(0, 0, 0, 0, 0, SUCCESS, 0, "success"); | |||
| GE_ERRORNO(0b11, 0b11, 0b111, 0xFFU, 0b11111, FAILED, 0xFFFU, "failed"); /*lint !e401*/ | |||
| @@ -338,6 +338,9 @@ const std::string MODIFY_MIXLIST = "ge.exec.modify_mixlist"; | |||
| const std::string OP_PRECISION_MODE = "ge.exec.op_precision_mode"; | |||
| const std::string OP_WAIT_TIMEOUT = "ge.exec.opWaitTimeout"; | |||
| const std::string OP_EXECUTE_TIMEOUT = "ge.exec.opExecuteTimeout"; | |||
| const char *const FILE_CONSTANT_PATH = "ge.exec.value_bins"; | |||
| // Graph run mode | |||
| @@ -213,9 +213,9 @@ | |||
| // If expr is not RT_ERROR_NONE, print the log | |||
| #define GE_CHK_RT(expr) \ | |||
| do { \ | |||
| const rtError_t _rt_ret = (expr); \ | |||
| if (_rt_ret != RT_ERROR_NONE) { \ | |||
| GELOGE(ge::RT_FAILED, "Call rt api failed, ret: 0x%X", _rt_ret); \ | |||
| const rtError_t _rt_err = (expr); \ | |||
| if (_rt_err != RT_ERROR_NONE) { \ | |||
| GELOGE(ge::RT_FAILED, "Call rt api failed, ret: 0x%X", _rt_err); \ | |||
| } \ | |||
| } while (false) | |||
| @@ -279,6 +279,7 @@ | |||
| } \ | |||
| } while (false) | |||
| namespace ge { | |||
| template <typename T> | |||
| GE_FUNC_VISIBILITY std::string FmtToStr(const T &t) { | |||
| std::string fmt; | |||
| @@ -287,5 +288,5 @@ GE_FUNC_VISIBILITY std::string FmtToStr(const T &t) { | |||
| fmt = st.str(); | |||
| return fmt; | |||
| } | |||
| } // namespace ge | |||
| #endif // INC_FRAMEWORK_COMMON_DEBUG_LOG_H_ | |||
| @@ -24,15 +24,15 @@ | |||
| namespace ge { | |||
| // System ID | |||
| enum SystemIdType { SYSID_GE = 8 }; | |||
| enum class SystemIdType { SYSID_GE = 8 }; | |||
| // Runtime location | |||
| enum LogRuntime { | |||
| enum class LogRuntime { | |||
| RT_HOST = 0b01, | |||
| RT_DEVICE = 0b10, | |||
| }; | |||
| // Sub model | |||
| enum SubModuleId { | |||
| enum class SubModuleId { | |||
| COMMON_MODULE = 0, | |||
| CLIENT_MODULE = 1, | |||
| INIT_MODULE = 2, | |||
| @@ -47,13 +47,13 @@ enum SubModuleId { | |||
| }; | |||
| // Error code type | |||
| enum ErrorCodeType { | |||
| enum class ErrorCodeType { | |||
| ERROR_CODE = 0b01, | |||
| EXCEPTION_CODE = 0b10, | |||
| }; | |||
| // Error level | |||
| enum ErrorLevel { | |||
| enum class ErrorLevel { | |||
| COMMON_LEVEL = 0b000, | |||
| SUGGESTION_LEVEL = 0b001, | |||
| MINOR_LEVEL = 0b010, | |||
| @@ -62,28 +62,39 @@ enum ErrorLevel { | |||
| }; | |||
| // Each module defines error codes using the following macros, name can not be modified to (name) | |||
| #define GE_ERRORNO_COMMON(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, COMMON_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_CLIENT(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, CLIENT_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_INIT(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, INIT_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_SESSION(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, SESSION_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_GRAPH(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, GRAPH_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_ENGINE(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, ENGINE_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_OPS(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, OPS_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_PLUGIN(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, PLUGIN_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_RUNTIME(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, RUNTIME_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_EXECUTOR(name, value, desc) \ | |||
| GE_ERRORNO(RT_DEVICE, ERROR_CODE, COMMON_LEVEL, SYSID_GE, EXECUTOR_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_GENERATOR(name, value, desc) \ | |||
| GE_ERRORNO(RT_HOST, ERROR_CODE, COMMON_LEVEL, SYSID_GE, GENERATOR_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_COMMON(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::COMMON_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_CLIENT(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::CLIENT_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_INIT(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::INIT_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_SESSION(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::SESSION_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_GRAPH(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::GRAPH_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_ENGINE(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::ENGINE_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_OPS(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::OPS_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_PLUGIN(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::PLUGIN_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_RUNTIME(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::RUNTIME_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_EXECUTOR(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_DEVICE, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::EXECUTOR_MODULE, name, (value), (desc)) | |||
| #define GE_ERRORNO_GENERATOR(name, value, desc) \ | |||
| GE_ERRORNO(LogRuntime::RT_HOST, ErrorCodeType::ERROR_CODE, ErrorLevel::COMMON_LEVEL, SystemIdType::SYSID_GE, \ | |||
| SubModuleId::GENERATOR_MODULE, name, (value), (desc)) | |||
| // Get error code description | |||
| #define GE_GET_ERRORNO_STR(value) ge::StatusFactory::Instance()->GetErrDesc(value) | |||
| @@ -76,15 +76,16 @@ const char_t *const kLazyRecompile = "lazy_recompile"; | |||
| // Data cache, including data address and length | |||
| struct DataBuffer { | |||
| public: | |||
| void *data; // Data address | |||
| uint64_t length; // Data length | |||
| bool isDataSupportMemShare = false; | |||
| uint32_t placement = 0U; | |||
| DataBuffer(void *data_in, const uint64_t data_len, const bool is_support_mem_share, const uint32_t placement = 0U) | |||
| DataBuffer(void *const data_in, const uint64_t data_len, const bool is_support_mem_share = false, | |||
| const uint32_t placement = 0U) | |||
| : data(data_in), length(data_len), isDataSupportMemShare(is_support_mem_share), placement(placement) {} | |||
| DataBuffer() : data(nullptr), length(0UL), isDataSupportMemShare(false) {} | |||
| DataBuffer() : data(nullptr), length(0UL), isDataSupportMemShare(false), placement(0U) {} | |||
| }; | |||
| /// | |||
| @@ -24,8 +24,6 @@ | |||
| #include "framework/common/types.h" | |||
| #include "framework/common/ge_types.h" | |||
| using std::vector; | |||
| namespace ge { | |||
| struct ModelPartition { | |||
| ModelPartitionType type; | |||
| @@ -28,8 +28,6 @@ | |||
| #include "framework/common/util.h" | |||
| #include "graph/compute_graph.h" | |||
| using std::vector; | |||
| namespace ge { | |||
| // Size of RC memory alignment, 2M | |||
| constexpr size_t ALIGN_SIZE = 2097152; | |||
| @@ -38,7 +36,7 @@ constexpr uint32_t RC_VALUE_DEFAULT = 1; | |||
| constexpr uint32_t RC_VALUE_MAX = 32; | |||
| // RC data type classification | |||
| enum RCType { | |||
| enum class RCType { | |||
| RC_DEFAULT, // Such as temporary workspace memory of operator, variable (including global and local variable) | |||
| RC_HCOM, // Output of gradient aggregation, RC value should be set to 0 | |||
| RC_L2LOSS, // Parameter of L2 loss operator, RC value should be set to 0 | |||
| @@ -49,7 +47,7 @@ enum RCType { | |||
| RC_ARGS // Args of FlowTable, actual access numbers | |||
| }; | |||
| enum MemType { INPUT_TENSOR, OUTPUT_TENSOR, WEIGHT, WORKSPACE }; | |||
| enum class MemType { INPUT_TENSOR, OUTPUT_TENSOR, WEIGHT, WORKSPACE }; | |||
| // Memory usage information < node, type, number > | |||
| struct NodeInfo { | |||
| @@ -104,8 +102,10 @@ class GE_FUNC_VISIBILITY L2CacheOptimize { | |||
| void HandOPoutput(ge::NodePtr node, std::vector<int64_t> &outputList, std::vector<RCMemoryBlock> &blocks); | |||
| // maximum common divisor | |||
| uint32_t Measure(uint32_t x, uint32_t y) { | |||
| if ((x == 0) || (y == 0)) return RC_VALUE_DEFAULT; | |||
| uint32_t Measure(uint32_t x, uint32_t y) const { | |||
| if ((x == 0) || (y == 0)) { | |||
| return RC_VALUE_DEFAULT; | |||
| } | |||
| uint32_t z = y; | |||
| while (x % y != 0) { | |||
| z = x % y; | |||
| @@ -36,8 +36,7 @@ class GE_FUNC_VISIBILITY OpTypeContainer { | |||
| } | |||
| bool IsExisting(const std::string &op_type) { | |||
| auto iter_find = op_type_list_.find(op_type); | |||
| return iter_find != op_type_list_.end(); | |||
| return op_type_list_.find(op_type) != op_type_list_.end(); | |||
| } | |||
| protected: | |||
| @@ -24,7 +24,7 @@ | |||
| /// @brief Output the profiling data of single operator in Pytorch, and does not support multithreading | |||
| /// @return Status result | |||
| /// | |||
| GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream); | |||
| GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t const stream); | |||
| GE_FUNC_VISIBILITY ge::Status ProfGetDeviceFormGraphId(uint32_t graph_id, uint32_t &device_id); | |||
| @@ -104,7 +104,7 @@ class ProfilingContext { | |||
| int64_t RegisterString(const std::string &str); | |||
| int64_t RegisterStringHash(const uint64_t hash_id, const std::string &str); | |||
| void UpdateElementHashId(MsprofReporterCallback reporter_callback); | |||
| void UpdateElementHashId(const MsprofReporterCallback reporter_callback); | |||
| static Status QueryHashId(const MsprofReporterCallback reporter_callback, const std::string &src_str, | |||
| uint64_t &hash_id); | |||
| size_t GetRegisterStringNum() const { | |||
| @@ -126,10 +126,10 @@ class ProfilingContext { | |||
| class ScopeProfiler { | |||
| public: | |||
| ScopeProfiler(int64_t element, int64_t event) : element_(element), event_(event) { | |||
| ProfilingContext::GetInstance().RecordCurrentThread(element_, event, kEventStart); | |||
| ProfilingContext::GetInstance().RecordCurrentThread(element_, event, EventType::kEventStart); | |||
| } | |||
| ~ScopeProfiler() { | |||
| ProfilingContext::GetInstance().RecordCurrentThread(element_, event_, kEventEnd); | |||
| ProfilingContext::GetInstance().RecordCurrentThread(element_, event_, EventType::kEventEnd); | |||
| } | |||
| private: | |||
| @@ -139,8 +139,8 @@ class ScopeProfiler { | |||
| } // namespace profiling | |||
| } // namespace ge | |||
| #define PROFILING_START(element, event) \ | |||
| profiling::ProfilingContext::GetInstance().RecordCurrentThread(element, event, profiling::kEventStart) | |||
| profiling::ProfilingContext::GetInstance().RecordCurrentThread(element, event, profiling::EventType::kEventStart) | |||
| #define PROFILING_END(element, event) \ | |||
| profiling::ProfilingContext::GetInstance().RecordCurrentThread(element, event, profiling::kEventEnd) | |||
| profiling::ProfilingContext::GetInstance().RecordCurrentThread(element, event, profiling::EventType::kEventEnd) | |||
| #define PROFILING_SCOPE(element, event) profiling::ScopeProfiler profiler(element, event) | |||
| #endif // AIR_CXX_PROFILING_DEFINITIONS_H | |||
| @@ -23,7 +23,7 @@ namespace ge { | |||
| const int32_t CC_FUSION_OP_MAX = 32; | |||
| typedef enum tagCcStatus { | |||
| enum class ccStatus_t { | |||
| CC_STATUS_SUCCESS = 0, /**< succ */ | |||
| CC_STATUS_NOT_INITIALIZED = 1, /**< not init */ | |||
| CC_STATUS_ALLOC_FAILED = 2, /**< alloc mem failed */ | |||
| @@ -34,9 +34,9 @@ typedef enum tagCcStatus { | |||
| CC_STATUS_NOT_SUPPORTED = 7, /**< unsupport error */ | |||
| CC_STATUS_INVALID_VALUE = 7, /**< invalid value error for blas*/ | |||
| CC_STATUS_RESERVED /**< just for check */ | |||
| } ccStatus_t; | |||
| }; | |||
| typedef enum tagccKernelType { | |||
| enum class ccKernelType { | |||
| CCE_AI_CORE = 0, /* cce aicore */ | |||
| CCE_AI_CPU = 1, /* cce aicpu */ | |||
| TE = 2, /* te operator*/ | |||
| @@ -47,9 +47,9 @@ typedef enum tagccKernelType { | |||
| CUST_AI_CPU = 7, /* custom aicpu*/ | |||
| HOST_CPU = 8, /* host cpu */ | |||
| INVALID = 10000 /* unknown kernel type */ | |||
| } ccKernelType; | |||
| }; | |||
| typedef struct tagOpContext { | |||
| using ccOpContext = struct tagOpContext { | |||
| ccKernelType kernelType; | |||
| uint32_t opId; | |||
| uint32_t kernelFuncId; | |||
| @@ -66,7 +66,7 @@ typedef struct tagOpContext { | |||
| uint64_t genVariableBaseAddr; | |||
| uint64_t genVariableBaseSize; | |||
| uint64_t l2ctrlSize; | |||
| } ccOpContext; | |||
| }; | |||
| } // namespace ge | |||
| #endif // INC_FRAMEWORK_COMMON_TASKDOWN_COMMON_H_ | |||
| @@ -19,7 +19,6 @@ | |||
| #include <climits> | |||
| #include <cstdint> | |||
| #include <algorithm> | |||
| #include <map> | |||
| #include <memory> | |||
| #include <string> | |||
| @@ -48,15 +48,19 @@ | |||
| // new ge marco | |||
| // Encapsulate common resource releases | |||
| #define GE_MAKE_GUARD_RTMEM(var) \ | |||
| GE_MAKE_GUARD(var, [&] { \ | |||
| if (var) GE_CHK_RT(rtFreeHost(var)); \ | |||
| }); | |||
| #define GE_MAKE_GUARD_RTMEM(var) \ | |||
| GE_MAKE_GUARD(var, [&] { \ | |||
| if ((var) != nullptr) { \ | |||
| GE_CHK_RT(rtFreeHost(var)); \ | |||
| } \ | |||
| }) | |||
| #define GE_MAKE_GUARD_RTSTREAM(var) \ | |||
| GE_MAKE_GUARD(var, [&] { \ | |||
| if (var) GE_CHK_RT(rtStreamDestroy(var)); \ | |||
| }); | |||
| #define GE_MAKE_GUARD_RTSTREAM(var) \ | |||
| GE_MAKE_GUARD(var, [&] { \ | |||
| if ((var) != nullptr) { \ | |||
| GE_CHK_RT(rtStreamDestroy(var)); \ | |||
| } \ | |||
| }) | |||
| // For propagating errors when calling a function. | |||
| #define GE_RETURN_IF_ERROR(expr) \ | |||
| @@ -403,16 +407,6 @@ GE_FUNC_VISIBILITY bool CheckOutputPathValid(const std::string &file_path, const | |||
| /// @param [out] result | |||
| /// | |||
| GE_FUNC_VISIBILITY bool ValidateStr(const std::string &file_path, const std::string &mode); | |||
| /// | |||
| /// @ingroup domi_common | |||
| /// @brief Check path invalid | |||
| /// @param [in] path, path to be checked | |||
| /// @param [in] length, length of path | |||
| /// @return 0 success | |||
| /// @return -1 fail | |||
| /// | |||
| GE_FUNC_VISIBILITY Status CheckPath(const char_t *path, size_t length); | |||
| } // namespace ge | |||
| #endif // AIR_INC_FRAMEWORK_COMMON_UTIL_H_ | |||
| @@ -26,7 +26,7 @@ | |||
| #include "graph/types.h" | |||
| namespace ge { | |||
| enum PriorityEnum { | |||
| enum class PriorityEnum { | |||
| COST_0 = 0, | |||
| COST_1, | |||
| COST_2, | |||
| @@ -38,7 +38,7 @@ enum PriorityEnum { | |||
| struct DNNEngineAttribute { | |||
| std::string engine_name; | |||
| std::vector<std::string> mem_type; | |||
| uint32_t compute_cost; | |||
| PriorityEnum compute_cost; | |||
| enum RuntimeType runtime_type; // HOST, DEVICE | |||
| // If engine input format must be specific, set this attribute, else set FORMAT_RESERVED | |||
| Format engine_input_format; | |||
| @@ -53,10 +53,10 @@ class GE_FUNC_VISIBILITY DNNEngine { | |||
| engine_attribute_ = attrs; | |||
| } | |||
| virtual ~DNNEngine() = default; | |||
| Status Initialize(const std::map<std::string, std::string> &options) { | |||
| Status Initialize(const std::map<std::string, std::string> &options) const { | |||
| return SUCCESS; | |||
| } | |||
| Status Finalize() { | |||
| Status Finalize() const { | |||
| return SUCCESS; | |||
| } | |||
| void GetAttributes(DNNEngineAttribute &attr) const { | |||
| @@ -70,7 +70,7 @@ class GE_FUNC_VISIBILITY GeExecutor { | |||
| /// | |||
| static Status FinalizeEx(); | |||
| Status UnloadModel(uint32_t modelId); | |||
| Status UnloadModel(uint32_t model_id); | |||
| // Get input and output descriptor | |||
| Status GetModelDescInfo(uint32_t model_id, std::vector<TensorDesc> &input_desc, std::vector<TensorDesc> &output_desc, | |||
| @@ -248,7 +248,7 @@ class GE_FUNC_VISIBILITY GeExecutor { | |||
| /// @param [out] domi::OutputData *output_data: Model output data | |||
| /// @return SUCCESS handle successfully / others handle failed | |||
| /// | |||
| Status ExecModel(uint32_t model_id, void *stream, const RunModelData &input_data, RunModelData &output_data, | |||
| Status ExecModel(uint32_t model_id, void *stream, const RunModelData &run_input_data, RunModelData &run_output_data, | |||
| bool async_mode = false); | |||
| /// | |||
| @@ -288,19 +288,19 @@ class GE_FUNC_VISIBILITY GeExecutor { | |||
| /// | |||
| Status GetMemAndWeightSize(const void *model_data, size_t model_size, size_t &mem_size, size_t &weight_size); | |||
| static Status LoadSingleOp(const std::string &modelName, const ModelData &modelData, void *stream, | |||
| static Status LoadSingleOp(const std::string &model_name, const ModelData &model_data, void *stream, | |||
| SingleOp **single_op); | |||
| static Status LoadSingleOpV2(const std::string &modelName, const ModelData &modelData, void *stream, | |||
| static Status LoadSingleOpV2(const std::string &model_name, const ModelData &model_data, void *stream, | |||
| SingleOp **single_op, const uint64_t model_id); | |||
| static Status ExecuteAsync(SingleOp *executor, const std::vector<DataBuffer> &inputs, | |||
| std::vector<DataBuffer> &outputs); | |||
| static Status LoadDynamicSingleOp(const std::string &model_name, const ModelData &modelData, void *stream, | |||
| static Status LoadDynamicSingleOp(const std::string &model_name, const ModelData &model_data, void *stream, | |||
| DynamicSingleOp **single_op); | |||
| static Status LoadDynamicSingleOpV2(const std::string &model_name, const ModelData &modelData, void *stream, | |||
| static Status LoadDynamicSingleOpV2(const std::string &model_name, const ModelData &model_data, void *stream, | |||
| DynamicSingleOp **single_op, const uint64_t model_id); | |||
| static Status ExecuteAsync(DynamicSingleOp *executor, const std::vector<GeTensorDesc> &input_desc, | |||
| @@ -122,7 +122,7 @@ class GE_FUNC_VISIBILITY GeGenerator { | |||
| void RemoveConst(const std::vector<GeTensor> &inputs, std::vector<GeTensor> &outputs); | |||
| Status CheckForSingleOp(const OpDescPtr &op_desc, const std::vector<GeTensor> &inputs, | |||
| const std::vector<GeTensor> &outputs); | |||
| Status InferFormatForSingleOp(const OpDescPtr &op_desc, const Graph &graph); | |||
| Status InferFormatForSingleOp(const OpDescPtr &op_desc, const Graph &graph) const; | |||
| using GeRootModelPtr = std::shared_ptr<ge::GeRootModel>; | |||
| Status SetModelNameForDump(const GeRootModelPtr &ge_root_model); | |||
| @@ -18,6 +18,7 @@ | |||
| #define INC_FRAMEWORK_MEMORY_MEMORY_API_H_ | |||
| #include <vector> | |||
| #include "external/ge/ge_api_error_codes.h" | |||
| #include "runtime/mem.h" | |||
| @@ -108,6 +108,8 @@ class GE_FUNC_VISIBILITY ModelParser { | |||
| * @return Others failed | |||
| */ | |||
| virtual domi::Status ToJson(const char *model_file, const char *json_file) { | |||
| (void)model_file; | |||
| (void)json_file; | |||
| return domi::SUCCESS; | |||
| } | |||
| @@ -130,6 +132,8 @@ class GE_FUNC_VISIBILITY ModelParser { | |||
| * @return Others failed | |||
| */ | |||
| virtual domi::Status ParseProto(const std::string &serialized_proto, ge::ComputeGraphPtr &graph) { | |||
| (void)serialized_proto; | |||
| (void)graph; | |||
| return UNSUPPORTED; | |||
| } | |||
| @@ -144,6 +148,9 @@ class GE_FUNC_VISIBILITY ModelParser { | |||
| */ | |||
| virtual domi::Status ParseProtoWithSubgraph(const std::string &serialized_proto, GetGraphCallbackV2 callback, | |||
| ge::ComputeGraphPtr &graph) { | |||
| (void)serialized_proto; | |||
| (void)callback; | |||
| (void)graph; | |||
| return UNSUPPORTED; | |||
| } | |||
| }; | |||
| @@ -24,13 +24,11 @@ | |||
| #include "framework/omg/omg_inner_types.h" | |||
| #include "framework/omg/parser/parser_types.h" | |||
| using Status = domi::Status; | |||
| namespace domi { | |||
| class WeightsParser; | |||
| class ModelParser; | |||
| typedef std::shared_ptr<ModelParser> (*MODEL_PARSER_CREATOR_FUN)(void); | |||
| using MODEL_PARSER_CREATOR_FUN = std::shared_ptr<ModelParser> (*)(void); | |||
| // Create modelparser for different frameworks | |||
| class GE_FUNC_VISIBILITY ModelParserFactory { | |||
| @@ -82,7 +80,7 @@ class GE_FUNC_VISIBILITY ModelParserRegisterar { | |||
| } \ | |||
| ModelParserRegisterar g_##type##_Model_Parser_Creator(type, Creator_##type##_Model_Parser) | |||
| typedef std::shared_ptr<WeightsParser> (*WEIGHTS_PARSER_CREATOR_FUN)(void); | |||
| using WEIGHTS_PARSER_CREATOR_FUN = std::shared_ptr<WeightsParser> (*)(void); | |||
| // Create weightsparser for different frameworks | |||
| class GE_FUNC_VISIBILITY WeightsParserFactory { | |||
| @@ -1 +1 @@ | |||
| Subproject commit 7b53eb2eca1680ba5c24c4def5c0a48d8292a744 | |||
| Subproject commit b903e17423bb8f5f97b5cc4cae2ec54a7bf701b8 | |||
| @@ -62,6 +62,7 @@ static const int32_t ACL_ERROR_RT_OVER_LIMIT = 207012; // over l | |||
| static const int32_t ACL_ERROR_RT_QUEUE_EMPTY = 207013; // queue is empty | |||
| static const int32_t ACL_ERROR_RT_QUEUE_FULL = 207014; // queue is full | |||
| static const int32_t ACL_ERROR_RT_REPEATED_INIT = 207015; // repeated init | |||
| static const int32_t ACL_ERROR_RT_AIVEC_OVER_FLOW = 207016; // aivec over flow | |||
| static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error | |||
| static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error | |||
| @@ -2104,6 +2104,8 @@ REG_OP(RotatedOverlaps) | |||
| *@li mode: An optional attr, a character string with the value range of ['iou', 'iof'], | |||
| * only support 'iou' now. | |||
| *@li is_cross: Cross calculation when it is True, and one-to-one calculation when it is False. | |||
| *@li v_threshold: An optional attr, provide condition relaxation for intersection calculation. | |||
| *@li e_threshold: An optional attr, provide condition relaxation for intersection calculation. | |||
| *@par Outputs: | |||
| * iou: A 3D Tensor of float32 with shape [B, N, K]. | |||
| @@ -2118,6 +2120,8 @@ REG_OP(RotatedIou) | |||
| .ATTR(trans, Bool, false) | |||
| .ATTR(mode, String, "iou") | |||
| .ATTR(is_cross, Bool, true) | |||
| .ATTR(v_threshold, Float, 0) | |||
| .ATTR(e_threshold, Float, 0) | |||
| .OP_END_FACTORY_REG(RotatedIou) | |||
| /** | |||
| @@ -17,6 +17,7 @@ | |||
| #define PROF_HCCL_TRACE 0x00000020ULL | |||
| #define PROF_TRAINING_TRACE 0x00000040ULL | |||
| #define PROF_MSPROFTX 0x00000080ULL | |||
| #define PROF_RUNTIME_API 0x00000100ULL | |||
| // system profilinig switch | |||
| #define PROF_CPU 0x00010000ULL | |||
| @@ -28,7 +29,6 @@ | |||
| #define PROF_AIVECTORCORE_SAMPLE 0x00400000ULL | |||
| #define PROF_MODEL_EXECUTE 0x0000001000000ULL | |||
| #define PROF_RUNTIME_API 0x0000002000000ULL | |||
| #define PROF_RUNTIME_TRACE 0x0000004000000ULL | |||
| #define PROF_SCHEDULE_TIMELINE 0x0000008000000ULL | |||
| #define PROF_SCHEDULE_TRACE 0x0000010000000ULL | |||
| @@ -50,6 +50,7 @@ | |||
| #define PROF_HCCL_TRACE_MASK 0x00000020ULL | |||
| #define PROF_TRAINING_TRACE_MASK 0x00000040ULL | |||
| #define PROF_MSPROFTX_MASK 0x00000080ULL | |||
| #define PROF_RUNTIME_API_MASK 0x00000100ULL | |||
| // system profilinig mask | |||
| #define PROF_CPU_MASK 0x00010000ULL | |||
| @@ -61,7 +62,6 @@ | |||
| #define PROF_AIVECTORCORE_SAMPLE_MASK 0x00400000ULL | |||
| #define PROF_MODEL_EXECUTE_MASK 0x0000001000000ULL | |||
| #define PROF_RUNTIME_API_MASK 0x0000002000000ULL | |||
| #define PROF_RUNTIME_TRACE_MASK 0x0000004000000ULL | |||
| #define PROF_SCHEDULE_TIMELINE_MASK 0x0000008000000ULL | |||
| #define PROF_SCHEDULE_TRACE_MASK 0x0000010000000ULL | |||
| @@ -158,24 +158,6 @@ MSVP_PROF_API int aclprofSetCategoryName(uint32_t category, const char *category | |||
| * @retval void | |||
| */ | |||
| MSVP_PROF_API int aclprofSetStampCategory(void *stamp, uint32_t category); | |||
| /** | |||
| * @ingroup AscendCL | |||
| * @brief set message to stamp | |||
| * | |||
| * | |||
| * @retval void | |||
| */ | |||
| MSVP_PROF_API int aclprofSetStampTraceMessage(void *stamp, const char *msg, uint32_t msgLen); | |||
| /** | |||
| * @ingroup AscendCL | |||
| * @brief Record mark timestamp | |||
| * | |||
| * @retval ACL_SUCCESS The function is successfully executed. | |||
| * @retval OtherValues Failure | |||
| */ | |||
| MSVP_PROF_API int aclprofMark(void *stamp); | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||