Compare commits

...

38 Commits

Author SHA1 Message Date
mindspore-ci-bot ce23341ee2 !503 code update
4 years ago
yanghaoran dabd399a6a update runtime error code definition
4 years ago
mindspore-ci-bot dd5ac69a1f !491 update optiling headers
4 years ago
yanghaoran 975e65054a update optiling headers
4 years ago
mindspore-ci-bot 38a40dd232 !471 add acl headers for new tdt interfaces
4 years ago
yanghaoran 21a7c98295 add acl headers for new tdt interfaces
4 years ago
mindspore-ci-bot 191dc74799 !465 add mmpa
4 years ago
yanghaoran d5d708764b add mmpa
4 years ago
mindspore-ci-bot 35a120dccd !454 Synchronize with latest Ascend software suite 28 Nov 2020
4 years ago
yanghaoran e95bc1b18f Synchronize with latest Ascend software suite 28 Nov 2020
4 years ago
mindspore-ci-bot 383f7f751d !301 Delete deprecated hccl calling
4 years ago
zhoufeng ad4523637d delete deprecated hccl calling
4 years ago
mindspore-ci-bot 412ebe82c9 !349 fix cc files naming convention and cmake errors
4 years ago
yanghaoran 3f9627f0de fix cc files naming convention and cmake errors
4 years ago
mindspore-ci-bot 9153665631 !335 Synchronize latest Ascend software suite 19 Nov 2020
4 years ago
yanghaoran 94facf5ebe Synchronize latest Ascend software suite 19 Nov 2020
4 years ago
mindspore-ci-bot 9d5177a954 !264 synchronize latest Ascend software suite 10 Nov 2020
4 years ago
yanghaoran 7ae9c448f9 synchronize latest Ascend software suite 10 Nov 2020
4 years ago
mindspore-ci-bot 93719ebecd !223 synchronize latest Ascend software suite 5 Nov 2020
4 years ago
yanghaoran 704a9eb441 synchronize latest Ascend software suite 5 Nov 2020
4 years ago
mindspore-ci-bot 42d217fb8c !193 Mindspore support to compile at ascendcl
4 years ago
zhoufeng 20929c8bd3 Mindspore support to compile at ascendcl
4 years ago
mindspore-ci-bot 423c0228e8 !175 synchronize latest Ascend software suite 27 Oct 2020
4 years ago
yanghaoran 24b8bc1cba synchronize latest Ascend software suite 27 Oct 2020
4 years ago
王涛 cd365aa247 !125 add stub files
4 years ago
yanghaoran b25b70c9c2 add stub files
4 years ago
mindspore-ci-bot 575b546b55 !105 speed up third party download via domestic source
4 years ago
yanghaoran 1f4f0a47b1 speed up third party download via domestic source
4 years ago
mindspore-ci-bot 866c61a4e6 !92 Handle empty label resource
4 years ago
zhoufeng 0667dcfa3f handle empty label resource
4 years ago
mindspore-ci-bot 7a75f024d5 !83 sync-from-trunk-to-blue-zone-1009
4 years ago
wuweikang 250465a71f sync-from-trunk-to-blue-zone-1009
4 years ago
mindspore-ci-bot 80dfd25e01 !79 add libadump_server support in ge_lib_path mode
4 years ago
yanghaoran fe038d0ae5 add libadump_server support in ge_lib_path mode
4 years ago
mindspore-ci-bot 88049a688b !77 fix securec download links due to mistakes made by openeuler community
4 years ago
yanghaoran dcc1768c68 fix securec download links due to mistakes made by openeuler community
4 years ago
mindspore-ci-bot 14db109491 !74 sync-from-trunk-to-blue-zone-0928
4 years ago
wuweikang bf316a3eeb sync-from-trunk-to-blue-zone-0928
4 years ago

@ -66,13 +66,14 @@ 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 libmsprof.so ${GE_LIB_PATH})
find_library(msprof libmsprofiler.a ${GE_LIB_PATH})
find_library(register libregister.so ${GE_LIB_PATH})
find_library(hccl libhccl.so ${GE_LIB_PATH})
find_library(resource libresource.so ${GE_LIB_PATH})
find_library(error_manager liberror_manager.so ${GE_LIB_PATH})
find_library(adump_server libadump_server.a ${GE_LIB_PATH})
else()
# Ascend mode
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
@ -80,17 +81,18 @@ else()
else()
set(ASCEND_DIR /usr/local/Ascend)
endif()
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
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(msprof libmsprof.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})
find_library(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
find_library(register libregister.so ${ASCEND_RUNTIME_DIR})
find_library(resource libresource.so ${ASCEND_RUNTIME_DIR})
find_library(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
find_library(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
endif()
# add compile flags

@ -1,10 +1,19 @@
set(Eigen3_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(Eigen3_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(Eigen3_NS "ge_")
if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/eigen-git-mirrorsource/repository/archive/3.3.7.tar.gz")
set(MD5 "cf6552a5d90c1aca4b5e0b011f65ea93")
else()
set(REQ_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz")
set(MD5 "9e30f67e8531477de4117506fe44669b")
endif ()
graphengine_add_pkg(Eigen3
VER 3.3.7
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
MD5 9e30f67e8531477de4117506fe44669b
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF)
find_package(Eigen3 3.3.7 REQUIRED ${GE_FIND_NO_DEFAULT_PATH})

@ -1,11 +1,19 @@
set(ge_gtest_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
set(ge_gtest_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/googletest/repository/archive/release-1.8.0.tar.gz")
set(MD5 "89e13ca1aa48d370719d58010b83f62c")
else()
set(REQ_URL "https://github.com/google/googletest/archive/release-1.8.0.tar.gz")
set(MD5 "16877098823401d1bf2ed7891d7dce36")
endif ()
graphengine_add_pkg(ge_gtest
VER 1.8.0
LIBS gtest gtest_main
URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz
MD5 16877098823401d1bf2ed7891d7dce36
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON)

@ -1,9 +1,20 @@
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.6.1.zip")
set(MD5 "5bda78ce308e6cfcf614dcf1d5ff27a7")
set(INCLUDE "./include")
else()
set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip")
set(MD5 "0dc903888211db3a0f170304cd9f3a89")
set(INCLUDE "./")
endif ()
graphengine_add_pkg(ge_nlohmann_json
VER 3.6.1
HEAD_ONLY ./
URL https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip
MD5 0dc903888211db3a0f170304cd9f3a89)
HEAD_ONLY ${INCLUDE}
URL ${REQ_URL}
MD5 ${MD5})
include_directories(${ge_nlohmann_json_INC})
add_library(graphengine::json ALIAS ge_nlohmann_json)

@ -1,5 +1,13 @@
if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/ONNX/repository/archive/v1.6.0.tar.gz")
set(MD5 "1bdbcecdd68ea8392630467646776e02")
else()
set(REQ_URL "https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz")
set(MD5 "512f2779d6215d4a36f366b6b9acdf1e")
endif ()
graphengine_add_pkg(onnx
VER 1.6.0
HEAD_ONLY ./
URL https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz
MD5 512f2779d6215d4a36f366b6b9acdf1e)
URL ${REQ_URL}
MD5 ${MD5})

@ -1,24 +1,40 @@
if (NOT TARGET protobuf::protobuf)
if (NOT TARGET ge_protobuf::ascend_protobuf)
if (AS_MS_COMP)
set(protobuf_USE_STATIC_LIBS OFF)
set(protobuf_CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON -DLIB_PREFIX=ascend_
-DCMAKE_C_FLAGS=\"-Dgoogle=ascend_private\" -DCMAKE_CXX_FLAGS=\"-Dgoogle=ascend_private\")
else ()
set(protobuf_USE_STATIC_LIBS ON)
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2")
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(protobuf_CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -DLIB_PREFIX=ascend_)
endif ()
set(ge_protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -D_GLIBCXX_USE_CXX11_ABI=0")
set(ge_protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
graphengine_add_pkg(protobuf
if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
set(MD5 "3d9e32700639618a4d2d342c99d4507a")
endif ()
graphengine_add_pkg(ge_protobuf
VER 3.8.0
LIBS protobuf
LIBS ascend_protobuf
EXE protoc
URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz
MD5 3d9e32700639618a4d2d342c99d4507a
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_PATH ../cmake/
CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF)
CMAKE_OPTION ${protobuf_CMAKE_OPTION})
set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})
endif()
add_library(graphengine::protobuf ALIAS protobuf::protobuf)
set(PROTOBUF_LIBRARY protobuf::protobuf)
include_directories(${protobuf_INC})
include_directories(${protobuf_DIRPATH}/src)
add_library(graphengine::protobuf ALIAS ge_protobuf::ascend_protobuf)
set(PROTOBUF_LIBRARY ge_protobuf::ascend_protobuf)
include_directories(${ge_protobuf_INC})
include_directories(${ge_protobuf_DIRPATH}/src)
function(ge_protobuf_generate comp c_var h_var)
if(NOT ARGN)
@ -42,8 +58,8 @@ function(ge_protobuf_generate comp c_var h_var)
"${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto/${comp}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto/${comp}/proto ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMAND ge_protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto/${comp}/proto ${abs_file}
DEPENDS ge_protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
endforeach()

@ -1,7 +1,7 @@
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
URL https://gitee.com/openeuler/libboundscheck/repository/archive/v1.1.10.tar.gz
MD5 193f0ca5246c1dd84920db34d2d8249f
LIBS c_sec
PATCHES ${GE_SOURCE_DIR}/third_party/patch/securec/securec.patch001
CMAKE_OPTION "-DCMAKE_BUILD_TYPE=Release"

@ -112,7 +112,9 @@ function(__find_pkg_then_add_target pkg_name pkg_exe)
if(NOT ${pkg_exe}_EXE)
return()
endif()
if (NOT TARGET ${pkg_name}::${pkg_exe})
add_executable(${pkg_name}::${pkg_exe} IMPORTED GLOBAL)
endif ()
set_target_properties(${pkg_name}::${pkg_exe} PROPERTIES
IMPORTED_LOCATION ${${pkg_exe}_EXE}
)

@ -0,0 +1,51 @@
/**
* 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_COMMON_OPSKERNELUTILS_OPS_KERNEL_INFO_UTILS_H_
#define INC_COMMON_OPSKERNELUTILS_OPS_KERNEL_INFO_UTILS_H_
#include "external/ge/ge_api_error_codes.h"
#include "cce/aicpu_engine_struct.h"
#include "common/opskernel/ops_kernel_info_types.h"
#include "graph/node.h"
#include "proto/task.pb.h"
namespace ge {
class OpsKernelBuilder {
public:
OpsKernelBuilder() = default;
virtual ~OpsKernelBuilder() = default;
// initialize OpsKernelBuilder
virtual Status Initialize(const std::map<std::string, std::string> &options) = 0;
// finalize OpsKernelBuilder
virtual Status Finalize() = 0;
// memory allocation requirement
virtual Status CalcOpRunningParam(Node &node) = 0;
// generate task for op
virtual Status GenerateTask(const Node &node, RunContext &context, std::vector<domi::TaskDef> &tasks) = 0;
// only call aicpu interface to generate task struct
virtual Status GenSingleOpRunTask(const NodePtr &node, STR_FWK_OP_KERNEL &task, string &task_info) { return FAILED; }
// only call aicpu interface to generate task struct
virtual Status GenMemCopyTask(uint64_t count, STR_FWK_OP_KERNEL &task, string &task_info) { return FAILED; }
};
} // namespace ge
#endif // INC_COMMON_OPSKERNELUTILS_OPS_KERNEL_INFO_UTILS_H_

@ -43,10 +43,10 @@ class OpsKernelInfoStore {
virtual ~OpsKernelInfoStore() {}
// initialize opsKernelInfoStore
virtual Status Initialize(const map<string, string> &options) = 0; /*lint -e148*/
virtual Status Initialize(const map<string, string> &options) = 0;
// close opsKernelInfoStore
virtual Status Finalize() = 0; /*lint -e148*/
virtual Status Finalize() = 0;
virtual Status CreateSession(const std::map<std::string, std::string> &session_options) { return SUCCESS; }
@ -65,24 +65,11 @@ class OpsKernelInfoStore {
// opsFlag opsFlag[0] indicates constant folding is supported or not
virtual void opsFlagCheck(const ge::Node &node, std::string &opsFlag){};
// memory allocation requirement
virtual Status CalcOpRunningParam(Node &node) = 0; /*lint -e148*/
// generate task for op。
virtual Status GenerateTask(const Node &node, RunContext &context,
std::vector<domi::TaskDef> &tasks) = 0; /*lint -e148*/
// only call fe engine interface to compile single op
virtual Status CompileOp(vector<ge::NodePtr> &node_vec) { return SUCCESS; }
virtual Status CompileOpRun(vector<ge::NodePtr> &node_vec) { return SUCCESS; }
// load task for op
virtual Status LoadTask(GETaskInfo &task) { return SUCCESS; }
// only call aicpu interface to generate task struct
virtual Status GenSingleOpRunTask(const NodePtr &node, STR_FWK_OP_KERNEL &task, string &task_info) { return SUCCESS; }
// only call aicpu interface to generate task struct
virtual Status GenMemCopyTask(uint64_t count, STR_FWK_OP_KERNEL &task, string &task_info) { return SUCCESS; }
};
} // namespace ge
#endif // INC_COMMON_OPSKERNEL_OPS_KERNEL_INFO_STORE_H_

@ -26,13 +26,14 @@
using std::string;
namespace ge {
/*lint -e148*/
struct RunContext {
rtModel_t model;
rtStream_t stream;
uint64_t sessionId;
uint64_t dataMemSize;
uint8_t *dataMemBase;
std::map<int64_t, uint64_t> mem_type_data_mem_size;
std::map<int64_t, uint8_t *> mem_type_data_mem_base;
uint64_t weightMemSize;
uint8_t *weightMemBase;
ge::Buffer weightsBuffer;
@ -41,8 +42,6 @@ struct RunContext {
std::vector<rtLabel_t> graphLabelList; // all labels of graph, order by ge label id(0,1,...)
};
/*lint +e148*/
struct Task {
uint32_t id;
uint16_t type;
@ -52,7 +51,6 @@ struct Task {
struct OpInfo {
string engine; // which engin
/*lint -e148*/
string opKernelLib; // which opsKernelStore
int computeCost; // compute cost
bool flagPartial; // whether to support is related to shape

@ -27,7 +27,6 @@
using std::map;
using std::string;
/*lint -e148*/
namespace ge {
class GraphOptimizer {
public:
@ -67,5 +66,4 @@ class GraphOptimizer {
virtual Status OptimizeFusedGraphAfterGraphSlice(ComputeGraph &graph) { return SUCCESS; }
};
} // namespace ge
/*lint +e148*/
#endif // INC_COMMON_OPTIMIZER_GRAPH_OPTIMIZER_H_

@ -0,0 +1,48 @@
/**
* 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 AICORE_UTIL_MANAGER_H_
#define AICORE_UTIL_MANAGER_H_
#include <string>
#include "register/graph_optimizer/graph_optimize_register_error_codes.h"
namespace fe {
class AICoreUtilManager {
public:
static AICoreUtilManager &Instance();
/*
* to initialize the aicore configuration
* param[in] the options of init
* param[in] engine Name
* param[in] socVersion soc version from ge
* return Status(SUCCESS/FAILED)
*/
Status Initialize(const std::map<std::string, std::string> &options, std::string &soc_version);
/*
* to release the source of fusion manager
* return Status(SUCCESS/FAILED)
*/
Status Finalize();
private:
AICoreUtilManager();
~AICoreUtilManager();
bool is_init_;
};
} // namespace fe
#endif // AICORE_UTIL_MANAGER_H

@ -36,6 +36,14 @@ static const std::string L1_OPTIMIZED = "l1_optimized";
static const std::string L2_OPTIMIZED = "l2_optimized";
static const std::string OP_SLICE_INFO = "_op_slice_info";
static const std::string ATTR_NAME_UNKNOWN_SHAPE = "_unknown_shape";
static const std::string ATTR_NAME_IS_UNKNOWN_GRAPH = "_fe_is_unknown_graph";
static const std::string ATTR_NAME_IS_UNKNOWN_SHAPE_OP = "_fe_is_unknown_shape_op";
static const std::string ATTR_NAME_TVM_CACHE_READ_MODE = "tvm_cache_read_mode";
static const std::string ATTR_NAME_TBE_KERNEL_SIZE = "_tbeKernelSize";
} // namespace fe
#endif

@ -0,0 +1,54 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef INC_COMMON_UTILS_AI_CORE_COMMON_CONSTANTS_H_
#define INC_COMMON_UTILS_AI_CORE_COMMON_CONSTANTS_H_
#include <string>
namespace fe {
static const std::string CORE_TYPE = "_coretype";
/* engine name of AI core and vector core */
static const std::string AI_CORE_NAME = "AIcoreEngine";
static const std::string VECTOR_CORE_NAME = "VectorEngine";
static const int64_t IS_UNKNOWN_SHAPE_VALUE = 1;
static const int64_t SHAPE_UNKNOWN_DIM = -1;
static const int64_t SHAPE_UNKNOWN_DIM_NUM = -2;
static const std::string SOC_VERSION_ASCEND310 = "Ascend310";
static const std::string SOC_VERSION_ASCEND610 = "Ascend610";
static const std::string SOC_VERSION_ASCEND615 = "Ascend615";
static const std::string SOC_VERSION_ASCEND710 = "Ascend710";
static const std::string SOC_VERSION_ASCEND710P = "Ascend710Pro";
static const std::string SOC_VERSION_ASCEND910A = "Ascend910A";
static const std::string SOC_VERSION_ASCEND910B = "Ascend910B";
static const std::string SOC_VERSION_ASCEND910PROA = "Ascend910ProA";
static const std::string SOC_VERSION_ASCEND910PROB = "Ascend910ProB";
static const std::string SOC_VERSION_ASCEND910PREMIUMA = "Ascend910PremiumA";
static const std::string SOC_VERSION_HI3796CV300ES = "Hi3796CV300ES";
static const std::string SOC_VERSION_HI3796CV300CS = "Hi3796CV300CS";
static const std::vector<std::string> SOC_VERSION_CLOUD_LIST = {SOC_VERSION_ASCEND910A, SOC_VERSION_ASCEND910B,
SOC_VERSION_ASCEND910PROA, SOC_VERSION_ASCEND910PROB,
SOC_VERSION_ASCEND910PREMIUMA};
static const std::vector<std::string> SOC_VERSION_DC_LIST = {SOC_VERSION_ASCEND610, SOC_VERSION_ASCEND615,
SOC_VERSION_ASCEND710, SOC_VERSION_ASCEND710P};
} // namespace fe
#endif

@ -42,47 +42,61 @@ struct FusionDataFlow {
std::pair<std::string, ge::AnchorPtr> node_dataindex_pair;
};
typedef struct tagL2FusionData {
typedef struct tag_l2_fusion_data {
uint32_t l2Index;
uint64_t l2Addr;
uint64_t l2PageNum;
} L2FusionData_t;
typedef std::map<uint64_t, L2FusionData_t> L2FusionDataMap_t;
typedef struct tagFeSmDesc {
typedef struct tag_fe_sm_desc {
rtL2Ctrl_t l2ctrl;
std::string nodeName[8];
uint8_t outputIndex[8];
} feSmDesc_t;
std::string node_name[8];
uint8_t output_index[8];
} fe_sm_desc_t;
typedef struct TagTaskL2FusionInfo {
std::string nodeName;
feSmDesc_t l2Info;
std::string node_name;
fe_sm_desc_t l2_info;
L2FusionDataMap_t input;
L2FusionDataMap_t output;
uint32_t isUsed;
uint32_t is_used;
} TaskL2FusionInfo_t;
using L2FusionInfoPtr = std::shared_ptr<TaskL2FusionInfo_t>;
typedef struct ToOpStruct {
int64_t opL1Space = 0;
std::vector<int64_t> opL1FusionType;
int64_t opL1WorkspaceFlag = 0; // for workspace flag
int64_t opL1WorkspaceSize = 0;
std::vector<std::vector<int64_t>> validInputShape;
std::vector<std::vector<int64_t>> validOutputShape;
std::vector<std::vector<int64_t>> sliceInputOffset; // conv & pooling & ReadSelect
std::vector<std::vector<int64_t>> sliceOutputOffset; // WriteSelect
std::vector<uint32_t> totalShape;
uint32_t splitIndex = 0;
int64_t op_l1_space = 0;
std::vector<int64_t> op_l1_fusion_type;
int64_t op_l1_workspace_flag = 0; // for workspace flag
int64_t op_l1_workspace_size = 0;
std::vector<std::vector<int64_t>> valid_input_shape;
std::vector<std::vector<int64_t>> valid_output_shape;
std::vector<std::vector<int64_t>> slice_input_offset; // conv & pooling & ReadSelect
std::vector<std::vector<int64_t>> slice_output_offset; // WriteSelect
std::vector<uint32_t> total_shape;
uint32_t split_index = 0;
ToOpStruct() {
// set invalid value for essential variable
opL1Space = -1;
opL1WorkspaceSize = -1;
op_l1_space = -1;
op_l1_workspace_size = -1;
}
} ToOpStruct_t;
enum SlicePattern {
ELEMENT_WISE = 0,
ELEMENT_WISE_BROADCAST,
BROADCAST,
SLIDING_WINDOW,
SLIDING_WINDOW_DECONV,
CUBE_MATMUL,
SLICE_PATTERN_REDUCE,
SLICE_PATTERN_RESIZE,
SLICE_PATTERN_SCATTER,
SLICE_PATTERN_SEGMENT,
PATTERN_RESERVED
};
enum OpImplType {
EN_IMPL_CUSTOM_CONSTANT_CCE = 0, // custom constant op
EN_IMPL_CUSTOM_TIK, // custom tik op
@ -99,6 +113,10 @@ enum OpImplType {
EN_RESERVED // reserved value
};
// Dont change the order, only add new mode in the end
enum L2Mode { EN_L2_CLOSE = 0, EN_L2_BUFFER_OPTIMIZE, EN_L2_CACHE_NORMAL, EN_L2_CACHE_RC };
enum BufferFusionMode { EN_OPTIMIZE_DISABLE = 0, EN_L2_BUFFER, EN_L2_FUSION };
static const std::map<ge::DataType, uint32_t> DATATYPE_SIZE_MAP{{ge::DT_FLOAT, sizeof(float)},
{ge::DT_FLOAT16, sizeof(int16_t)},
{ge::DT_INT8, sizeof(int8_t)},
@ -114,5 +132,13 @@ static const std::map<ge::DataType, uint32_t> DATATYPE_SIZE_MAP{{ge::DT_FLOAT, s
{ge::DT_DUAL, sizeof(float) + sizeof(int8_t)},
{ge::DT_DUAL_SUB_UINT8, sizeof(int8_t)},
{ge::DT_DUAL_SUB_INT8, sizeof(int8_t)}};
enum OpReduceType {
REDUCE_MEAN = 0,
REDUCE_ADD,
REDUCE_MAX,
REDUCE_MIN,
};
} // namespace fe
#endif

@ -28,33 +28,34 @@
namespace fe {
using kScopeNodeMap_t = std::map<int64_t, std::vector<ge::NodePtr>>;
using kScopeNodePair_t = std::pair<int64_t, std::vector<ge::NodePtr>>;
using k_scope_node_map_t = std::map<int64_t, std::vector<ge::NodePtr>>;
using k_scope_node_pair_t = std::pair<int64_t, std::vector<ge::NodePtr>>;
class GraphCommImpl;
using GraphCommImplPtr = std::unique_ptr<GraphCommImpl>;
class GraphComm {
public:
GraphComm(const string &engineName);
GraphComm(const string &engine_name);
virtual ~GraphComm();
GraphComm(const GraphComm &in) = delete;
GraphComm &operator=(const GraphComm &in) = delete;
Status GetscopeNodeMap(ge::ComputeGraph &graph, kScopeNodeMap_t &fusionMap);
Status GetscopeNodeMap(ge::ComputeGraph &graph, k_scope_node_map_t &fusion_map);
Status CopyFusionOpNodes(vector<FusionDataFlow> &fusInputEdgeList, vector<FusionDataFlow> &fusOutputEdgeList,
vector<ge::NodePtr> &fusNodelist, ge::OpDescPtr fusionOpDesc,
ge::ComputeGraphPtr fusionGraph);
Status CopyFusionOpNodes(vector<FusionDataFlow> &fus_input_edge_list, vector<FusionDataFlow> &fus_output_edge_list,
vector<ge::NodePtr> &fus_nodelist, ge::OpDescPtr fusion_op_desc,
ge::ComputeGraphPtr fusion_graph);
Status CopyFusionOpEdges(ge::OpDescPtr fusionOpDesc, ge::ComputeGraph &origGraph, ge::ComputeGraphPtr fusionGraph);
Status CopyFusionOpEdges(ge::OpDescPtr fusion_op_desc, ge::ComputeGraph &orig_graph,
ge::ComputeGraphPtr fusion_graph);
Status GetNodeDataFlowMap(const ge::NodePtr &fusNode,
std::map<ge::NodePtr, std::map<ge::AnchorPtr, ge::AnchorPtr>> &fusionOpAnchorsMap,
ge::kFusionDataFlowVec_t &fusDataflowList, const int &mapType);
Status GetNodeDataFlowMap(const ge::NodePtr &fus_node,
std::map<ge::NodePtr, std::map<ge::AnchorPtr, ge::AnchorPtr>> &fusion_op_anchors_map,
ge::kFusionDataFlowVec_t &fus_dataflow_list, const int &map_type);
Status GetFusionNodeEdgeList(std::vector<ge::NodePtr> &fusNodelist, std::vector<FusionDataFlow> &fusInputEdgeList,
std::vector<FusionDataFlow> &fusOutputEdgeList);
Status GetFusionNodeEdgeList(std::vector<ge::NodePtr> &fus_nodelist, std::vector<FusionDataFlow> &fus_input_edge_list,
std::vector<FusionDataFlow> &fus_output_edge_list);
void ClearFusionSrc();
void ClearFusionDst();
@ -72,25 +73,26 @@ class GraphComm {
bool GetFusionSrc(const uint32_t &src_op_id, const ge::AnchorPtr &src_anchor, int32_t &fusion_src_index,
int32_t &fusion_dst_index);
Status GetFusionNodeCtrlEdgeList(vector<ge::NodePtr> &fusNodelist, vector<FusionDataFlow> &fusInputCtrlEdgeList,
vector<FusionDataFlow> &fusOutputCtrlEdgeList);
Status GetFusionNodeCtrlEdgeList(vector<ge::NodePtr> &fus_nodelist, vector<FusionDataFlow> &fus_input_ctrl_edge_list,
vector<FusionDataFlow> &fus_output_ctrl_edge_list);
Status MergeFusionNodeEdgeList(ge::NodePtr &fusNode, vector<ge::NodePtr> &fusNodelist,
vector<FusionDataFlow> &fusInputEdgeList, vector<FusionDataFlow> &fusOutputEdgeList);
Status MergeFusionNodeEdgeList(ge::NodePtr &fus_node, vector<ge::NodePtr> &fus_nodelist,
vector<FusionDataFlow> &fus_input_edge_list,
vector<FusionDataFlow> &fus_output_edge_list);
Status MergeFusionNodeCtrlEdgeList(ge::NodePtr &fusNode, vector<ge::NodePtr> &fusNodelist,
vector<FusionDataFlow> &fusInputEdgeList,
vector<FusionDataFlow> &fusOutputEdgeList);
Status MergeFusionNodeCtrlEdgeList(ge::NodePtr &fus_node, vector<ge::NodePtr> &fus_nodelist,
vector<FusionDataFlow> &fus_input_edge_list,
vector<FusionDataFlow> &fus_output_edge_list);
string GetEngineName();
private:
Status MergeFusionNodeInputEdgeList(ge::NodePtr fusNode, std::vector<ge::NodePtr> &fusNodelist,
std::vector<FusionDataFlow> &fusInputEdgeList);
Status MergeFusionNodeOutputEdgeList(ge::NodePtr fusNode, std::vector<ge::NodePtr> &fusNodelist,
std::vector<FusionDataFlow> &fusOutputEdgeList);
Status MergeFusionNodeInputEdgeList(ge::NodePtr fus_node, std::vector<ge::NodePtr> &fus_nodelist,
std::vector<FusionDataFlow> &fus_input_edge_list);
Status MergeFusionNodeOutputEdgeList(ge::NodePtr fus_node, std::vector<ge::NodePtr> &fus_nodelist,
std::vector<FusionDataFlow> &fus_output_edge_list);
string engineName_;
string engine_name_;
std::vector<FusionOpSrc> exist_fusion_src_list_;
std::vector<FusionOpDst> exist_fusion_dst_list_;
@ -101,7 +103,7 @@ class GraphComm {
// std::vector<std::multimap<std::string, ge::AnchorPtr>>
ge::kFusionDataFlowVec_t fusion_output_dataflow_list_;
GraphCommImplPtr graphCommImplPtr_;
GraphCommImplPtr graph_comm_impl_ptr_;
};
} // namespace fe
#endif

@ -0,0 +1,54 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PROJECT_JSON_UTIL_H
#define PROJECT_JSON_UTIL_H
#include "graph/compute_graph.h"
#include "common/aicore_util_types.h"
#include "fusion_engine/graph_tuner/graph_tuner_errorcode.h"
const std::string L1_FUSION_EXTEND_CONTENT = "_l1_fusion_extend_content";
const std::string L2_FUSION_EXTEND_CONTENT = "l2_fusion_extend_content";
const std::string TASK_L2_FUSION_INFO_EXTEND_CONTENT = "task_l2_fusion_info_extend_content";
const std::string L1_FUSION_TO_OP_STRUCT = "_l1fusion_ToOpStruct";
const std::string L2_FUSION_TO_OP_STRUCT = "_l2fusion_ToOpStruct";
const std::string TASK_L2_FUSION_INFO = "_task_L2FusionInfo";
namespace tune {
using ToOpStructPtr = std::shared_ptr<fe::ToOpStruct_t>;
using L2FusionInfoPtr = std::shared_ptr<fe::TaskL2FusionInfo_t>;
Status GetL1InfoFromJson(ge::OpDescPtr opDescPtr);
Status GetL2InfoFromJson(ge::OpDescPtr opDescPtr);
Status GetTaskL2FusionInfoFromJson(ge::OpDescPtr opDescPtr);
Status ReadGraphInfoFromJson(ge::ComputeGraph &graph);
Status WriteGraphInfoToJson(ge::ComputeGraph &graph);
void GetL2ToOpStructFromJson(ge::OpDescPtr &opDescPtr, ToOpStructPtr &l2InfoPtr);
void GetL1ToOpStructFromJson(ge::OpDescPtr &opDescPtr, ToOpStructPtr &l1InfoPtr);
L2FusionInfoPtr GetL2FusionInfoFromJson(ge::OpDescPtr &opDescPtr);
void SetL2FusionInfoToNode(ge::OpDescPtr &opDescPtr, L2FusionInfoPtr &l2FusionInfoPtr);
} // namespace tune
#endif // PROJECT_JSON_UTIL_H

@ -0,0 +1,44 @@
/**
* 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 L2_STREAM_INFO_H_
#define L2_STREAM_INFO_H_
#include <map>
#include <string>
#include <mutex>
#include "register/graph_optimizer/graph_optimize_register_error_codes.h"
#include "runtime/base.h"
#include "cce/l2fusion_struct.hpp"
namespace fe {
class StreamL2Info {
public:
StreamL2Info(const StreamL2Info &) = delete;
StreamL2Info &operator=(const StreamL2Info &) = delete;
static StreamL2Info &Instance();
Status GetStreamL2Info(rtStream_t stream_id, string node_name, fusion::TaskL2Info_t *&l2_data);
Status SetStreamL2Info(const rtStream_t &stream_id, fusion::TaskL2InfoFEMap_t &l2_alloc_res);
private:
StreamL2Info();
~StreamL2Info();
mutable std::mutex stream_l2_mutex_;
std::map<rtStream_t, fusion::TaskL2InfoFEMap_t> stream_l2_map_;
};
} // namespace fe
#endif // L2_STREAM_INFO_H_

@ -32,12 +32,12 @@ class ScopeAllocator {
int64_t GetCurrentScopeId();
int64_t AllocateScopeId(void);
bool HasScopeAttr(ge::ConstOpDescPtr opdef);
bool GetScopeAttr(ge::ConstOpDescPtr opdef, int64_t& scopeId);
bool SetScopeAttr(ge::OpDescPtr opdef, int64_t scopeId);
bool ResetScopeId(int64_t scopeId);
bool GetScopeAttr(ge::ConstOpDescPtr opdef, int64_t& scope_id);
bool SetScopeAttr(ge::OpDescPtr opdef, int64_t scope_id);
bool ResetScopeId(int64_t scope_id);
private:
int64_t scopeId;
int64_t scope_id;
};
} // namespace fe
#endif

@ -29,16 +29,16 @@ class TensorSizeCalculator {
public:
/**
* Calculate the tensor size of input and output of each opdesc
* @param opDesc opdesc object
* @param opImplType op impl type
* @param op_desc opdesc object
* @param op_impl_type op impl type
* @return status SUCCESS or FAILED
*/
static Status CalculateOpTensorSize(ge::OpDesc &opDesc);
static Status CalculateOpTensorSize(ge::OpDesc &op_desc);
private:
static Status CalcInputOpTensorSize(ge::OpDesc &opDesc, int32_t &outputRealCalcFlag);
static Status CalcInputOpTensorSize(ge::OpDesc &op_desc, int32_t &output_real_calc_flag);
static Status CalcOutputOpTensorSize(ge::OpDesc &opDesc, int32_t &outputRealCalcFlag);
static Status CalcOutputOpTensorSize(ge::OpDesc &op_desc, int32_t &output_real_calc_flag);
};
} // namespace fe

@ -20,6 +20,7 @@
#include <map>
#include <string>
#include <vector>
#include <mutex>
class ErrorManager {
public:
@ -66,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;
@ -86,9 +109,11 @@ class ErrorManager {
int ReadJsonFile(const std::string &file_path, void *handle);
bool is_init_ = false;
std::mutex mutex_;
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_

@ -36,66 +36,66 @@ class PlatformInfoManager {
uint32_t InitializePlatformInfo();
uint32_t Finalize();
uint32_t GetPlatformInfo(const string SoCVersion, PlatformInfo &platformInfo, OptionalInfo &optiCompilationInfo);
uint32_t GetPlatformInfo(const string SoCVersion, PlatformInfo &platform_info, OptionalInfo &opti_compilation_info);
uint32_t GetPlatformInfoWithOutSocVersion(PlatformInfo &platformInfo, OptionalInfo &optiCompilationInfo);
uint32_t GetPlatformInfoWithOutSocVersion(PlatformInfo &platform_info, OptionalInfo &opti_compilation_info);
void SetOptionalCompilationInfo(OptionalInfo &optiCompilationInfo);
void SetOptionalCompilationInfo(OptionalInfo &opti_compilation_info);
private:
PlatformInfoManager();
~PlatformInfoManager();
uint32_t LoadIniFile(string iniFileRealPath);
uint32_t LoadIniFile(string ini_file_real_path);
void Trim(string &str);
uint32_t LoadConfigFile(string realPath);
uint32_t LoadConfigFile(string real_path);
string RealPath(const std::string &path);
string GetSoFilePath();
void ParseVersion(map<string, string> &versionMap, string &socVersion, PlatformInfo &platformInfoTemp);
void ParseVersion(map<string, string> &version_map, string &soc_version, PlatformInfo &platform_info_temp);
void ParseSocInfo(map<string, string> &socInfoMap, PlatformInfo &platformInfoTemp);
void ParseSocInfo(map<string, string> &soc_info_map, PlatformInfo &platform_info_temp);
void ParseCubeOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
void ParseCubeOfAICoreSpec(map<string, string> &ai_core_spec_map, PlatformInfo &platform_info_temp);
void ParseBufferOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
void ParseBufferOfAICoreSpec(map<string, string> &ai_core_spec_map, PlatformInfo &platform_info_temp);
void ParseUBOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
void ParseUBOfAICoreSpec(map<string, string> &ai_core_spec_map, PlatformInfo &platform_info_temp);
void ParseUnzipOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
void ParseUnzipOfAICoreSpec(map<string, string> &ai_core_spec_map, PlatformInfo &platform_info_temp);
void ParseAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
void ParseAICoreSpec(map<string, string> &ai_core_spec_map, PlatformInfo &platform_info_temp);
void ParseBufferOfAICoreMemoryRates(map<string, string> &aiCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
void ParseBufferOfAICoreMemoryRates(map<string, string> &ai_core_memory_rates_map, PlatformInfo &platform_info_temp);
void ParseAICoreMemoryRates(map<string, string> &aiCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
void ParseAICoreMemoryRates(map<string, string> &ai_core_memory_rates_map, PlatformInfo &platform_info_temp);
void ParseUBOfAICoreMemoryRates(map<string, string> &aiCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
void ParseUBOfAICoreMemoryRates(map<string, string> &ai_core_memory_rates_map, PlatformInfo &platform_info_temp);
void ParseAICoreintrinsicDtypeMap(map<string, string> &aiCoreintrinsicDtypeMap, PlatformInfo &platformInfoTemp);
void ParseAICoreintrinsicDtypeMap(map<string, string> &ai_coreintrinsic_dtype_map, PlatformInfo &platform_info_temp);
void ParseVectorCoreSpec(map<string, string> &vectorCoreSpecMap, PlatformInfo &platformInfoTemp);
void ParseVectorCoreSpec(map<string, string> &vector_core_spec_map, PlatformInfo &platform_info_temp);
void ParseVectorCoreMemoryRates(map<string, string> &vectorCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
void ParseVectorCoreMemoryRates(map<string, string> &vector_core_memory_rates_map, PlatformInfo &platform_info_temp);
void ParseCPUCache(map<string, string> &CPUCacheMap, PlatformInfo &platformInfoTemp);
void ParseCPUCache(map<string, string> &CPUCacheMap, PlatformInfo &platform_info_temp);
void ParseVectorCoreintrinsicDtypeMap(map<string, string> &vectorCoreintrinsicDtypeMap,
PlatformInfo &platformInfoTemp);
void ParseVectorCoreintrinsicDtypeMap(map<string, string> &vector_coreintrinsic_dtype_map,
PlatformInfo &platform_info_temp);
uint32_t ParsePlatformInfoFromStrToStruct(map<string, map<string, string>> &contentInfoMap, string &socVersion,
PlatformInfo &platformInfoTemp);
uint32_t ParsePlatformInfoFromStrToStruct(map<string, map<string, string>> &content_info_map, string &soc_version,
PlatformInfo &platform_info_temp);
uint32_t AssemblePlatformInfoVector(map<string, map<string, string>> &contentInfoMap);
uint32_t AssemblePlatformInfoVector(map<string, map<string, string>> &content_info_map);
private:
bool initFlag_;
map<string, PlatformInfo> platformInfoMap_;
OptionalInfo optiCompilationInfo_;
bool init_flag_;
map<string, PlatformInfo> platform_info_map_;
OptionalInfo opti_compilation_info_;
};
} // namespace fe
#endif

@ -30,111 +30,113 @@ enum MemoryType { DDR = 0, HBM };
enum L2Type { Cache = 0, Buff };
typedef struct tagStrInfo {
string aicVersion;
string ccecAICVersion;
string ccecAIVVersion;
string isSupportAIcpuCompiler;
typedef struct tag_str_info {
string aic_version;
string ccec_aic_version;
string ccec_aiv_version;
string is_support_ai_cpu_compiler;
} StrInfo;
typedef struct tagSoCInfo {
uint32_t aiCoreCnt;
uint32_t vectorCoreCnt;
uint32_t aiCpuCnt;
MemoryType memoryType;
uint64_t memorySize;
L2Type l2Type;
uint64_t l2Size;
typedef struct tag_so_c_info {
uint32_t ai_core_cnt;
uint32_t vector_core_cnt;
uint32_t ai_cpu_cnt;
MemoryType memory_type;
uint64_t memory_size;
L2Type l2_type;
uint64_t l2_size;
uint32_t l2PageNum;
} SoCInfo;
typedef struct tagAiCoreSpec {
double cubeFreq;
uint64_t cubeMSize;
uint64_t cubeNSize;
uint64_t cubeKSize;
uint64_t vecCalcSize;
uint64_t l0ASize;
uint64_t l0BSize;
uint64_t l0CSize;
uint64_t l1Size;
uint64_t smaskBuffer;
uint64_t ubSize;
uint64_t ubblockSize;
uint64_t ubbankSize;
uint64_t ubbankNum;
uint64_t ubburstInOneBlock;
uint64_t ubbankGroupNum;
uint32_t unzipEngines;
uint32_t unzipMaxRatios;
uint32_t unzipChannels;
uint8_t unzipIsTight;
typedef struct tag_ai_core_spec {
double cube_freq;
uint64_t cube_m_size;
uint64_t cube_n_size;
uint64_t cube_k_size;
uint64_t vec_calc_size;
uint64_t l0_a_size;
uint64_t l0_b_size;
uint64_t l0_c_size;
uint64_t l1_size;
uint64_t smask_buffer;
uint64_t ub_size;
uint64_t ubblock_size;
uint64_t ubbank_size;
uint64_t ubbank_num;
uint64_t ubburst_in_one_block;
uint64_t ubbank_group_num;
uint32_t unzip_engines;
uint32_t unzip_max_ratios;
uint32_t unzip_channels;
uint8_t unzip_is_tight;
uint8_t cube_vector_split;
} AiCoreSpec;
typedef struct tagAiCoreMemoryRates {
double ddrRate;
double ddrReadRate;
double ddrWriteRate;
double l2Rate;
double l2ReadRate;
double l2WriteRate;
double l1ToL0ARate;
double l1ToL0BRate;
double l1ToUBRate;
double l0CToUBRate;
double ubToL2Rate;
double ubToDdrRate;
double ubToL1Rate;
typedef struct tag_ai_core_memory_rates {
double ddr_rate;
double ddr_read_rate;
double ddr_write_rate;
double l2_rate;
double l2_read_rate;
double l2_write_rate;
double l1_to_l0_a_rate;
double l1_to_l0_b_rate;
double l1_to_ub_rate;
double l0_c_to_ub_rate;
double ub_to_l2_rate;
double ub_to_ddr_rate;
double ub_to_l1_rate;
} AiCoreMemoryRates;
typedef struct tagVectorCoreSpec {
double vecFreq;
uint64_t vecCalcSize;
uint64_t smaskBuffer;
uint64_t ubSize;
uint64_t ubblockSize;
uint64_t ubbankSize;
uint64_t ubbankNum;
uint64_t ubburstInOneBlock;
uint64_t ubbankGroupNum;
uint64_t vectorRegSize;
uint64_t predicateRegSize;
uint64_t addressRegSize;
typedef struct tag_vector_core_spec {
double vec_freq;
uint64_t vec_calc_size;
uint64_t smask_buffer;
uint64_t ub_size;
uint64_t ubblock_size;
uint64_t ubbank_size;
uint64_t ubbank_num;
uint64_t ubburst_in_one_block;
uint64_t ubbank_group_num;
uint64_t vector_reg_size;
uint64_t predicate_reg_size;
uint64_t address_reg_size;
uint64_t alignment_reg_size;
} VectorCoreSpec;
typedef struct tagVectorCoreMemoryRates {
double ddrRate;
double ddrReadRate;
double ddrWriteRate;
double l2Rate;
double l2ReadRate;
double l2WriteRate;
double ubToL2Rate;
double ubToDdrRate;
typedef struct tag_vector_core_memory_rates {
double ddr_rate;
double ddr_read_rate;
double ddr_write_rate;
double l2_rate;
double l2_read_rate;
double l2_write_rate;
double ub_to_l2_rate;
double ub_to_ddr_rate;
} VectorCoreMemoryRates;
typedef struct tagCPUCache {
typedef struct tag_cpu_cache {
uint32_t AICPUSyncBySW;
uint32_t TSCPUSyncBySW;
} CPUCache;
typedef struct tagPlatformInfo {
StrInfo strInfo;
SoCInfo socInfo;
AiCoreSpec aiCoreSpec;
AiCoreMemoryRates aiCoreMemoryRates;
map<string, vector<string>> aiCoreIntrinsicDtypeMap;
VectorCoreSpec vectorCoreSpec;
VectorCoreMemoryRates vectorCoreMemoryRates;
typedef struct tag_platform_info {
StrInfo str_info;
SoCInfo soc_info;
AiCoreSpec ai_core_spec;
AiCoreMemoryRates ai_core_memory_rates;
map<string, vector<string>> ai_core_intrinsic_dtype_map;
VectorCoreSpec vector_core_spec;
VectorCoreMemoryRates vector_core_memory_rates;
CPUCache cpucache;
map<string, vector<string>> vectorCoreIntrinsicDtypeMap;
map<string, vector<string>> vector_core_intrinsic_dtype_map;
} PlatformInfo;
typedef struct tagOptionalInfo {
string socVersion;
string coreType;
uint32_t aiCoreNum;
string l1FusionFlag;
typedef struct tag_optional_info {
string soc_version;
string core_type;
uint32_t ai_core_num;
string l1_fusion_flag;
} OptionalInfo;
} // namespace fe
#endif

@ -0,0 +1,73 @@
/**
* 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_ACL_ACL_H_
#define INC_EXTERNAL_ACL_ACL_H_
#include "acl_rt.h"
#include "acl_op.h"
#include "acl_mdl.h"
#ifdef __cplusplus
extern "C" {
#endif
// Current version is 1.0.0
#define ACL_MAJOR_VERSION 1
#define ACL_MINOR_VERSION 0
#define ACL_PATCH_VERSION 0
/**
* @ingroup AscendCL
* @brief acl initialize
*
* @par Restriction
* The aclInit interface can be called only once in a process
* @param configPath [IN] the config path,it can be NULL
* @retval ACL_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath);
/**
* @ingroup AscendCL
* @brief acl finalize
*
* @par Restriction
* Need to call aclFinalize before the process exits.
* After calling aclFinalize,the services cannot continue to be used normally.
* @retval ACL_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ACL_FUNC_VISIBILITY aclError aclFinalize();
/**
* @ingroup AscendCL
* @brief query ACL interface version
*
* @param majorVersion[OUT] ACL interface major version
* @param minorVersion[OUT] ACL interface minor version
* @param patchVersion[OUT] ACL interface patch version
* @retval ACL_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ACL_FUNC_VISIBILITY aclError aclrtGetVersion(int32_t *majorVersion, int32_t *minorVersion, int32_t *patchVersion);
#ifdef __cplusplus
}
#endif
#endif // INC_EXTERNAL_ACL_ACL_H_

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

Loading…
Cancel
Save