Update GraphEngine to synchronize with latest Ascend driver software suite 17 May 2020

pull/28/head
yanghaoran 5 years ago
parent 2d259d7de7
commit 828eb02503

@ -42,12 +42,12 @@ include(${GE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/gtest.cmake) include(${GE_SOURCE_DIR}/cmake/external_libs/gtest.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake) include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/onnx.cmake) include(${GE_SOURCE_DIR}/cmake/external_libs/onnx.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/securec.cmake)
set(CMAKE_SKIP_RPATH TRUE) set(CMAKE_SKIP_RPATH TRUE)
# for CPU/GPU mode, find c_sec and slog from local prebuild # for CPU/GPU mode, find c_sec and slog from local prebuild
if(NOT ENABLE_D AND NOT GE_ONLY) if(NOT ENABLE_D AND NOT GE_ONLY)
set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR}) set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR})
find_library(c_sec libc_sec.so ${GE_PREBUILD_PATH})
find_library(slog libslog.so ${GE_PREBUILD_PATH}) find_library(slog libslog.so ${GE_PREBUILD_PATH})
# if D_LINK_PATH is set in environment variables, search libraries in given path # if D_LINK_PATH is set in environment variables, search libraries in given path
elseif(DEFINED ENV{D_LINK_PATH}) elseif(DEFINED ENV{D_LINK_PATH})
@ -64,6 +64,7 @@ elseif(DEFINED ENV{D_LINK_PATH})
message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated") message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
endif() endif()
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH}) set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
find_library(c_sec libc_sec.so ${GE_LIB_PATH})
find_library(slog libslog.so ${GE_LIB_PATH}) find_library(slog libslog.so ${GE_LIB_PATH})
find_library(mmpa libmmpa.so ${GE_LIB_PATH}) find_library(mmpa libmmpa.so ${GE_LIB_PATH})
find_library(runtime libruntime.so ${GE_LIB_PATH}) find_library(runtime libruntime.so ${GE_LIB_PATH})
@ -80,6 +81,7 @@ else()
endif() endif()
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common) set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64) set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
find_library(c_sec libc_sec.so ${ASCEND_DRIVER_DIR})
find_library(slog libslog.so ${ASCEND_DRIVER_DIR}) find_library(slog libslog.so ${ASCEND_DRIVER_DIR})
find_library(mmpa libmmpa.so ${ASCEND_DRIVER_DIR}) find_library(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_library(msprof libmsprof.so ${ASCEND_DRIVER_DIR}) find_library(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
@ -128,7 +130,7 @@ elseif(GE_ONLY)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/plugin/engine) add_subdirectory(${GE_SOURCE_DIR}/src/ge/plugin/engine)
endif() endif()
if (ENABLE_GE_COV OR ENABLE_GE_UT OR ENABLE_GE_ST) # if (ENABLE_GE_COV OR ENABLE_GE_UT OR ENABLE_GE_ST)
add_subdirectory(tests) # add_subdirectory(tests)
endif() # endif()

@ -41,7 +41,7 @@ checkopts()
{ {
VERBOSE="" VERBOSE=""
THREAD_NUM=8 THREAD_NUM=8
ENABLE_GE_UT_ONLY_COMPILE="off" # ENABLE_GE_UT_ONLY_COMPILE="off"
ENABLE_GE_UT="off" ENABLE_GE_UT="off"
ENABLE_GE_ST="off" ENABLE_GE_ST="off"
ENABLE_GE_COV="off" ENABLE_GE_COV="off"
@ -52,7 +52,7 @@ checkopts()
OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]') OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')
case "${opt}" in case "${opt}" in
u) u)
ENABLE_GE_UT_ONLY_COMPILE="on" # ENABLE_GE_UT_ONLY_COMPILE="on"
ENABLE_GE_UT="on" ENABLE_GE_UT="on"
GE_ONLY="off" GE_ONLY="off"
;; ;;
@ -137,39 +137,39 @@ find ${OUTPUT_PATH} -name "*.so*" -print0 | xargs -0 chmod 500
echo "---------------- GraphEngine output generated ----------------" echo "---------------- GraphEngine output generated ----------------"
if [[ "X$ENABLE_GE_ST" = "Xon" ]]; then # if [[ "X$ENABLE_GE_ST" = "Xon" ]]; then
cp ${BUILD_PATH}/graphengine/tests/st/st_resnet50_train ${OUTPUT_PATH} # cp ${BUILD_PATH}/graphengine/tests/st/st_resnet50_train ${OUTPUT_PATH}
fi # fi
if [[ "X$ENABLE_GE_UT" = "Xon" || "X$ENABLE_GE_COV" = "Xon" ]]; then # if [[ "X$ENABLE_GE_UT" = "Xon" || "X$ENABLE_GE_COV" = "Xon" ]]; then
cp ${BUILD_PATH}/graphengine/tests/ut/common/graph/ut_libgraph ${OUTPUT_PATH} # cp ${BUILD_PATH}/graphengine/tests/ut/common/graph/ut_libgraph ${OUTPUT_PATH}
cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_multiparts_utest ${OUTPUT_PATH} # cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_multiparts_utest ${OUTPUT_PATH}
cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_distinct_load_utest ${OUTPUT_PATH} # cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_distinct_load_utest ${OUTPUT_PATH}
cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_others_utest ${OUTPUT_PATH} # cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_others_utest ${OUTPUT_PATH}
cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_kernel_utest ${OUTPUT_PATH} # cp ${BUILD_PATH}/graphengine/tests/ut/ge/ut_libge_kernel_utest ${OUTPUT_PATH}
if [[ "X${ENABLE_GE_UT_ONLY_COMPILE}" != "Xon" ]]; then # if [[ "X${ENABLE_GE_UT_ONLY_COMPILE}" != "Xon" ]]; then
export LD_LIBRARY_PATH=${D_LINK_PATH}/x86_64/:${BUILD_PATH}../third_party/prebuild/x86_64/:${BUILD_PATH}/graphengine/:/usr/local/HiAI/driver/lib64:/usr/local/HiAI/runtime/lib64:${LD_LIBRARY_PATH} # export LD_LIBRARY_PATH=${D_LINK_PATH}/x86_64/:${BUILD_PATH}../third_party/prebuild/x86_64/:${BUILD_PATH}/graphengine/:/usr/local/HiAI/driver/lib64:/usr/local/HiAI/runtime/lib64:${LD_LIBRARY_PATH}
echo ${LD_LIBRARY_PATH} # echo ${LD_LIBRARY_PATH}
${OUTPUT_PATH}/ut_libgraph && # ${OUTPUT_PATH}/ut_libgraph &&
${OUTPUT_PATH}/ut_libge_multiparts_utest && # ${OUTPUT_PATH}/ut_libge_multiparts_utest &&
${OUTPUT_PATH}/ut_libge_distinct_load_utest && # ${OUTPUT_PATH}/ut_libge_distinct_load_utest &&
${OUTPUT_PATH}/ut_libge_others_utest && # ${OUTPUT_PATH}/ut_libge_others_utest &&
${OUTPUT_PATH}/ut_libge_kernel_utest # ${OUTPUT_PATH}/ut_libge_kernel_utest
if [[ "$?" -ne 0 ]]; then # if [[ "$?" -ne 0 ]]; then
echo "!!! UT FAILED, PLEASE CHECK YOUR CHANGES !!!" # echo "!!! UT FAILED, PLEASE CHECK YOUR CHANGES !!!"
exit 1; # exit 1;
fi # fi
fi # fi
if [[ "X$ENABLE_GE_COV" = "Xon" ]]; then # if [[ "X$ENABLE_GE_COV" = "Xon" ]]; then
echo "Generating coverage statistics, please wait..." # echo "Generating coverage statistics, please wait..."
cd ${BASEPATH} # cd ${BASEPATH}
rm -rf ${BASEPATH}/cov # rm -rf ${BASEPATH}/cov
mkdir ${BASEPATH}/cov # mkdir ${BASEPATH}/cov
gcovr -r ./ --exclude 'third_party' --exclude 'build' --exclude 'tests' --exclude 'prebuild' --exclude 'inc' --print-summary --html --html-details -d -o cov/index.html # gcovr -r ./ --exclude 'third_party' --exclude 'build' --exclude 'tests' --exclude 'prebuild' --exclude 'inc' --print-summary --html --html-details -d -o cov/index.html
fi # fi
fi # fi
# generate output package in tar form, including ut/st libraries/executables # generate output package in tar form, including ut/st libraries/executables
cd ${BASEPATH} cd ${BASEPATH}

@ -1,11 +0,0 @@
graphengine_add_pkg(securec
VER 1.1.10
URL https://gitee.com/openeuler/bounds_checking_function/repository/archive/v1.1.10.tar.gz
MD5 0782dd2351fde6920d31a599b23d8c91
LIBS c_sec
PATCHES ${GE_SOURCE_DIR}/third_party/patch/securec/securec.patch001
CMAKE_OPTION " "
)
include_directories(${securec_INC})
file(COPY ${securec_INC}/../lib/libc_sec.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)
add_library(graphengine::securec ALIAS securec::c_sec)

@ -1,36 +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 COMPRESS_H
#define COMPRESS_H
#include <uchar.h>
enum CmpStatus { RET_SUCCESS = 0, RET_ERROR = -1 };
struct CompressConfig {
size_t inputSize; // length of data to compress
size_t engineNum; // how many decompress engines
size_t maxRatio; // how much size of a basic compression block, only 64 supported now (8x: 64 4x: 32)
size_t channel; // channels of L2 or DDR. For load balance
size_t fractalSize; // size of compressing block
bool isTight; // whether compose compressed data tightly
};
CmpStatus CompressWeights(char* input, const CompressConfig& compressConfig, char* indexs, char* output,
size_t& compressedLength);
#endif // COMPRESS_H

@ -40,8 +40,6 @@ const char *const OPTION_EXEC_EXTERN_PLUGIN_PATH = "ge.soLoadPath";
const char *const OPTION_EXEC_ENABLE_DUMP = "ge.exec.enableDump"; const char *const OPTION_EXEC_ENABLE_DUMP = "ge.exec.enableDump";
const char *const OPTION_EXEC_DUMP_PATH = "ge.exec.dumpPath"; const char *const OPTION_EXEC_DUMP_PATH = "ge.exec.dumpPath";
const char *const OPTION_EXEC_DUMP_STEP = "ge.exec.dumpStep"; const char *const OPTION_EXEC_DUMP_STEP = "ge.exec.dumpStep";
const char *const OPTION_EXEC_ENABLE_INCRE_BUILD = "ge.exec.enableIncreBuild";
const char *const OPTION_EXEC_INCRE_BUILD_CACHE_PATH = "ge.exec.increBuildCachePath";
// Hccl flag, if ge.exec.hcclFlag =1, it means load plugin for opskernel, else:ge.exec.hcclFlag =0 // Hccl flag, if ge.exec.hcclFlag =1, it means load plugin for opskernel, else:ge.exec.hcclFlag =0
const char *const OPTION_EXEC_HCCL_FLAG = "ge.exec.hcclFlag"; const char *const OPTION_EXEC_HCCL_FLAG = "ge.exec.hcclFlag";
const char *const OPTION_EXEC_ATOMIC_FLAG = "ge.exec.enable_atomic"; const char *const OPTION_EXEC_ATOMIC_FLAG = "ge.exec.enable_atomic";

@ -69,7 +69,7 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY InferenceContext {
static std::unique_ptr<InferenceContext> Create(); static std::unique_ptr<InferenceContext> Create();
private: private:
explicit InferenceContext(std::unique_ptr<InferenceContextImpl> &impl); InferenceContext(std::unique_ptr<InferenceContextImpl> &impl);
std::shared_ptr<InferenceContextImpl> inference_context_impl_; std::shared_ptr<InferenceContextImpl> inference_context_impl_;
}; };
} // namespace ge } // namespace ge

@ -116,5 +116,27 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpReceiver {
namespace ge { namespace ge {
using OpRegistrationData = domi::OpRegistrationData; using OpRegistrationData = domi::OpRegistrationData;
using OpReceiver = domi::OpReceiver; using OpReceiver = domi::OpReceiver;
class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY HostCpuOp {
public:
HostCpuOp() = default;
virtual ~HostCpuOp() = default;
virtual graphStatus Compute(Operator &op, const std::map<std::string, const Tensor> &inputs,
std::map<std::string, Tensor> &outputs) = 0;
};
class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY HostCpuOpRegistrar {
public:
HostCpuOpRegistrar(const char *op_type, HostCpuOp *(*create_fn)());
};
#define REGISTER_HOST_CPU_OP_BUILDER(name, op) REGISTER_HOST_CPU_OP_BUILDER_UNIQ_HELPER(__COUNTER__, name, op)
#define REGISTER_HOST_CPU_OP_BUILDER_UNIQ_HELPER(ctr, name, op) REGISTER_HOST_CPU_OP_BUILDER_UNIQ(ctr, name, op)
#define REGISTER_HOST_CPU_OP_BUILDER_UNIQ(ctr, name, op) \
static ::ge::HostCpuOpRegistrar register_host_cpu_op##ctr __attribute__((unused)) = \
::ge::HostCpuOpRegistrar(name, []() -> ::ge::HostCpuOp * { return new (std::nothrow) op(); })
} // namespace ge } // namespace ge
#endif // INC_EXTERNAL_REGISTER_REGISTER_H_ #endif // INC_EXTERNAL_REGISTER_REGISTER_H_

@ -51,24 +51,24 @@ inline pid_t GetTid() {
return tid; return tid;
} }
#define GE_TIMESTAMP_START(stage) uint64_t startUsec_##stage = ge::GetCurrentTimestap() #define GE_TIMESTAMP_START(stage) uint64_t startUsec_##stage = domi::GetCurrentTimestap()
#define GE_TIMESTAMP_END(stage, stage_name) \ #define GE_TIMESTAMP_END(stage, stage_name) \
do { \ do { \
uint64_t endUsec_##stage = ge::GetCurrentTimestap(); \ uint64_t endUsec_##stage = domi::GetCurrentTimestap(); \
GEEVENT("[GEPERFTRACE] The time cost of %s is [%lu] micro second.", (stage_name), \ GEEVENT("[GEPERFTRACE] The time cost of %s is [%lu] micro second.", (stage_name), \
(endUsec_##stage - startUsec_##stage)); \ (endUsec_##stage - startUsec_##stage)); \
} while (0); } while (0);
#define GE_TIMESTAMP_CALLNUM_START(stage) \ #define GE_TIMESTAMP_CALLNUM_START(stage) \
uint64_t startUsec_##stage = ge::GetCurrentTimestap(); \ uint64_t startUsec_##stage = domi::GetCurrentTimestap(); \
uint64_t call_num_of##stage = 0; \ uint64_t call_num_of##stage = 0; \
uint64_t time_of##stage = 0 uint64_t time_of##stage = 0
#define GE_TIMESTAMP_RESTART(stage) (startUsec_##stage = ge::GetCurrentTimestap()) #define GE_TIMESTAMP_RESTART(stage) (startUsec_##stage = domi::GetCurrentTimestap())
#define GE_TIMESTAMP_ADD(stage) \ #define GE_TIMESTAMP_ADD(stage) \
time_of##stage += ge::GetCurrentTimestap() - startUsec_##stage; \ time_of##stage += domi::GetCurrentTimestap() - startUsec_##stage; \
call_num_of##stage++ call_num_of##stage++
#define GE_TIMESTAMP_CALLNUM_END(stage, stage_name) \ #define GE_TIMESTAMP_CALLNUM_END(stage, stage_name) \

@ -103,17 +103,17 @@ using cce::ccStatus_t;
} while (0); } while (0);
// If expr is not true, print the log and return the specified status // If expr is not true, print the log and return the specified status
#define GE_CHK_BOOL_RET_STATUS(expr, _status, ...) \ #define GE_CHK_BOOL_RET_STATUS(expr, _status, ...) \
do { \ do { \
bool b = (expr); \ bool b = (expr); \
if (!b) { \ if (!b) { \
std::string msg; \ std::string msg; \
(void)msg.append(ge::StringUtils::FormatString(__VA_ARGS__)); \ (void)msg.append(domi::StringUtils::FormatString(__VA_ARGS__)); \
(void)msg.append( \ (void)msg.append( \
ge::StringUtils::FormatString(" Error Code:0x%X(%s)", _status, GET_ERRORNO_STR(_status).c_str())); \ domi::StringUtils::FormatString(" Error Code:0x%X(%s)", _status, GET_ERRORNO_STR(_status).c_str())); \
DOMI_LOGE("%s", msg.c_str()); \ DOMI_LOGE("%s", msg.c_str()); \
return _status; \ return _status; \
} \ } \
} while (0); } while (0);
// If expr is not true, print the log and return the specified status // If expr is not true, print the log and return the specified status

@ -152,6 +152,7 @@ GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_RUN_GRAPH_INVALID, 11, "Get computeGraph by g
GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_INSERT_DYN_OP_FAILED, 12, "Graph which insert dynamic op failed."); // 1343242252 GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_INSERT_DYN_OP_FAILED, 12, "Graph which insert dynamic op failed."); // 1343242252
GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_PREPROCESS_FAILED, 13, "Graph preprocess failed."); // 1343242253 GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_PREPROCESS_FAILED, 13, "Graph preprocess failed."); // 1343242253
GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_GRAPH_FUSION_FAILED, 14, "Graph fusion failed."); // 1343242254 GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_GRAPH_FUSION_FAILED, 14, "Graph fusion failed."); // 1343242254
GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_TINY_CAL_CHECK_FAILED, 15, "Check tiny calibration failed."); // 1343242255
GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_CALIBRATION_FAILED, 16, "Calibration failed."); // 1343242256 GE_ERRORNO_GRAPH(GE_GRAPH_OPTIMIZE_CALIBRATION_FAILED, 16, "Calibration failed."); // 1343242256
GE_ERRORNO_GRAPH(GE_GRAPH_SUBGRAPH_NUM_ZERO, 17, "Graph partition success, but subGraph num is 0."); // 1343242257 GE_ERRORNO_GRAPH(GE_GRAPH_SUBGRAPH_NUM_ZERO, 17, "Graph partition success, but subGraph num is 0."); // 1343242257
GE_ERRORNO_GRAPH(GE_GRAPH_SUBGRAPH_ENGINENAME_REPEATED, 18, "Graph subGraph engine name is repeated."); // 1343242258 GE_ERRORNO_GRAPH(GE_GRAPH_SUBGRAPH_ENGINENAME_REPEATED, 18, "Graph subGraph engine name is repeated."); // 1343242258

@ -20,7 +20,7 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <string> #include <string>
namespace ge { namespace domi {
class GflagsUtils { class GflagsUtils {
public: public:
static bool IsSetCommandTrue(const char *name) { static bool IsSetCommandTrue(const char *name) {
@ -66,6 +66,6 @@ class GflagsUtils {
} }
} }
}; };
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_GFLAGS_UTIL_H_ #endif // INC_FRAMEWORK_COMMON_GFLAGS_UTIL_H_

@ -26,7 +26,7 @@
#include "graph/model.h" #include "graph/model.h"
#include "model/ge_model.h" #include "model/ge_model.h"
namespace ge { namespace domi {
class ModelHelper { class ModelHelper {
public: public:
ModelHelper() = default; ModelHelper() = default;
@ -65,8 +65,9 @@ class ModelHelper {
Status LoadTask(OmFileLoadHelper& om_load_helper); Status LoadTask(OmFileLoadHelper& om_load_helper);
Status LoadTBEKernelStore(OmFileLoadHelper& om_load_helper); Status LoadTBEKernelStore(OmFileLoadHelper& om_load_helper);
Status ReleaseLocalModelData() noexcept; Status ReleaseLocalModelData() noexcept;
Status SaveModelPartition(std::shared_ptr<OmFileSaveHelper>& om_file_save_helper, ModelPartitionType type, Status SaveModelPartition(std::shared_ptr<OmFileSaveHelper>& om_file_save_helper, ModelPartitionType type,
const uint8_t* data, size_t size); const uint8_t* data, size_t size);
}; };
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_HELPER_MODEL_HELPER_H_ #endif // INC_FRAMEWORK_COMMON_HELPER_MODEL_HELPER_H_

@ -26,10 +26,8 @@
#include "framework/common/ge_types.h" #include "framework/common/ge_types.h"
using ProcParam = struct PROC_PARAM; using ProcParam = struct PROC_PARAM;
using std::string;
using std::vector;
namespace ge { namespace domi {
struct ModelPartition { struct ModelPartition {
ModelPartitionType type; ModelPartitionType type;
uint8_t *data = 0; uint8_t *data = 0;
@ -90,5 +88,5 @@ class OmFileSaveHelper {
ModelFileHeader model_header_; ModelFileHeader model_header_;
OmFileContext context_; OmFileContext context_;
}; };
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_HELPER_OM_FILE_HELPER_H_ #endif // INC_FRAMEWORK_COMMON_HELPER_OM_FILE_HELPER_H_

@ -30,7 +30,7 @@
using std::vector; using std::vector;
namespace ge { namespace domi {
// Size of RC memory alignment, 2M // Size of RC memory alignment, 2M
constexpr size_t ALIGN_SIZE = 2097152; constexpr size_t ALIGN_SIZE = 2097152;
@ -118,6 +118,6 @@ class L2CacheOptimize {
bool Cross(const RCMemoryBlock &l_block, const RCMemoryBlock &r_block); bool Cross(const RCMemoryBlock &l_block, const RCMemoryBlock &r_block);
bool Connect(const RCMemoryBlock &l_block, const RCMemoryBlock &r_block); bool Connect(const RCMemoryBlock &l_block, const RCMemoryBlock &r_block);
}; };
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_L2_CACHE_OPTIMIZE_H_ #endif // INC_FRAMEWORK_COMMON_L2_CACHE_OPTIMIZE_H_

@ -21,17 +21,11 @@
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include "common/op/attr_define.h"
#include "common/types.h" #include "common/types.h"
#include "graph/debug/ge_attr_define.h"
#include "proto/om.pb.h" #include "proto/om.pb.h"
using domi::AttrDef; namespace domi {
using domi::AttrDef_ListValue;
using domi::ModelDef;
using domi::NamedAttrs;
using domi::OpDef;
namespace ge {
using AttrDefMap = ::google::protobuf::Map<::std::string, ::domi::AttrDef>; using AttrDefMap = ::google::protobuf::Map<::std::string, ::domi::AttrDef>;
using AttrDefPair = ::google::protobuf::MapPair<std::string, domi::AttrDef>; using AttrDefPair = ::google::protobuf::MapPair<std::string, domi::AttrDef>;
@ -156,6 +150,6 @@ bool GetAttrDefListValue(const std::string &key, int idx, int32_t *value, const
bool GetAttrDefListValue(const std::string &key, int idx, uint32_t *value, const AttrDefMap &attr); bool GetAttrDefListValue(const std::string &key, int idx, uint32_t *value, const AttrDefMap &attr);
bool GetAttrDefListValue(const std::string &key, int idx, float *value, const AttrDefMap &attr); bool GetAttrDefListValue(const std::string &key, int idx, float *value, const AttrDefMap &attr);
bool GetAttrDefListValue(const std::string &key, int idx, double *value, const AttrDefMap &attr); bool GetAttrDefListValue(const std::string &key, int idx, double *value, const AttrDefMap &attr);
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_OP_ATTR_VALUE_UTIL_H_ #endif // INC_FRAMEWORK_COMMON_OP_ATTR_VALUE_UTIL_H_

@ -62,8 +62,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_LIMIT
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_DELTA_INPUT; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_DELTA_INPUT;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_DATA_INPUT; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t FOR_DATA_INPUT;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const int NORMAL_TENSOR_SIZE;
class OpUtils { class OpUtils {
public: public:
/// ///

@ -22,7 +22,7 @@
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
namespace ge { namespace domi {
// general // general
const float DEFAULT_ALPHA_VALUE = 1.0; const float DEFAULT_ALPHA_VALUE = 1.0;
const float DEFAULT_BETA_VALUE = 0.0; const float DEFAULT_BETA_VALUE = 0.0;
@ -421,5 +421,5 @@ const uint32_t MULTI_SHAPE_INPUT_NUM = 2;
// Shufflechannel // Shufflechannel
const uint32_t SHUFFLECHANNEL_DEFAULT_GROUP = 1; const uint32_t SHUFFLECHANNEL_DEFAULT_GROUP = 1;
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_OP_OP_PARSER_UTIL_H_ #endif // INC_FRAMEWORK_COMMON_OP_OP_PARSER_UTIL_H_

@ -20,7 +20,7 @@
#include <set> #include <set>
#include <string> #include <string>
namespace ge { namespace domi {
class OpTypeContainer { class OpTypeContainer {
public: public:
static OpTypeContainer *Instance() { static OpTypeContainer *Instance() {
@ -57,6 +57,6 @@ class OpTypeRegistrar {
const OpTypeRegistrar g_##var_name##_reg(str_name); const OpTypeRegistrar g_##var_name##_reg(str_name);
#define IS_OPTYPE_EXISTING(str_name) (OpTypeContainer::Instance()->IsExisting(str_name)) #define IS_OPTYPE_EXISTING(str_name) (OpTypeContainer::Instance()->IsExisting(str_name))
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_OP_TYPES_H_ #endif // INC_FRAMEWORK_COMMON_OP_TYPES_H_

@ -25,10 +25,10 @@
/// MAKE_GUARD([&] { Release Resource 1 }) /// MAKE_GUARD([&] { Release Resource 1 })
/// Acquire Resource 2 /// Acquire Resource 2
// MAKE_GUARD([&] { Release Resource 2 }) // MAKE_GUARD([&] { Release Resource 2 })
#define GE_MAKE_GUARD(var, callback) ScopeGuard make_guard_##var(callback) #define GE_MAKE_GUARD(var, callback) domi::ScopeGuard make_guard_##var(callback)
#define GE_DISMISS_GUARD(var) make_guard_##var.Dismiss() #define GE_DISMISS_GUARD(var) make_guard_##var.Dismiss()
namespace ge { namespace domi {
class ScopeGuard { class ScopeGuard {
public: public:
// Noncopyable // Noncopyable
@ -55,6 +55,6 @@ class ScopeGuard {
std::function<void()> on_exit_scope_; std::function<void()> on_exit_scope_;
bool dismissed_; bool dismissed_;
}; };
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_SCOPE_GUARD_H_ #endif // INC_FRAMEWORK_COMMON_SCOPE_GUARD_H_

@ -25,7 +25,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace ge { namespace domi {
class StringUtils { class StringUtils {
public: public:
static std::string &Ltrim(std::string &s) { static std::string &Ltrim(std::string &s) {
@ -151,6 +151,6 @@ class StringUtils {
return ret > 0 ? buffer : ""; return ret > 0 ? buffer : "";
} }
}; };
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_STRING_UTIL_H_ #endif // INC_FRAMEWORK_COMMON_STRING_UTIL_H_

@ -26,7 +26,6 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "framework/common/fmk_error_codes.h" #include "framework/common/fmk_error_codes.h"
#include "framework/common/fmk_types.h" #include "framework/common/fmk_types.h"
#include "framework/common/op_types.h" #include "framework/common/op_types.h"
@ -47,7 +46,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_A
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_STATUS; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_STATUS;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_LAYER; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_LAYER;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_FILE_PATH; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMP_FILE_PATH;
} // namespace ge
namespace domi {
// Supported public properties name // Supported public properties name
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROP_OME_START_TIME; // Start time FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROP_OME_START_TIME; // Start time
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROP_OME_DUMP_PATH; // Dump path FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROP_OME_DUMP_PATH; // Dump path
@ -67,6 +68,14 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFIL
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::map<std::string, std::string> PROFILE_COMPONENT_MAP; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::map<std::string, std::string> PROFILE_COMPONENT_MAP;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFILE_CONFIG; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string PROFILE_CONFIG;
/// @brief Data structure definition related to task sinking
/// Build model
enum BuildMode {
GEN_TASK_WITHOUT_L2FUSION = 3, // Carrying task data (L2 convergence function disabled)
GEN_TASK_WITHOUT_FUSION = 4, // Carrying task data (all convergence functions disabled)
GEN_TASK_WITH_FUSION = 5 // Carrying task data (with UB/L1/L2 enabled for all convergence functions)
};
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASKS; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASKS;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASK_GEN_BASE_ADDR; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASK_GEN_BASE_ADDR;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASK_GEN_WEIGHT_ADDR; FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string MODEL_ATTR_TASK_GEN_WEIGHT_ADDR;
@ -333,7 +342,7 @@ REGISTER_OPTYPE_DECLARE(BASICLSTMCELL, "BasicLSTMCell");
REGISTER_OPTYPE_DECLARE(GETNEXT, "GetNext"); REGISTER_OPTYPE_DECLARE(GETNEXT, "GetNext");
REGISTER_OPTYPE_DECLARE(INITDATA, "InitData"); REGISTER_OPTYPE_DECLARE(INITDATA, "InitData");
// ANN dedicated operator /***************ANN dedicated operator *************************/
REGISTER_OPTYPE_DECLARE(ANN_MEAN, "AnnMean"); REGISTER_OPTYPE_DECLARE(ANN_MEAN, "AnnMean");
REGISTER_OPTYPE_DECLARE(ANN_CONVOLUTION, "AnnConvolution"); REGISTER_OPTYPE_DECLARE(ANN_CONVOLUTION, "AnnConvolution");
REGISTER_OPTYPE_DECLARE(ANN_DEPCONVOLUTION, "AnnDepthConv"); REGISTER_OPTYPE_DECLARE(ANN_DEPCONVOLUTION, "AnnDepthConv");
@ -350,7 +359,7 @@ REGISTER_OPTYPE_DECLARE(ANN_QUANTIZE, "AnnQuant");
REGISTER_OPTYPE_DECLARE(ANN_PAD, "AnnPad"); REGISTER_OPTYPE_DECLARE(ANN_PAD, "AnnPad");
REGISTER_OPTYPE_DECLARE(ANN_RESIZE_BILINEAR, "AnnResizeBilinear"); REGISTER_OPTYPE_DECLARE(ANN_RESIZE_BILINEAR, "AnnResizeBilinear");
// Training operator /********************Training operator ***********************/
REGISTER_OPTYPE_DECLARE(GATHERV2, "GatherV2"); REGISTER_OPTYPE_DECLARE(GATHERV2, "GatherV2");
REGISTER_OPTYPE_DECLARE(CONVGRADFILTER, "Conv2DBackpropFilter"); REGISTER_OPTYPE_DECLARE(CONVGRADFILTER, "Conv2DBackpropFilter");
REGISTER_OPTYPE_DECLARE(CONV2D, "Conv2D"); REGISTER_OPTYPE_DECLARE(CONV2D, "Conv2D");
@ -434,7 +443,6 @@ REGISTER_OPTYPE_DECLARE(STREAMSWITCH, "StreamSwitch");
REGISTER_OPTYPE_DECLARE(STREAMSWITCHN, "StreamSwitchN"); REGISTER_OPTYPE_DECLARE(STREAMSWITCHN, "StreamSwitchN");
REGISTER_OPTYPE_DECLARE(STREAMACTIVE, "StreamActive"); REGISTER_OPTYPE_DECLARE(STREAMACTIVE, "StreamActive");
REGISTER_OPTYPE_DECLARE(MEMCPYASYNC, "MemcpyAsync"); REGISTER_OPTYPE_DECLARE(MEMCPYASYNC, "MemcpyAsync");
REGISTER_OPTYPE_DECLARE(MEMCPYADDRASYNC, "MemcpyAddrAsync");
REGISTER_OPTYPE_DECLARE(STREAMMERGE, "StreamMerge"); REGISTER_OPTYPE_DECLARE(STREAMMERGE, "StreamMerge");
REGISTER_OPTYPE_DECLARE(ENDGRAPH, "EndGraph"); REGISTER_OPTYPE_DECLARE(ENDGRAPH, "EndGraph");
REGISTER_OPTYPE_DECLARE(SEND, "Send"); REGISTER_OPTYPE_DECLARE(SEND, "Send");
@ -442,7 +450,6 @@ REGISTER_OPTYPE_DECLARE(RECV, "Recv");
REGISTER_OPTYPE_DECLARE(LABELSET, "LabelSet"); REGISTER_OPTYPE_DECLARE(LABELSET, "LabelSet");
REGISTER_OPTYPE_DECLARE(LABELGOTO, "LabelGoto"); REGISTER_OPTYPE_DECLARE(LABELGOTO, "LabelGoto");
REGISTER_OPTYPE_DECLARE(LABELGOTOEX, "LabelGotoEx");
REGISTER_OPTYPE_DECLARE(LABELSWITCH, "LabelSwitch"); REGISTER_OPTYPE_DECLARE(LABELSWITCH, "LabelSwitch");
REGISTER_OPTYPE_DECLARE(LABELSWITCHBYINDEX, "LabelSwitchByIndex"); REGISTER_OPTYPE_DECLARE(LABELSWITCHBYINDEX, "LabelSwitchByIndex");
@ -821,6 +828,9 @@ static constexpr int32_t PARTITION_TYPE_TASK_INFO = 2;
// number of partitions in the current model // number of partitions in the current model
static constexpr uint32_t PARTITION_SIZE = 4; static constexpr uint32_t PARTITION_SIZE = 4;
#define SIZE_OF_MODEL_PARTITION_TABLE(table) \
(sizeof(domi::ModelPartitionTable) + sizeof(domi::ModelPartitionMemInfo) * (table).num)
enum ModelPartitionType { MODEL_DEF = 0, WEIGHTS_DATA, TASK_INFO, TBE_KERNELS }; enum ModelPartitionType { MODEL_DEF = 0, WEIGHTS_DATA, TASK_INFO, TBE_KERNELS };
struct ModelPartitionMemInfo { struct ModelPartitionMemInfo {
@ -834,8 +844,6 @@ struct ModelPartitionTable {
ModelPartitionMemInfo partition[0]; ModelPartitionMemInfo partition[0];
}; };
#define SIZE_OF_MODEL_PARTITION_TABLE(table) (sizeof(ModelPartitionTable) + sizeof(ModelPartitionMemInfo) * (table).num)
static constexpr int32_t PTHREAD_CREAT_SUCCESS = 0; // pthread_creat success static constexpr int32_t PTHREAD_CREAT_SUCCESS = 0; // pthread_creat success
// Filter format // Filter format
@ -967,8 +975,8 @@ typedef enum tagDomiNanPropagation {
// mode of cropandresize // mode of cropandresize
typedef enum tagDomiCropAndResizeMode { typedef enum tagDomiCropAndResizeMode {
DOMI_RESIZE_METHOD_BILINEAR = 0, // resize bilinear DOMI_RESIZE_METHOD_BILINEAR = 0, /**< resize bilinear */
DOMI_RESIZE_METHOD_NEAREST, // resize nearest DOMI_RESIZE_METHOD_NEAREST, /**< resize nearest */
DOMI_RESIZE_RESERVED DOMI_RESIZE_RESERVED
} domiCropAndResizeMode_t; } domiCropAndResizeMode_t;
@ -1055,15 +1063,6 @@ struct BasicInfo {
uint32_t total_size; // total memory size uint32_t total_size; // total memory size
}; };
#pragma pack() // Cancels single-byte alignment #pragma pack() // Cancels single-byte alignment
} // namespace ge
namespace domi {
/// @brief Data structure definition related to task sinking
enum BuildMode {
GEN_TASK_WITHOUT_L2FUSION = 3, // Carrying task data (L2 convergence function disabled)
GEN_TASK_WITHOUT_FUSION = 4, // Carrying task data (all convergence functions disabled)
GEN_TASK_WITH_FUSION = 5 // Carrying task data (with UB/L1/L2 enabled for all convergence functions)
};
} // namespace domi } // namespace domi
#endif // INC_FRAMEWORK_COMMON_TYPES_H_ #endif // INC_FRAMEWORK_COMMON_TYPES_H_

@ -220,7 +220,7 @@ static constexpr int32_t OM_PROTO_VERSION = 2;
*/ */
#define CEIL(N, n) (((N) + (n)-1) / (n)) #define CEIL(N, n) (((N) + (n)-1) / (n))
namespace ge { namespace domi {
using google::protobuf::Message; using google::protobuf::Message;
/// ///
@ -390,6 +390,6 @@ bool CheckOutputPathValid(const std::string &file_path);
/// @param [out] result /// @param [out] result
/// ///
bool ValidateStr(const std::string &filePath, const std::string &mode); bool ValidateStr(const std::string &filePath, const std::string &mode);
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_COMMON_UTIL_H_ #endif // INC_FRAMEWORK_COMMON_UTIL_H_

@ -28,16 +28,12 @@
#include "framework/common/types.h" #include "framework/common/types.h"
#include "register/register_fmk_types.h" #include "register/register_fmk_types.h"
using domi::DOMI_TENSOR_ND;
using domi::DOMI_TENSOR_RESERVED;
using domi::domiTensorFormat_t;
using domi::FrameworkType;
using std::map; using std::map;
using std::string; using std::string;
using std::unordered_map; using std::unordered_map;
using std::vector; using std::vector;
namespace ge { namespace domi {
/** /**
* @ingroup domi_omg * @ingroup domi_omg
* @brief run model * @brief run model
@ -97,7 +93,7 @@ struct OmgContext {
std::string ddk_version; std::string ddk_version;
// preferential format used by the entire network // preferential format used by the entire network
domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED;
domi::FrameworkType type = domi::FMK_TYPE_RESERVED; FrameworkType type = FMK_TYPE_RESERVED;
RunMode run_mode = ONLY_PRE_CHECK; RunMode run_mode = ONLY_PRE_CHECK;
bool train_flag = false; bool train_flag = false;
// whether to use FP16 high precision // whether to use FP16 high precision
@ -106,25 +102,23 @@ struct OmgContext {
std::string output_type; std::string output_type;
// Save the name of the entire network: Some special operators are used to determine a network. Some operators in the // Save the name of the entire network: Some special operators are used to determine a network. Some operators in the
// network require special processing based on the specific network. e.gfaster-rcnn, the FirstStageProcessor module // network require special processing based on the specific network.
// is determined as the Faster-R-CNN network based on the scope fusion. Then, the conv+reshape operators in the // e.gfaster-rcnn, the FirstStageProcessor module is determined as the Faster-R-CNN network based on the scope
// FirstStageBoxPredictor/BoxEncodingPredictor scope are combined. The convolution kernel rearrangement reshape // fusion. Then, the conv+reshape operators in the FirstStageBoxPredictor/BoxEncodingPredictor scope are combined. The
// operator needs to be deleted for the convolution kernel. // convolution kernel rearrangement reshape operator needs to be deleted for the convolution kernel.
std::string net_name; std::string net_name;
// Whether to use dynamic batch size or dynamic image size // Whether to use dynamic batch size or dynamic image size
bool is_dynamic_input = false; bool is_dynamic_input = false;
std::string dynamic_batch_size; std::string dynamic_batch_size;
std::string dynamic_image_size; std::string dynamic_image_size;
}; };
} // namespace ge
namespace domi {
/** /**
* @ingroup domi_omg * @ingroup domi_omg
* @brief get OMG context * @brief get OMG context
* @return OmgContext context * @return OmgContext context
*/ */
ge::OmgContext &GetContext(); OmgContext &GetContext();
struct TEBinInfo { struct TEBinInfo {
// It is obsolete. It will be automatically obtained from the binfilename field of the JSON file later. // It is obsolete. It will be automatically obtained from the binfilename field of the JSON file later.

@ -26,7 +26,7 @@
#include "common/string_util.h" #include "common/string_util.h"
#include "framework/common/debug/ge_log.h" #include "framework/common/debug/ge_log.h"
namespace ge { namespace domi {
class PlatformVersionManager { class PlatformVersionManager {
public: public:
PlatformVersionManager() = delete; PlatformVersionManager() = delete;
@ -40,6 +40,6 @@ class PlatformVersionManager {
return SUCCESS; return SUCCESS;
} }
}; // class PlatformManager }; // class PlatformManager
} // namespace ge } // namespace domi
#endif // INC_FRAMEWORK_OMG_VERSION_H_ #endif // INC_FRAMEWORK_OMG_VERSION_H_

File diff suppressed because it is too large Load Diff

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

Loading…
Cancel
Save