Synchronize with latest Ascend software suite 28 Nov 2020

pull/454/head
yanghaoran 4 years ago
parent 383f7f751d
commit e95bc1b18f

@ -66,7 +66,7 @@ elseif(DEFINED ENV{D_LINK_PATH})
endif()
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
find_library(slog libslog.so ${GE_LIB_PATH})
find_library(mmpa libmmpa.so ${GE_LIB_PATH})
find_library(mmpa libmmpa.a ${GE_LIB_PATH})
find_library(runtime libruntime.so ${GE_LIB_PATH})
find_library(msprof libmsprofiler.a ${GE_LIB_PATH})
find_library(register libregister.so ${GE_LIB_PATH})
@ -84,7 +84,7 @@ else()
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common ${ASCEND_DIR}/driver/lib64)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64 ${ASCEND_DIR}/acllib/lib64 ${ASCEND_DIR}/atc/lib64)
find_library(slog libslog.so ${ASCEND_DRIVER_DIR})
find_library(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_library(mmpa libmmpa.a ${ASCEND_RUNTIME_DIR})
find_library(msprof libmsprofiler.a ${ASCEND_RUNTIME_DIR})
find_library(hccl libhccl.so ${ASCEND_RUNTIME_DIR})

@ -67,6 +67,28 @@ class ErrorManager {
void ATCReportErrMessage(std::string error_code, const std::vector<std::string> &key = {},
const std::vector<std::string> &value = {});
///
/// @brief report graph compile failed message such as error code and op_name in mstune case
/// @param [in] msg: failed message map, key is error code, value is op_name
/// @return int 0(success) -1(fail)
///
int ReportMstuneCompileFailedMsg(const std::map<std::string, std::string> &msg);
///
/// @brief save graph compile failed message from thread local map to global map
/// @param [in] graph_name: graph name
///
void SaveMstuneCompileFailedMsg(const std::string &graph_name);
///
/// @brief get graph compile failed message in mstune case
/// @param [in] graph_name: graph name
/// @param [out] msg_map: failed message map, key is error code, value is op_name list
/// @return int 0(success) -1(fail)
///
int GetMstuneCompileFailedMsg(const std::string &graph_name,
std::map<std::string, std::vector<std::string>> &msg_map);
private:
struct ErrorInfo {
std::string error_id;
@ -91,6 +113,7 @@ class ErrorManager {
std::map<std::string, ErrorInfo> error_map_;
std::vector<std::string> error_messages_;
std::vector<std::string> warning_messages_;
std::map<std::string, std::map<std::string, std::vector<std::string>>> compile_failed_msg_map_;
};
#endif // ERROR_MANAGER_H_

@ -29,16 +29,26 @@
namespace ge {
typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map<std::string, ge::Tensor> &params_list);
namespace session {
typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map<AscendString, ge::Tensor> &params_list);
}
// Initialize GE
ATTRIBUTED_DEPRECATED(Status GEInitialize(const std::map<AscendString, AscendString> &))
Status GEInitialize(const std::map<std::string, std::string> &options);
Status GEInitialize(const std::map<AscendString, AscendString> &options);
// Finalize GE, release all resources
Status GEFinalize();
class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session {
public:
ATTRIBUTED_DEPRECATED(Session(const std::map<AscendString, AscendString> &))
explicit Session(const std::map<std::string, std::string> &options);
explicit Session(const std::map<AscendString, AscendString> &options);
~Session();
///
@ -57,8 +67,19 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session {
/// @param [in] options graph options
/// @return Status result of function
///
ATTRIBUTED_DEPRECATED(Status AddGraph(uint32_t, const Graph &, const std::map<AscendString, AscendString> &))
Status AddGraph(uint32_t graphId, const Graph &graph, const std::map<std::string, std::string> &options);
///
/// @ingroup client
/// @brief add a graph with a specific graphId and graphOptions
/// @param [in] graphId graph id
/// @param [in] graph the graph
/// @param [in] options graph options
/// @return Status result of function
///
Status AddGraph(uint32_t graphId, const Graph &graph, const std::map<AscendString, AscendString> &options);
///
/// @ingroup client
/// @brief add a copy graph with a specific graphId
@ -124,8 +145,18 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session {
/// @param [out] var_values: variable values
/// @return Status result of function
///
ATTRIBUTED_DEPRECATED(Status GetVariables(const std::vector<std::string> &, std::vector<Tensor> &))
Status GetVariables(const std::vector<std::string> &var_names, std::vector<Tensor> &var_values);
///
/// @ingroup ge_graph
/// @brief get variables in the session with specific session id
/// @param [in] var_names: variable names
/// @param [out] var_values: variable values
/// @return Status result of function
///
Status GetVariables(const std::vector<AscendString> &var_names, std::vector<Tensor> &var_values);
///
/// @ingroup ge_graph
/// @brief register callback func with specific summary or checkpoint by users
@ -135,8 +166,11 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session {
/// Please ensure that the implementation of the function is trusted.
/// @return Status result of function
///
ATTRIBUTED_DEPRECATED(Status RegisterCallBackFunc(const char *, const session::pCallBackFunc &))
Status RegisterCallBackFunc(const std::string &key, const pCallBackFunc &callback);
Status RegisterCallBackFunc(const char *key, const session::pCallBackFunc &callback);
bool IsGraphNeedRebuild(uint32_t graphId);
private:

@ -19,8 +19,15 @@
#include <map>
#include <string>
#include "ge_error_codes.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
class StatusFactory {
public:
static StatusFactory *Instance() {
@ -36,6 +43,17 @@ class StatusFactory {
err_desc_[err] = desc;
}
void RegisterErrorNo(uint32_t err, const char *desc) {
if (desc == nullptr) {
return;
}
std::string error_desc = desc;
if (err_desc_.find(err) != err_desc_.end()) {
return;
}
err_desc_[err] = error_desc;
}
std::string GetErrDesc(uint32_t err) {
auto iter_find = err_desc_.find(err);
if (iter_find == err_desc_.end()) {
@ -55,6 +73,7 @@ class StatusFactory {
class ErrorNoRegisterar {
public:
ErrorNoRegisterar(uint32_t err, const std::string &desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); }
ErrorNoRegisterar(uint32_t err, const char *desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); }
~ErrorNoRegisterar() {}
};
@ -66,11 +85,47 @@ class ErrorNoRegisterar {
((0xFF & (static_cast<uint8_t>(modid))) << 12) | (0x0FFF & (static_cast<uint16_t>(value))); \
const ErrorNoRegisterar g_##name##_errorno(name, desc);
#define GE_ERRORNO_EXTERNAL(name, desc) const ErrorNoRegisterar g_##name##_errorno(name, desc);
using Status = uint32_t;
// General error code
GE_ERRORNO(0, 0, 0, 0, 0, SUCCESS, 0, "success");
GE_ERRORNO(0b11, 0b11, 0b111, 0xFF, 0b11111, FAILED, 0xFFF, "failed");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_PARAM_INVALID, "Parameter invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_NOT_INIT, "GE executor not initialized yet.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, "Model file path invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, "Model id invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_KEY_PATH_INVALID, "Model key path invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_NOT_SUPPORT_ENCRYPTION, "Model does not support encryption.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Data size of model invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID, "Model addr invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID, "Queue id of model invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "The model loaded repeatedly.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_MODEL_PARTITION_NUM_INVALID, "Model partition num invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID, "Dynamic input addr invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID, "Dynamic input size invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID, "Dynamic batch size invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_AIPP_BATCH_EMPTY, "AIPP batch parameter empty.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_AIPP_NOT_EXIST, "AIPP parameter not exist.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_AIPP_MODE_INVALID, "AIPP mode invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_OP_TASK_TYPE_INVALID, "Task type invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID, "Kernel type invalid.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_MEMORY_ALLOCATION, "Memory allocation error.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_INTERNAL_ERROR, "Internal error.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_LOAD_MODEL, "Load model error.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED, "Failed to load model partition.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED, "Failed to load weight partition.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED, "Failed to load task partition.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED, "Failed to load op kernel partition.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "Failed to release the model data.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_COMMAND_HANDLE, "Command handle error.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_GET_TENSOR_INFO, "Get tensor info error.");
GE_ERRORNO_EXTERNAL(ACL_ERROR_GE_UNLOAD_MODEL, "Load model error.");
} // namespace ge
#endif // INC_EXTERNAL_GE_GE_API_ERROR_CODES_H_

@ -65,7 +65,47 @@ const char *const OPTION_EXEC_ENABLE_TAILING_OPTIMIZATION = "ge.exec.isTailingOp
// Option key: memory init
const char *const GRAPH_MEMORY_MAX_SIZE = "ge.graphMemoryMaxSize";
const char *const VARIABLE_MEMORY_MAX_SIZE = "ge.variableMemoryMaxSize";
namespace configure_option {
const char *const STREAM_NUM = "ge.streamNum";
const char *const HEAD_STREAM = "ge.headStream";
const char *const PERF_LEVEL = "ge.perfLevel";
const char *const ENCRYPT_MODE = "ge.encryptMode";
const char *const EK_FILE = "ge.ekFile";
const char *const CERT_FILE = "ge.certFile";
const char *const HW_KEY_FILE = "ge.hwKeyFile";
const char *const PRIVATE_KEY_FILE = "ge.privateKeyFile";
const char *const FRAMEWORK_TYPE = "ge.frameworkType";
const char *const CALIBRATION_CONF_FILE = "ge.calibrationConfFile";
const char *const INSERT_OP_FILE = "ge.insertOpFile";
const char *const OUTPUT_NODE_NAME = "ge.outputNodeName";
const char *const COMPRESS_FLAG = "ge.compressFlag";
const char *const PRECISION_MODE = "ge.exec.precision_mode";
const char *const SINGLE_OP_FLAG = "ge.exec.single_op";
const char *const TRAIN_FLAG = "ge.trainFlag";
const char *const RUN_FLAG = "ge.runFlag";
const char *const LOCAL_FMKOP_FLAG = "ge.enabledLocalFmkop";
const char *const TBE_PLUGIN_PATH_FLAG = "ge.TBE_plugin_path";
const char *const DDK_VERSION_FLAG = "ge.DDK_version";
const char *const GE_FE_FLAG = "ge.feFlag";
const char *const STREAM_MAX_PARALLEL_NUM = "ge.streamMaxParallelNum";
const char *const OUTPUT_DATATYPE = "ge.outputDatatype";
const char *const OP_SELECT_IMPL_MODE = "ge.opSelectImplmode";
const char *const OPTYPELIST_FOR_IMPLMODE = "ge.optypelistForImplmode";
const char *const HCOM_PARALLEL = "ge.hcomParallel";
const char *const AUTO_TUNE_MODE = "ge.autoTuneMode";
const char *const SOC_VERSION = "ge.socVersion";
const char *const CORE_TYPE = "ge.engineType";
const char *const AICORE_NUM = "ge.aicoreNum";
const char *const L1_FUSION = "ge.l1Fusion";
const char *const BUFFER_OPTIMIZE = "ge.bufferOptimize";
const char *const ENABLE_SMALL_CHANNEL = "ge.enableSmallChannel";
const char *const ENABLE_COMPRESS_WEIGHT = "ge.enableCompressWeight";
const char *const FUSION_SWITCH_FILE = "ge.fusionSwitchFile";
const char *const SAVE_ORIGINAL_MODEL = "ge.saveOriginalModel";
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";
} // namespace configure_option
// Configure stream num by Session constructor options param,
// its value should be int32_t type, default value is "1"
const std::string STREAM_NUM = "ge.streamNum";
@ -174,6 +214,9 @@ const std::string HCOM_PARALLEL = "ge.hcomParallel";
// configure whether to use dynamic batch size
const char *const kDynamicBatchSize = "ge.dynamicBatchSize";
const std::string INPUT_SHAPE = "ge.inputShape";
const std::string DYNAMIC_NODE_TYPE = "ge.dynamicNodeType";
// configure whether to use dynamic image size
const char *const kDynamicImageSize = "ge.dynamicImageSize";
@ -323,6 +366,7 @@ static const char *const OP_COMPILER_CACHE_DIR = ge::OP_COMPILER_CACHE_DIR;
static const char *const OP_COMPILER_CACHE_MODE = ge::OP_COMPILER_CACHE_MODE;
static const char *const MDL_BANK_PATH_FLAG = ge::MDL_BANK_PATH_FLAG.c_str();
static const char *const OP_BANK_PATH_FLAG = ge::OP_BANK_PATH_FLAG.c_str();
static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str();
// for interface: aclgrphBuildModel
const std::set<std::string> ir_builder_suppported_options = {INPUT_FORMAT,
@ -342,7 +386,9 @@ const std::set<std::string> ir_builder_suppported_options = {INPUT_FORMAT,
OP_DEBUG_LEVEL,
DEBUG_DIR,
OP_COMPILER_CACHE_DIR,
OP_COMPILER_CACHE_MODE};
OP_COMPILER_CACHE_MODE,
MDL_BANK_PATH_FLAG,
OP_BANK_PATH_FLAG};
// for interface: aclgrphParse
const std::set<std::string> ir_parser_suppported_options = {INPUT_FORMAT,
@ -357,9 +403,7 @@ const std::set<std::string> ir_parser_suppported_options = {INPUT_FORMAT,
OUT_NODES,
COMPRESS_WEIGHT_CONF,
ENABLE_SCOPE_FUSION_PASSES,
LOG_LEVEL,
MDL_BANK_PATH_FLAG,
OP_BANK_PATH_FLAG};
LOG_LEVEL};
// for interface: aclgrphBuildInitialize
const std::set<std::string> global_options = {CORE_TYPE,

@ -0,0 +1,58 @@
/**
* 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_EXTERNAL_GE_GE_ERROR_CODES_H_
#define INC_EXTERNAL_GE_GE_ERROR_CODES_H_
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
static const uint32_t ACL_ERROR_GE_PARAM_INVALID = 145000;
static const uint32_t ACL_ERROR_GE_EXEC_NOT_INIT = 145001;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID = 145002;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ID_INVALID = 145003;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_KEY_PATH_INVALID = 145004;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_NOT_SUPPORT_ENCRYPTION = 145005;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID = 145006;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID = 145007;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID = 145008;
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED = 145009;
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PARTITION_NUM_INVALID = 145010;
static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID = 145011;
static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID = 145012;
static const uint32_t ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID = 145013;
static const uint32_t ACL_ERROR_GE_AIPP_BATCH_EMPTY = 145014;
static const uint32_t ACL_ERROR_GE_AIPP_NOT_EXIST = 145015;
static const uint32_t ACL_ERROR_GE_AIPP_MODE_INVALID = 145016;
static const uint32_t ACL_ERROR_GE_OP_TASK_TYPE_INVALID = 145017;
static const uint32_t ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID = 145018;
static const uint32_t ACL_ERROR_GE_MEMORY_ALLOCATION = 245000;
static const uint32_t ACL_ERROR_GE_INTERNAL_ERROR = 545000;
static const uint32_t ACL_ERROR_GE_LOAD_MODEL = 545001;
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED = 545002;
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED = 545003;
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED = 545004;
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED = 545005;
static const uint32_t ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA = 545006;
static const uint32_t ACL_ERROR_GE_COMMAND_HANDLE = 545007;
static const uint32_t ACL_ERROR_GE_GET_TENSOR_INFO = 545008;
static const uint32_t ACL_ERROR_GE_UNLOAD_MODEL = 545009;
#ifdef __cplusplus
} // namespace ge
#endif
#endif // INC_EXTERNAL_GE_GE_ERROR_CODES_H_

@ -44,8 +44,11 @@ struct ModelBufferData {
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &))
graphStatus aclgrphBuildInitialize(std::map<std::string, std::string> global_options);
graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &global_options);
/**
* @ingroup AscendCL
* @brief build model.Notice the model is stored in buffer
@ -63,9 +66,14 @@ void aclgrphBuildFinalize();
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ATTRIBUTED_DEPRECATED(graphStatus aclgrphBuildModel(const ge::Graph &, const std::map<AscendString, AscendString> &,
ModelBufferData &))
graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string, std::string> &build_options,
ModelBufferData &model);
graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendString, AscendString> &build_options,
ModelBufferData &model);
/**
* @ingroup AscendCL
* @brief save model buffer to file
@ -75,8 +83,11 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ATTRIBUTED_DEPRECATED(graphStatus aclgrphSaveModel(const char *, const ModelBufferData &))
graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &model);
graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &model);
/**
* @ingroup AscendCL
* @brief query IR interface version
@ -110,5 +121,5 @@ graphStatus aclgrphInferShapeAndType(ge::Graph &graph);
* @retval OtherValues Failure
*/
graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const size_t len);
}; // namespace ge
#endif
}; // namespace ge
#endif // INC_EXTERNAL_GE_IR_BUILD_H_

@ -19,6 +19,7 @@
#include <string>
#include <memory>
#include <functional>
namespace ge {
class AscendString {
@ -27,7 +28,7 @@ class AscendString {
~AscendString() = default;
explicit AscendString(const char* name);
AscendString(const char* name);
const char* GetString() const;
@ -47,4 +48,17 @@ class AscendString {
std::shared_ptr<std::string> name_;
};
} // namespace ge
namespace std {
template <>
struct hash<ge::AscendString> {
size_t operator()(const ge::AscendString& name) const {
std::string str_name;
if (name.GetString() != nullptr) {
str_name = name.GetString();
}
return hash<string>()(str_name);
}
};
} // namespace std
#endif // INC_EXTERNAL_GRAPH_ASCEND_STRING_H_

@ -23,6 +23,7 @@
#include <vector>
#include "./ge_error_codes.h"
#include "ascend_string.h"
using std::make_shared;
using std::map;
@ -60,6 +61,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY AttrValue {
return val;
}
graphStatus GetValue(AscendString &val);
std::shared_ptr<AttrValueImpl> impl;
private:

@ -28,10 +28,16 @@ namespace ge {
#else
#define GE_FUNC_DEV_VISIBILITY
#endif
#ifdef __GNUC__
#define ATTRIBUTED_DEPRECATED(replacement) __attribute__((deprecated("Please use " #replacement " instead.")))
#else
#define ATTRIBUTED_DEPRECATED(replacement) __declspec(deprecated("Please use " #replacement " instead."))
#endif
using graphStatus = uint32_t;
const graphStatus GRAPH_FAILED = 0xFFFFFFFF;
const graphStatus GRAPH_SUCCESS = 0;
const graphStatus GRAPH_NOT_CHANGED = 1343242304;
const graphStatus GRAPH_PARAM_INVALID = 50331649;
const graphStatus GRAPH_NODE_WITHOUT_CONST_INPUT = 50331648;
} // namespace ge

@ -44,9 +44,9 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GNode {
~GNode() = default;
graphStatus GetType(ge::AscendString &type) const;
graphStatus GetType(AscendString &type) const;
graphStatus GetName(ge::AscendString &name) const;
graphStatus GetName(AscendString &name) const;
std::pair<GNodePtr, int32_t> GetInDataNodesAndPortIndexs(const int32_t index) const;
@ -58,9 +58,9 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GNode {
graphStatus GetInputConstData(const int32_t index, Tensor &data) const;
graphStatus GetInputIndexByName(const ge::AscendString &name, int32_t &index);
graphStatus GetInputIndexByName(const AscendString &name, int32_t &index);
graphStatus GetOutputIndexByName(const ge::AscendString &name, int32_t &index);
graphStatus GetOutputIndexByName(const AscendString &name, int32_t &index);
size_t GetInputsSize() const;
@ -74,47 +74,47 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GNode {
graphStatus UpdateOutputDesc(const int32_t index, const TensorDesc &tensor_desc);
graphStatus GetAttr(const ge::AscendString &name, int64_t &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, int32_t &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, uint32_t &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, float &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, ge::AscendString &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, bool &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, Tensor &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<int64_t> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<int32_t> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<uint32_t> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<float> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<ge::AscendString> &attr_values) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<bool> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<Tensor> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, OpBytes &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<std::vector<int64_t>> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, std::vector<ge::DataType> &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, ge::DataType &attr_value) const;
graphStatus GetAttr(const ge::AscendString &name, AttrValue &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, int64_t &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, int32_t &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, uint32_t &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, float &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, ge::AscendString &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, bool &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, Tensor &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<int64_t> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<int32_t> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<uint32_t> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<float> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<ge::AscendString> &attr_values) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<bool> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<Tensor> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, OpBytes &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<std::vector<int64_t>> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, std::vector<ge::DataType> &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, ge::DataType &attr_value) const;
graphStatus SetAttr(const ge::AscendString &name, AttrValue &attr_value) const;
bool HasAttr(const ge::AscendString &name);
graphStatus GetAttr(const AscendString &name, int64_t &attr_value) const;
graphStatus GetAttr(const AscendString &name, int32_t &attr_value) const;
graphStatus GetAttr(const AscendString &name, uint32_t &attr_value) const;
graphStatus GetAttr(const AscendString &name, float &attr_value) const;
graphStatus GetAttr(const AscendString &name, AscendString &attr_value) const;
graphStatus GetAttr(const AscendString &name, bool &attr_value) const;
graphStatus GetAttr(const AscendString &name, Tensor &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<int64_t> &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<int32_t> &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<uint32_t> &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<float> &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<AscendString> &attr_values) const;
graphStatus GetAttr(const AscendString &name, std::vector<bool> &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<Tensor> &attr_value) const;
graphStatus GetAttr(const AscendString &name, OpBytes &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<std::vector<int64_t>> &attr_value) const;
graphStatus GetAttr(const AscendString &name, std::vector<ge::DataType> &attr_value) const;
graphStatus GetAttr(const AscendString &name, ge::DataType &attr_value) const;
graphStatus GetAttr(const AscendString &name, AttrValue &attr_value) const;
graphStatus SetAttr(const AscendString &name, int64_t &attr_value) const;
graphStatus SetAttr(const AscendString &name, int32_t &attr_value) const;
graphStatus SetAttr(const AscendString &name, uint32_t &attr_value) const;
graphStatus SetAttr(const AscendString &name, float &attr_value) const;
graphStatus SetAttr(const AscendString &name, AscendString &attr_value) const;
graphStatus SetAttr(const AscendString &name, bool &attr_value) const;
graphStatus SetAttr(const AscendString &name, Tensor &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<int64_t> &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<int32_t> &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<uint32_t> &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<float> &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<AscendString> &attr_values) const;
graphStatus SetAttr(const AscendString &name, std::vector<bool> &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<Tensor> &attr_value) const;
graphStatus SetAttr(const AscendString &name, OpBytes &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<std::vector<int64_t>> &attr_value) const;
graphStatus SetAttr(const AscendString &name, std::vector<ge::DataType> &attr_value) const;
graphStatus SetAttr(const AscendString &name, ge::DataType &attr_value) const;
graphStatus SetAttr(const AscendString &name, AttrValue &attr_value) const;
bool HasAttr(const AscendString &name);
graphStatus GetSubgraph(uint32_t index, GraphPtr &graph) const;

@ -36,8 +36,11 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph {
friend class GraphUtils;
public:
ATTRIBUTED_DEPRECATED(Graph(const char *))
explicit Graph(const std::string &name);
explicit Graph(const char *name);
Graph() = default;
~Graph() = default;
@ -48,26 +51,47 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph {
Graph &SetOutputs(const std::vector<std::pair<Operator, std::vector<size_t>>> &output_indexs);
ATTRIBUTED_DEPRECATED(Graph &SetOutputs(const std::vector < std::pair < ge::Operator, AscendString) &)
Graph &SetOutputs(const std::vector<std::pair<ge::Operator, std::string>> &outputs);
Graph &SetOutputs(const std::vector<std::pair<ge::Operator, AscendString>> &outputs);
Graph &SetTargets(const std::vector<Operator> &targets);
bool IsValid() const;
graphStatus AddOp(const ge::Operator &op);
ATTRIBUTED_DEPRECATED(graphStatus FindOpByName(const char *, ge::Operator &))
graphStatus FindOpByName(const std::string &name, ge::Operator &op) const;
graphStatus FindOpByName(const char *name, ge::Operator &op) const;
ATTRIBUTED_DEPRECATED(graphStatus FindOpByType(const char *, std::vector<ge::Operator> &))
graphStatus FindOpByType(const std::string &type, std::vector<ge::Operator> &ops) const;
graphStatus FindOpByType(const char *type, std::vector<ge::Operator> &ops) const;
ATTRIBUTED_DEPRECATED(graphStatus GetAllOpName(std::vector<AscendString> &) const)
graphStatus GetAllOpName(std::vector<std::string> &op_name) const;
graphStatus GetAllOpName(std::vector<AscendString> &names) const;
ATTRIBUTED_DEPRECATED(graphStatus SaveToFile(const char *file_name) const)
graphStatus SaveToFile(const std::string &file_name) const;
graphStatus SaveToFile(const char *file_name) const;
ATTRIBUTED_DEPRECATED(graphStatus LoadFromFile(const char *))
graphStatus LoadFromFile(const std::string &file_name);
graphStatus LoadFromFile(const char *file_name);
ATTRIBUTED_DEPRECATED(graphStatus GetName(AscendString &) const)
const std::string &GetName() const;
graphStatus GetName(AscendString &name) const;
///
/// Set is need train iteration.
/// If set true, it means this graph need to be run iteration some
@ -90,7 +114,7 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph {
graphStatus AddControlEdge(GNode &src_node, GNode &dst_node);
static GraphPtr ConstructFromInputs(const std::vector<Operator> &inputs, const ge::AscendString &name);
static GraphPtr ConstructFromInputs(const std::vector<Operator> &inputs, const AscendString &name);
private:
GraphImplPtr impl_{nullptr};

@ -23,6 +23,7 @@
#include "./tensor.h"
#include "./types.h"
#include "ascend_string.h"
namespace ge {
class InferenceContext;
@ -63,8 +64,13 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY InferenceContext {
void SetOutputHandleShapesAndTypes(const std::vector<std::vector<ShapeAndType>> &shapes_and_types);
void SetOutputHandleShapesAndTypes(std::vector<std::vector<ShapeAndType>> &&shapes_and_types);
ATTRIBUTED_DEPRECATED(void SetMarks(const std::vector<AscendString> &))
void SetMarks(const std::vector<std::string> &marks);
void SetMarks(const std::vector<AscendString> &marks);
ATTRIBUTED_DEPRECATED(void GetMarks(std::vector<AscendString> &) const)
const std::vector<std::string> &GetMarks() const;
void GetMarks(std::vector<AscendString> &marks) const;
static std::unique_ptr<InferenceContext> Create();

File diff suppressed because it is too large Load Diff

@ -27,40 +27,58 @@
namespace ge {
using OpCreator = std::function<Operator(const std::string &)>;
using OpCreatorV2 = std::function<Operator(const AscendString &)>;
using InferShapeFunc = std::function<graphStatus(Operator &)>;
using InferFormatFunc = std::function<graphStatus(Operator &)>;
using VerifyFunc = std::function<graphStatus(Operator &)>;
class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY OperatorFactory {
public:
ATTRIBUTED_DEPRECATED(static Operator CreateOperator(const char *, const char *))
static Operator CreateOperator(const std::string &operator_name, const std::string &operator_type);
static Operator CreateOperator(const char *operator_name, const char *operator_type);
ATTRIBUTED_DEPRECATED(graphStatus GetOpsTypeList(std::vector<AscendString> &))
static graphStatus GetOpsTypeList(std::vector<std::string> &all_ops);
static graphStatus GetOpsTypeList(std::vector<AscendString> &all_ops);
ATTRIBUTED_DEPRECATED(bool IsExistOp(const char *))
static bool IsExistOp(const string &operator_type);
static bool IsExistOp(const char *operator_type);
};
class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY OperatorCreatorRegister {
public:
ATTRIBUTED_DEPRECATED(OperatorCreatorRegister(const char *, OpCreatorV2 const &))
OperatorCreatorRegister(const string &operator_type, OpCreator const &op_creator);
OperatorCreatorRegister(const char *operator_type, OpCreatorV2 const &op_creator);
~OperatorCreatorRegister() = default;
};
class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY InferShapeFuncRegister {
public:
ATTRIBUTED_DEPRECATED(InferShapeFuncRegister(const char *, const InferShapeFunc &))
InferShapeFuncRegister(const std::string &operator_type, const InferShapeFunc &infer_shape_func);
InferShapeFuncRegister(const char *operator_type, const InferShapeFunc &infer_shape_func);
~InferShapeFuncRegister() = default;
};
class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY InferFormatFuncRegister {
public:
ATTRIBUTED_DEPRECATED(InferFormatFuncRegister(const char *, const InferFormatFunc &))
InferFormatFuncRegister(const std::string &operator_type, const InferFormatFunc &infer_format_func);
InferFormatFuncRegister(const char *operator_type, const InferFormatFunc &infer_format_func);
~InferFormatFuncRegister() = default;
};
class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY VerifyFuncRegister {
public:
ATTRIBUTED_DEPRECATED(VerifyFuncRegister(const char *, const VerifyFunc &))
VerifyFuncRegister(const std::string &operator_type, const VerifyFunc &verify_func);
VerifyFuncRegister(const char *operator_type, const VerifyFunc &verify_func);
~VerifyFuncRegister() = default;
};
} // namespace ge

File diff suppressed because it is too large Load Diff

@ -25,6 +25,7 @@
#include "./ge_error_codes.h"
#include "./types.h"
#include "ascend_string.h"
namespace ge {
class ShapeImpl;
@ -81,8 +82,13 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY TensorDesc {
DataType GetDataType() const;
void SetDataType(DataType dt);
ATTRIBUTED_DEPRECATED(graphStatus GetName(AscendString &))
std::string GetName() const;
graphStatus GetName(AscendString &name);
ATTRIBUTED_DEPRECATED(void SetName(const char *))
void SetName(const std::string &name);
void SetName(const char *name);
// Attr acess
void SetSize(int64_t size);
@ -115,8 +121,12 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Tensor {
graphStatus SetData(std::vector<uint8_t> &&data);
graphStatus SetData(const std::vector<uint8_t> &data);
graphStatus SetData(const uint8_t *data, size_t size);
ATTRIBUTED_DEPRECATED(graphStatus SetData(const char *data))
graphStatus SetData(const std::string &data);
graphStatus SetData(const char *data);
ATTRIBUTED_DEPRECATED(graphStatus SetData(const std::vector<AscendString> &))
graphStatus SetData(const std::vector<std::string> &data);
graphStatus SetData(const std::vector<AscendString> &datas);
graphStatus IsValid();
Tensor Clone() const;

@ -76,7 +76,10 @@ struct DynamicInputOutputInfo {
Status AutoMappingByOpFn(const ge::Operator &op_src, ge::Operator &op);
Status AutoMappingByOpFnDynamic(const ge::Operator &op_src, ge::Operator &op,
const vector<DynamicInputOutputInfo> &dynamic_name_attr_value);
ATTRIBUTED_DEPRECATED(Status AutoMappingByOpFn(const ge::Operator &, ge::Operator &))
Status AutoMappingFn(const google::protobuf::Message *op_src, ge::Operator &op);
ATTRIBUTED_DEPRECATED(Status AutoMappingByOpFnDynamic(const ge::Operator &, ge::Operator &,
const vector<DynamicInputOutputInfo> &))
Status AutoMappingFnDynamic(const google::protobuf::Message *op_src, ge::Operator &op,
std::map<std::string, std::pair<std::string, std::string>> dynamic_name_attr_value,
int in_pos = -1, int out_pos = -1);
@ -95,19 +98,29 @@ using FusionParseParamFunc =
using FusionParseParamByOpFunc = std::function<domi::Status(const std::vector<ge::Operator> &, ge::Operator &)>;
using ParseSubgraphFunc = std::function<Status(const std::string &subgraph_name, const ge::Graph &graph)>;
using ParseOpToGraphFunc = std::function<Status(const ge::Operator &, ge::Graph &)>;
using ParseSubgraphFuncV2 = std::function<Status(const ge::AscendString &subgraph_name, const ge::Graph &graph)>;
class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistrationData {
public:
ATTRIBUTED_DEPRECATED(OpRegistrationData(const char *))
OpRegistrationData(const std::string &om_optype);
OpRegistrationData(const char *om_optype);
~OpRegistrationData();
OpRegistrationData &FrameworkType(const domi::FrameworkType &fmk_type);
ATTRIBUTED_DEPRECATED(OpRegistrationData &OriginOpType(const std::vector<ge::AscendString> &))
OpRegistrationData &OriginOpType(const std::initializer_list<std::string> &ori_optype_list);
OpRegistrationData &OriginOpType(const std::vector<ge::AscendString> &ori_op_type_list);
ATTRIBUTED_DEPRECATED(OpRegistrationData &OriginOpType(const char *))
OpRegistrationData &OriginOpType(const std::string &ori_optype);
OpRegistrationData &OriginOpType(const char *ori_op_type);
OpRegistrationData &ParseParamsFn(const ParseParamFunc &parseParamFn);
OpRegistrationData &ParseParamsByOperatorFn(const ParseParamByOpFunc &parse_param_by_op_fn);
@ -116,21 +129,34 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistrationData {
OpRegistrationData &FusionParseParamsFn(const FusionParseParamByOpFunc &fusion_parse_param_fn);
ATTRIBUTED_DEPRECATED(OpRegistrationData &ParseSubgraphPostFn(const ParseSubgraphFuncV2 &))
OpRegistrationData &ParseSubgraphPostFn(const ParseSubgraphFunc &subgraph_post_fn);
OpRegistrationData &ParseSubgraphPostFn(const ParseSubgraphFuncV2 &subgraph_post_fn);
OpRegistrationData &ImplyType(const domi::ImplyType &imply_type);
ATTRIBUTED_DEPRECATED(OpRegistrationData &DelInputWithCond(int, const char *, bool))
OpRegistrationData &DelInputWithCond(int inputIdx, const std::string &attrName, bool attrValue);
OpRegistrationData &DelInputWithCond(int input_idx, const char *attr_name, bool attr_value);
ATTRIBUTED_DEPRECATED(OpRegistrationData &DelInputWithOriginalType(int, const char *))
OpRegistrationData &DelInputWithOriginalType(int input_idx, const std::string &ori_type);
OpRegistrationData &DelInputWithOriginalType(int input_idx, const char *ori_type);
OpRegistrationData &InputReorderVector(const vector<int> &input_order);
OpRegistrationData &ParseOpToGraphFn(const ParseOpToGraphFunc &parse_op_to_graph_fn);
domi::ImplyType GetImplyType() const;
ATTRIBUTED_DEPRECATED(Status GetOmOptype(ge::AscendString &) const)
std::string GetOmOptype() const;
Status GetOmOptype(ge::AscendString &om_op_type) const;
ATTRIBUTED_DEPRECATED(GetOriginOpTypeSet(std::set<ge::AscendString> &) const)
std::set<std::string> GetOriginOpTypeSet() const;
Status GetOriginOpTypeSet(std::set<ge::AscendString> &ori_op_type) const;
domi::FrameworkType GetFrameworkType() const;
ParseParamFunc GetParseParamFn() const;
ParseParamByOpFunc GetParseParamByOperatorFn() const;
@ -138,6 +164,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistrationData {
FusionParseParamByOpFunc GetFusionParseParamByOpFn() const;
ParseSubgraphFunc GetParseSubgraphPostFn() const;
ParseOpToGraphFunc GetParseOpToGraphFn() const;
Status GetParseSubgraphPostFn(ParseSubgraphFuncV2 &func) const;
private:
std::shared_ptr<OpRegistrationDataImpl> impl_;

@ -28,7 +28,11 @@ namespace domi {
#else
#define FMK_FUNC_DEV_VISIBILITY
#endif
#ifdef __GNUC__
#define ATTRIBUTED_DEPRECATED(replacement) __attribute__((deprecated("Please use " #replacement " instead.")))
#else
#define ATTRIBUTED_DEPRECATED(replacement) __declspec(deprecated("Please use " #replacement " instead."))
#endif
/// CCE defined constant
///

@ -54,14 +54,25 @@ class ScopePassManager;
class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY Scope {
public:
Scope();
ATTRIBUTED_DEPRECATED(Status Init(const char *, const char *, Scope *))
Status Init(const std::string &name, const std::string &sub_type = "", Scope *father_scope = nullptr);
Status Init(const char *name, const char *sub_type, Scope *father_scope = nullptr);
~Scope();
ATTRIBUTED_DEPRECATED(Status Name(AscendString &) const)
const std::string &Name() const;
Status Name(AscendString &name) const;
ATTRIBUTED_DEPRECATED(Status SubType(AscendString &) const)
const std::string &SubType() const;
Status SubType(AscendString &sub_type) const;
ATTRIBUTED_DEPRECATED(Status AllNodesMap(std::unordered_map<AscendString, ge::OperatorPtr> &) const)
const std::unordered_map<std::string, ge::OperatorPtr> &AllNodesMap() const;
Status AllNodesMap(std::unordered_map<AscendString, ge::OperatorPtr> &node_map) const;
ATTRIBUTED_DEPRECATED(Scope *GetSubScope(const char *scope_name) const)
Scope *GetSubScope(const std::string &scope_name) const;
Scope *GetSubScope(const char *scope_name) const;
ATTRIBUTED_DEPRECATED(Status LastName(AscendString &) const)
const std::string LastName() const;
Status LastName(AscendString &name) const;
const std::vector<Scope *> &GetAllSubScopes() const;
const Scope *GetFatherScope() const;
@ -80,45 +91,85 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY FusionScopesResult {
FusionScopesResult();
Status Init();
~FusionScopesResult();
ATTRIBUTED_DEPRECATED(void SetName(const char *))
void SetName(const std::string &name);
void SetName(const char *name);
ATTRIBUTED_DEPRECATED(void SetType(const char *))
void SetType(const std::string &type);
void SetType(const char *type);
ATTRIBUTED_DEPRECATED(void SetDescription(const char *))
void SetDescription(const std::string &description);
void SetDescription(const char *description);
ATTRIBUTED_DEPRECATED(const Status Name(AscendString &) const)
const std::string &Name() const;
const Status Name(AscendString &name) const;
const std::vector<ge::OperatorPtr> &Nodes() const;
ATTRIBUTED_DEPRECATED(void InsertInputs(const char *, const std::vector<int32_t> &))
void InsertInputs(const std::string &inner_op_name, const std::vector<int32_t> &index_map);
void InsertInputs(const char *inner_op_name, const std::vector<int32_t> &index_map);
ATTRIBUTED_DEPRECATED(void InsertOutputs(const char *, const std::vector<int32_t> &))
void InsertOutputs(const std::string &inner_op_name, const std::vector<int32_t> &index_map);
void InsertOutputs(const char *inner_op_name, const std::vector<int32_t> &index_map);
class InnerNodeInfo {
public:
ATTRIBUTED_DEPRECATED(InnerNodeInfo(const char *))
explicit InnerNodeInfo(const std::string &fusion_node_name);
explicit InnerNodeInfo(const char *fusion_node_name);
ATTRIBUTED_DEPRECATED(InnerNodeInfo(const char *, const char *, const char *))
InnerNodeInfo(const std::string &fusion_node_name, const std::string &name, const std::string &type);
InnerNodeInfo(const char *fusion_node_name, const char *name, const char *type);
InnerNodeInfo(InnerNodeInfo &&other) noexcept;
InnerNodeInfo &operator=(InnerNodeInfo &&other) noexcept;
InnerNodeInfo(const InnerNodeInfo &) = delete;
InnerNodeInfo &operator=(const InnerNodeInfo &) = delete;
~InnerNodeInfo();
ATTRIBUTED_DEPRECATED(InnerNodeInfo &SetName(const char *))
InnerNodeInfo &SetName(const std::string &name);
InnerNodeInfo &SetName(const char *name);
ATTRIBUTED_DEPRECATED(InnerNodeInfo &SetType(const char *))
InnerNodeInfo &SetType(const std::string &type);
InnerNodeInfo &SetType(const char *type);
ATTRIBUTED_DEPRECATED(InnerNodeInfo &InsertInput(const char *, int32_t))
InnerNodeInfo &InsertInput(const std::string &input_node, int32_t peer_out_idx);
InnerNodeInfo &InsertInput(const char *input_node, int32_t peer_out_idx);
ATTRIBUTED_DEPRECATED(InnerNodeInfo &InsertOutput(const char *, int32_t))
InnerNodeInfo &InsertOutput(const std::string &output_node, int32_t peer_in_idx);
InnerNodeInfo &InsertOutput(const char *output_node, int32_t peer_in_idx);
ge::graphStatus BuildInnerNode();
ATTRIBUTED_DEPRECATED(ge::graphStatus SetInputFormat(const char *, const char *))
ge::graphStatus SetInputFormat(const std::string &input_name, const std::string &format);
ge::graphStatus SetInputFormat(const char *input_name, const char *format);
ATTRIBUTED_DEPRECATED(ge::graphStatus SetOutputFormat(const char *, const char *))
ge::graphStatus SetOutputFormat(const std::string &output_name, const std::string &format);
ge::graphStatus SetOutputFormat(const char *output_name, const char *format);
ATTRIBUTED_DEPRECATED(ge::graphStatus SetDynamicInputFormat(const char *, uint32_t index, const char *))
ge::graphStatus SetDynamicInputFormat(const std::string &input_name, uint32_t index, const std::string &format);
ge::graphStatus SetDynamicInputFormat(const char *input_name, uint32_t index, const char *format);
ATTRIBUTED_DEPRECATED(ge::graphStatus SetDynamicOutputFormat(const char *, uint32_t, const char *))
ge::graphStatus SetDynamicOutputFormat(const std::string &output_name, uint32_t index, const std::string &format);
ge::graphStatus SetDynamicOutputFormat(const char *output_name, uint32_t index, const char *format);
ge::Operator *MutableOperator();
ATTRIBUTED_DEPRECATED(ge::graphStatus GetName(AscendString &) const)
std::string GetName() const;
ge::graphStatus GetName(AscendString &name) const;
ATTRIBUTED_DEPRECATED(ge::graphStatus GetType(AscendString &) const)
std::string GetType() const;
ge::graphStatus GetType(AscendString &type) const;
ATTRIBUTED_DEPRECATED(ge::graphStatus GetInputs(std::vector<std::pair<AscendString, int32_t>> &) const)
std::vector<std::pair<std::string, int32_t>> GetInputs() const;
ge::graphStatus GetInputs(std::vector<std::pair<AscendString, int32_t>> &inputs) const;
ATTRIBUTED_DEPRECATED(ge::graphStatus GetOutputs(std::vector<std::pair<AscendString, int32_t>> &) const)
std::vector<std::pair<std::string, int32_t>> GetOutputs() const;
ge::graphStatus GetOutputs(std::vector<std::pair<AscendString, int32_t>> &outputs) const;
private:
class InnerNodeInfoImpl;
std::unique_ptr<InnerNodeInfoImpl> impl_;
};
ATTRIBUTED_DEPRECATED(InnerNodeInfo *AddInnerNode(const char *, const char *))
InnerNodeInfo *AddInnerNode(const std::string &name, const std::string &type);
InnerNodeInfo *AddInnerNode(const char *name, const char *type);
InnerNodeInfo *MutableRecentInnerNode();
InnerNodeInfo *MutableInnerNode(uint32_t index);
ge::graphStatus CheckInnerNodesInfo();
@ -157,7 +208,9 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeGraph {
~ScopeGraph();
const ScopeTree *GetScopeTree() const;
ATTRIBUTED_DEPRECATED(Status GetNodesMap(std::unordered_map<AscendString, ge::OperatorPtr> &) const)
const std::unordered_map<std::string, ge::OperatorPtr> &GetNodesMap() const;
Status GetNodesMap(std::unordered_map<AscendString, ge::OperatorPtr> &nodes_map) const;
private:
class ScopeGraphImpl;
@ -176,7 +229,9 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeAttrValue {
void SetIntValue(int64_t value);
void SetFloatValue(float value);
ATTRIBUTED_DEPRECATED(void SetStringValue(const char *))
void SetStringValue(std::string value);
void SetStringValue(const char *value);
void SetBoolValue(bool value);
private:
@ -193,7 +248,9 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeBaseFeature {
class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY NodeOpTypeFeature : ScopeBaseFeature {
public:
ATTRIBUTED_DEPRECATED(NodeOpTypeFeature(const char *, int, int))
NodeOpTypeFeature(std::string nodeType, int num, int step = 0);
NodeOpTypeFeature(const char *node_type, int num, int step = 0);
NodeOpTypeFeature(NodeOpTypeFeature const &feature);
NodeOpTypeFeature &operator=(NodeOpTypeFeature const &feature);
~NodeOpTypeFeature();
@ -206,7 +263,9 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY NodeOpTypeFeature : ScopeBa
class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY NodeAttrFeature : ScopeBaseFeature {
public:
ATTRIBUTED_DEPRECATED(NodeAttrFeature(const char *, const char *, ge::DataType, ScopeAttrValue &))
NodeAttrFeature(std::string nodeType, std::string attr_name, ge::DataType datatype, ScopeAttrValue &attr_value);
NodeAttrFeature(const char *node_type, const char *attr_name, ge::DataType datatype, ScopeAttrValue &attr_value);
NodeAttrFeature(NodeAttrFeature const &feature);
NodeAttrFeature &operator=(NodeAttrFeature const &feature);
~NodeAttrFeature();
@ -219,8 +278,10 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY NodeAttrFeature : ScopeBase
class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeFeature : ScopeBaseFeature {
public:
ATTRIBUTED_DEPRECATED(ScopeFeature(const char *, int32_t, const char *, const char *, int))
ScopeFeature(std::string sub_type, int32_t num, std::string suffix = "", std::string sub_scope_mask = "",
int step = 0);
ScopeFeature(const char *sub_type, int32_t num, const char *suffix, const char *sub_scope_mask, int step = 0);
ScopeFeature(ScopeFeature const &feature);
ScopeFeature &operator=(ScopeFeature const &feature);
~ScopeFeature();
@ -235,8 +296,9 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopePattern {
public:
ScopePattern();
~ScopePattern();
ATTRIBUTED_DEPRECATED(ScopePattern &SetSubType(const char *))
ScopePattern &SetSubType(const std::string &sub_type);
ScopePattern &SetSubType(const char *sub_type);
ScopePattern &AddNodeOpTypeFeature(NodeOpTypeFeature feature);
ScopePattern &AddNodeAttrFeature(NodeAttrFeature feature);
ScopePattern &AddScopeFeature(ScopeFeature feature);
@ -296,8 +358,11 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeFusionPassRegistry {
return instance;
}
ATTRIBUTED_DEPRECATED(void RegisterScopeFusionPass(const char *, CreateFn, bool))
void RegisterScopeFusionPass(const std::string &pass_name, CreateFn create_fn, bool is_general);
void RegisterScopeFusionPass(const char *pass_name, CreateFn create_fn, bool is_general);
private:
ScopeFusionPassRegistry();
class ScopeFusionPassRegistryImpl;
@ -307,7 +372,9 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeFusionPassRegistry {
class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeUtil {
public:
ATTRIBUTED_DEPRECATED(static AscendString StringReplaceAll(const char *, const char *, const char *))
static std::string StringReplaceAll(std::string str, const std::string &old_value, const std::string &new_value);
static AscendString StringReplaceAll(const char *str, const char *old_value, const char *new_value);
static void FreeScopePatterns(ScopeFusionPatterns &patterns);
static void FreeOneBatchPattern(std::vector<ScopePattern *> &one_batch_pattern);
};

@ -18,24 +18,39 @@
#define INC_FRAMEWORK_COMMON_DEBUG_GE_LOG_H_
#include <cstdint>
#include <unistd.h>
#include <sys/syscall.h>
#include "framework/common/ge_inner_error_codes.h"
#include "toolchain/slog.h"
#ifdef __GNUC__
#include <unistd.h>
#include <sys/syscall.h>
#else
#include "mmpa/mmpa_api.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define GE_MODULE_NAME static_cast<int>(GE)
// trace status of log
enum TraceStatus { TRACE_INIT = 0, TRACE_RUNNING, TRACE_WAITING, TRACE_STOP };
#define GELOGE(ERROR_CODE, ...) GE_LOG_ERROR(GE_MODULE_NAME, ERROR_CODE, __VA_ARGS__)
#define GELOGW(...) GE_LOG_WARN(GE_MODULE_NAME, __VA_ARGS__)
#define GELOGI(...) GE_LOG_INFO(GE_MODULE_NAME, __VA_ARGS__)
#define GELOGD(...) GE_LOG_DEBUG(GE_MODULE_NAME, __VA_ARGS__)
#define GEEVENT(...) GE_LOG_EVENT(GE_MODULE_NAME, __VA_ARGS__)
#define GELOGO(...) GE_LOG_OPLOG(GE_MODULE_NAME, __VA_ARGS__)
#define GELOGT(VALUE, ...) GE_LOG_TRACE(GE_MODULE_NAME, VALUE, __VA_ARGS__)
class GeLog {
public:
#ifdef __GNUC__
static pid_t GetTid() {
thread_local static pid_t tid = syscall(__NR_gettid);
return tid;
}
#else
static int GetTid() {
thread_local static int tid = static_cast<int>(GetCurrentThreadId());
return tid;
}
#endif
};
inline bool IsLogEnable(int module_name, int log_level) {
int32_t enable = CheckLogLevel(module_name, log_level);
@ -46,33 +61,57 @@ inline bool IsLogEnable(int module_name, int log_level) {
return false;
}
inline pid_t GetTid() {
thread_local static pid_t tid = syscall(__NR_gettid);
return tid;
}
#define GELOGE(ERROR_CODE, fmt, ...) \
dlog_error(GE_MODULE_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \
((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__)
#define GELOGW(fmt, ...) \
if (IsLogEnable(GE_MODULE_NAME, DLOG_WARN)) \
dlog_warn(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GELOGI(fmt, ...) \
if (IsLogEnable(GE_MODULE_NAME, DLOG_INFO)) \
dlog_info(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GELOGD(fmt, ...) \
if (IsLogEnable(GE_MODULE_NAME, DLOG_DEBUG)) \
dlog_debug(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GEEVENT(fmt, ...) dlog_event(GE_MODULE_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GELOGO(fmt, ...) Dlog(GE_MODULE_NAME, DLOG_OPLOG, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GELOGT(VALUE, fmt, ...) \
do { \
TraceStatus stat = VALUE; \
const char *const TraceStatStr[] = {"INIT", "RUNNING", "WAITING", "STOP"}; \
int idx = static_cast<int>(stat); \
char *k = const_cast<char *>("status"); \
char *v = const_cast<char *>(TraceStatStr[idx]); \
KeyValue kv = {k, v}; \
DlogWithKV(static_cast<int>(GE_MODULE_NAME), DLOG_TRACE, &kv, 1, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, \
##__VA_ARGS__); \
} while (0)
#define GE_LOG_ERROR(MOD_NAME, ERROR_CODE, fmt, ...) \
dlog_error(MOD_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GetTid(), __FUNCTION__, ERROR_CODE, \
#define GE_LOG_ERROR(MOD_NAME, ERROR_CODE, fmt, ...) \
dlog_error(MOD_NAME, "%lu %s: ErrorNo: %d(%s) " fmt, GeLog::GetTid(), __FUNCTION__, ERROR_CODE, \
((GE_GET_ERRORNO_STR(ERROR_CODE)).c_str()), ##__VA_ARGS__)
#define GE_LOG_WARN(MOD_NAME, fmt, ...) \
if (IsLogEnable(MOD_NAME, DLOG_WARN)) dlog_warn(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__)
if (IsLogEnable(MOD_NAME, DLOG_WARN)) dlog_warn(MOD_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GE_LOG_INFO(MOD_NAME, fmt, ...) \
if (IsLogEnable(MOD_NAME, DLOG_INFO)) dlog_info(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__)
if (IsLogEnable(MOD_NAME, DLOG_INFO)) dlog_info(MOD_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GE_LOG_DEBUG(MOD_NAME, fmt, ...) \
if (IsLogEnable(MOD_NAME, DLOG_DEBUG)) dlog_debug(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GE_LOG_EVENT(MOD_NAME, fmt, ...) dlog_event(MOD_NAME, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__)
if (IsLogEnable(MOD_NAME, DLOG_DEBUG)) \
dlog_debug(MOD_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GE_LOG_EVENT(MOD_NAME, fmt, ...) \
dlog_event(MOD_NAME, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GE_LOG_OPLOG(MOD_NAME, fmt, ...) \
Dlog(MOD_NAME, DLOG_OPLOG, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__)
Dlog(MOD_NAME, DLOG_OPLOG, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, ##__VA_ARGS__)
#define GE_LOG_TRACE(MOD_NAME, value, fmt, ...) \
do { \
TraceStatus stat = value; \
const char *const TraceStatStr[] = {"INIT", "RUNNING", "WAITING", "STOP"}; \
int idx = static_cast<int>(stat); \
char *k = const_cast<char *>("status"); \
char *v = const_cast<char *>(TraceStatStr[idx]); \
KeyValue kv = {k, v}; \
DlogWithKV(static_cast<int>(MOD_NAME), DLOG_TRACE, &kv, 1, "%lu %s:" fmt, GetTid(), __FUNCTION__, ##__VA_ARGS__); \
#define GE_LOG_TRACE(MOD_NAME, value, fmt, ...) \
do { \
TraceStatus stat = value; \
const char *const TraceStatStr[] = {"INIT", "RUNNING", "WAITING", "STOP"}; \
int idx = static_cast<int>(stat); \
char *k = const_cast<char *>("status"); \
char *v = const_cast<char *>(TraceStatStr[idx]); \
KeyValue kv = {k, v}; \
DlogWithKV(static_cast<int>(MOD_NAME), DLOG_TRACE, &kv, 1, "%lu %s:" fmt, GeLog::GetTid(), __FUNCTION__, \
##__VA_ARGS__); \
} while (0)
// print memory when it is greater than 1KB.
@ -82,4 +121,7 @@ inline pid_t GetTid() {
GELOGI("MallocMemory, func=%s, size=%zu, purpose=%s", (#FUNC), static_cast<size_t>(SIZE), (PURPOSE)); \
} \
} while (0);
#ifdef __cplusplus
}
#endif
#endif // INC_FRAMEWORK_COMMON_DEBUG_GE_LOG_H_

@ -0,0 +1,32 @@
/**
* 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_COMMON_GE_COMPILER_OPTIONS_H_
#define INC_FRAMEWORK_COMMON_GE_COMPILER_OPTIONS_H_
namespace ge {
#ifdef __GNUC__
#define GE_ATTRIBUTE_UNUSED __attribute__((unused))
#define GE_FUNCTION_IDENTIFIER __PRETTY_FUNCTION__
#define GE_BUILTIN_PREFETCH(args_addr) __builtin_prefetch(args_addr)
#else
#define GE_ATTRIBUTE_UNUSED
#define GE_FUNCTION_IDENTIFIER __FUNCSIG__
#define GE_BUILTIN_PREFETCH(args_addr)
#endif
} // namespace ge
#endif // INC_FRAMEWORK_COMMON_GE_COMPILER_OPTIONS_H_

@ -105,6 +105,7 @@ struct ShapeDescription {
int64_t height = 0;
int64_t width = 0;
std::vector<int64_t> dims;
std::vector<std::pair<int64_t, int64_t>> shape_ranges;
};
// Definition of input and output description information

@ -17,6 +17,7 @@
#ifndef INC_FRAMEWORK_COMMON_STRING_UTIL_H_
#define INC_FRAMEWORK_COMMON_STRING_UTIL_H_
#include <cctype>
#include <securec.h>
#include <algorithm>

@ -18,7 +18,6 @@
#define INC_FRAMEWORK_COMMON_TYPES_H_
#include <limits.h>
#include <linux/limits.h>
#include <stdint.h>
#include <algorithm>
#include <map>
@ -526,7 +525,10 @@ REGISTER_OPTYPE_DECLARE(HVDCALLBACKALLGATHER, "HorovodAllgather");
REGISTER_OPTYPE_DECLARE(HVDCALLBACKBROADCAST, "HorovodBroadcast");
REGISTER_OPTYPE_DECLARE(HVDWAIT, "HorovodWait");
enum InputMode { INPUT = 0, CONST };
// aicpu op for online_infer dynamic_dims
REGISTER_OPTYPE_DECLARE(GETDYNAMICDIMS, "GetDynamicDims");
enum InputMode { INPUT = 0, CONST_INPUT };
// Definition of the processing status enum of the process module
enum ModelProcessState {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save