!24 Update GraphEngine to synchronize with latest Ascend driver software suite 9 May 2020
Merge pull request !24 from yanghaoran/masterpull/24/MERGE
commit
cf29b3d853
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* 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 PLATFORM_INFO_H
|
||||||
|
#define PLATFORM_INFO_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "platform_info_def.h"
|
||||||
|
|
||||||
|
using std::map;
|
||||||
|
using std::string;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
namespace fe {
|
||||||
|
|
||||||
|
class PlatformInfoManager {
|
||||||
|
public:
|
||||||
|
PlatformInfoManager(const PlatformInfoManager &) = delete;
|
||||||
|
PlatformInfoManager &operator=(const PlatformInfoManager &) = delete;
|
||||||
|
|
||||||
|
static PlatformInfoManager &Instance();
|
||||||
|
uint32_t InitializePlatformInfo();
|
||||||
|
uint32_t Finalize();
|
||||||
|
|
||||||
|
uint32_t GetPlatformInfo(const string SoCVersion, PlatformInfo &platformInfo, OptionalInfo &optiCompilationInfo);
|
||||||
|
|
||||||
|
void SetOptionalCompilationInfo(OptionalInfo &optiCompilationInfo);
|
||||||
|
|
||||||
|
private:
|
||||||
|
PlatformInfoManager();
|
||||||
|
~PlatformInfoManager();
|
||||||
|
|
||||||
|
uint32_t LoadIniFile(string iniFileRealPath);
|
||||||
|
|
||||||
|
void Trim(string &str);
|
||||||
|
|
||||||
|
uint32_t LoadConfigFile(string realPath);
|
||||||
|
|
||||||
|
string RealPath(const std::string &path);
|
||||||
|
|
||||||
|
string GetSoFilePath();
|
||||||
|
|
||||||
|
void ParseVersion(map<string, string> &versionMap, string &socVersion, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseSocInfo(map<string, string> &socInfoMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseCubeOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseBufferOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseUBOfAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseAICoreSpec(map<string, string> &aiCoreSpecMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseBufferOfAICoreMemoryRates(map<string, string> &aiCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseAICoreMemoryRates(map<string, string> &aiCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseUBOfAICoreMemoryRates(map<string, string> &aiCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseAICoreintrinsicDtypeMap(map<string, string> &aiCoreintrinsicDtypeMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseVectorCoreSpec(map<string, string> &vectorCoreSpecMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseVectorCoreMemoryRates(map<string, string> &vectorCoreMemoryRatesMap, PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
void ParseVectorCoreintrinsicDtypeMap(map<string, string> &vectorCoreintrinsicDtypeMap,
|
||||||
|
PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
uint32_t ParsePlatformInfoFromStrToStruct(map<string, map<string, string>> &contentInfoMap, string &socVersion,
|
||||||
|
PlatformInfo &platformInfoTemp);
|
||||||
|
|
||||||
|
uint32_t AssemblePlatformInfoVector(map<string, map<string, string>> &contentInfoMap);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool initFlag_;
|
||||||
|
map<string, PlatformInfo> platformInfoMap_;
|
||||||
|
OptionalInfo optiCompilationInfo_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace fe
|
||||||
|
#endif
|
@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* 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 PLATFORM_INFO_DEF_H
|
||||||
|
#define PLATFORM_INFO_DEF_H
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using std::map;
|
||||||
|
using std::string;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
namespace fe {
|
||||||
|
enum MemoryType { DDR = 0, HBM };
|
||||||
|
|
||||||
|
enum L2Type { Cache = 0, Buff };
|
||||||
|
|
||||||
|
typedef struct tagStrInfo {
|
||||||
|
string aicVersion;
|
||||||
|
string ccecAICVersion;
|
||||||
|
string ccecAIVVersion;
|
||||||
|
string isSupportAIcpuCompiler;
|
||||||
|
} StrInfo;
|
||||||
|
|
||||||
|
typedef struct tagSoCInfo {
|
||||||
|
uint32_t aiCoreCnt;
|
||||||
|
uint32_t vectorCoreCnt;
|
||||||
|
uint32_t aiCpuCnt;
|
||||||
|
MemoryType memoryType;
|
||||||
|
uint64_t memorySize;
|
||||||
|
L2Type l2Type;
|
||||||
|
uint64_t l2Size;
|
||||||
|
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;
|
||||||
|
} AiCoreSpec;
|
||||||
|
|
||||||
|
typedef struct tagAiCoreMemoryRates {
|
||||||
|
double ddrRate;
|
||||||
|
double l2Rate;
|
||||||
|
double l2ReadRate;
|
||||||
|
double l2WriteRate;
|
||||||
|
double l1ToL0ARate;
|
||||||
|
double l1ToL0BRate;
|
||||||
|
double l1ToUBRate;
|
||||||
|
double l0CToUBRate;
|
||||||
|
double ubToL2Rate;
|
||||||
|
double ubToDdrRate;
|
||||||
|
double ubToL1Rate;
|
||||||
|
} AiCoreMemoryRates;
|
||||||
|
|
||||||
|
typedef struct tagVectorCoreSpec {
|
||||||
|
uint64_t vecCalcSize;
|
||||||
|
uint64_t smaskBuffer;
|
||||||
|
uint64_t ubSize;
|
||||||
|
uint64_t ubblockSize;
|
||||||
|
uint64_t ubbankSize;
|
||||||
|
uint64_t ubbankNum;
|
||||||
|
uint64_t ubburstInOneBlock;
|
||||||
|
uint64_t ubbankGroupNum;
|
||||||
|
} VectorCoreSpec;
|
||||||
|
|
||||||
|
typedef struct tagVectorCoreMemoryRates {
|
||||||
|
double ddrRate;
|
||||||
|
double l2Rate;
|
||||||
|
double l2ReadRate;
|
||||||
|
double l2WriteRate;
|
||||||
|
double ubToL2Rate;
|
||||||
|
double ubToDdrRate;
|
||||||
|
} VectorCoreMemoryRates;
|
||||||
|
|
||||||
|
typedef struct tagPlatformInfo {
|
||||||
|
StrInfo strInfo;
|
||||||
|
SoCInfo socInfo;
|
||||||
|
AiCoreSpec aiCoreSpec;
|
||||||
|
AiCoreMemoryRates aiCoreMemoryRates;
|
||||||
|
map<string, vector<string>> aiCoreIntrinsicDtypeMap;
|
||||||
|
VectorCoreSpec vectorCoreSpec;
|
||||||
|
VectorCoreMemoryRates vectorCoreMemoryRates;
|
||||||
|
map<string, vector<string>> vectorCoreIntrinsicDtypeMap;
|
||||||
|
} PlatformInfo;
|
||||||
|
|
||||||
|
typedef struct tagOptionalInfo {
|
||||||
|
string socVersion;
|
||||||
|
string coreType;
|
||||||
|
uint32_t aiCoreNum;
|
||||||
|
string l1FusionFlag;
|
||||||
|
} OptionalInfo;
|
||||||
|
} // namespace fe
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue