You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

platform_info_def.h 3.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /**
  2. * Copyright 2019-2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef PLATFORM_INFO_DEF_H
  17. #define PLATFORM_INFO_DEF_H
  18. #include <map>
  19. #include <string>
  20. #include <vector>
  21. using std::map;
  22. using std::string;
  23. using std::vector;
  24. namespace fe {
  25. enum MemoryType { DDR = 0, HBM };
  26. enum L2Type { Cache = 0, Buff };
  27. typedef struct tagStrInfo {
  28. string aicVersion;
  29. string ccecAICVersion;
  30. string ccecAIVVersion;
  31. string isSupportAIcpuCompiler;
  32. } StrInfo;
  33. typedef struct tagSoCInfo {
  34. uint32_t aiCoreCnt;
  35. uint32_t vectorCoreCnt;
  36. uint32_t aiCpuCnt;
  37. MemoryType memoryType;
  38. uint64_t memorySize;
  39. L2Type l2Type;
  40. uint64_t l2Size;
  41. uint32_t l2PageNum;
  42. } SoCInfo;
  43. typedef struct tagAiCoreSpec {
  44. double cubeFreq;
  45. uint64_t cubeMSize;
  46. uint64_t cubeNSize;
  47. uint64_t cubeKSize;
  48. uint64_t vecCalcSize;
  49. uint64_t l0ASize;
  50. uint64_t l0BSize;
  51. uint64_t l0CSize;
  52. uint64_t l1Size;
  53. uint64_t smaskBuffer;
  54. uint64_t ubSize;
  55. uint64_t ubblockSize;
  56. uint64_t ubbankSize;
  57. uint64_t ubbankNum;
  58. uint64_t ubburstInOneBlock;
  59. uint64_t ubbankGroupNum;
  60. uint32_t unzipEngines;
  61. uint32_t unzipMaxRatios;
  62. uint32_t unzipChannels;
  63. uint8_t unzipIsTight;
  64. } AiCoreSpec;
  65. typedef struct tagAiCoreMemoryRates {
  66. double ddrRate;
  67. double ddrReadRate;
  68. double ddrWriteRate;
  69. double l2Rate;
  70. double l2ReadRate;
  71. double l2WriteRate;
  72. double l1ToL0ARate;
  73. double l1ToL0BRate;
  74. double l1ToUBRate;
  75. double l0CToUBRate;
  76. double ubToL2Rate;
  77. double ubToDdrRate;
  78. double ubToL1Rate;
  79. } AiCoreMemoryRates;
  80. typedef struct tagVectorCoreSpec {
  81. double vecFreq;
  82. uint64_t vecCalcSize;
  83. uint64_t smaskBuffer;
  84. uint64_t ubSize;
  85. uint64_t ubblockSize;
  86. uint64_t ubbankSize;
  87. uint64_t ubbankNum;
  88. uint64_t ubburstInOneBlock;
  89. uint64_t ubbankGroupNum;
  90. uint64_t vectorRegSize;
  91. uint64_t predicateRegSize;
  92. uint64_t addressRegSize;
  93. } VectorCoreSpec;
  94. typedef struct tagVectorCoreMemoryRates {
  95. double ddrRate;
  96. double ddrReadRate;
  97. double ddrWriteRate;
  98. double l2Rate;
  99. double l2ReadRate;
  100. double l2WriteRate;
  101. double ubToL2Rate;
  102. double ubToDdrRate;
  103. } VectorCoreMemoryRates;
  104. typedef struct tagCPUCache {
  105. uint32_t AICPUSyncBySW;
  106. uint32_t TSCPUSyncBySW;
  107. } CPUCache;
  108. typedef struct tagPlatformInfo {
  109. StrInfo strInfo;
  110. SoCInfo socInfo;
  111. AiCoreSpec aiCoreSpec;
  112. AiCoreMemoryRates aiCoreMemoryRates;
  113. map<string, vector<string>> aiCoreIntrinsicDtypeMap;
  114. VectorCoreSpec vectorCoreSpec;
  115. VectorCoreMemoryRates vectorCoreMemoryRates;
  116. CPUCache cpucache;
  117. map<string, vector<string>> vectorCoreIntrinsicDtypeMap;
  118. } PlatformInfo;
  119. typedef struct tagOptionalInfo {
  120. string socVersion;
  121. string coreType;
  122. uint32_t aiCoreNum;
  123. string l1FusionFlag;
  124. } OptionalInfo;
  125. } // namespace fe
  126. #endif

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示