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.

config.h 4.6 kB

5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 __CCE_RUNTIME_CONFIG_H__
  17. #define __CCE_RUNTIME_CONFIG_H__
  18. #include "base.h"
  19. #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE)
  20. extern "C" {
  21. #endif
  22. #define PLAT_COMBINE(arch, chip, ver) ((arch << 16) | (chip << 8) | (ver))
  23. #define PLAT_GET_ARCH(type) ((type >> 16) & 0xffff)
  24. #define PLAT_GET_CHIP(type) ((type >> 8) & 0xff)
  25. #define PLAT_GET_VER(type) (type & 0xff)
  26. typedef enum tagRtArchType {
  27. ARCH_BEGIN = 0,
  28. ARCH_V100 = ARCH_BEGIN,
  29. ARCH_V200,
  30. ARCH_END,
  31. } rtArchType_t;
  32. typedef enum tagRtChipType {
  33. CHIP_BEGIN = 0,
  34. CHIP_MINI = CHIP_BEGIN,
  35. CHIP_CLOUD,
  36. CHIP_MDC,
  37. CHIP_LHISI,
  38. CHIP_DC,
  39. CHIP_CLOUD_V2,
  40. CHIP_END,
  41. } rtChipType_t;
  42. typedef enum tagRtVersion {
  43. VER_BEGIN = 0,
  44. VER_NA = VER_BEGIN,
  45. VER_ES,
  46. VER_CS,
  47. VER_END,
  48. } rtVersion_t;
  49. /* match rtChipType_t */
  50. typedef enum tagRtPlatformType {
  51. PLATFORM_BEGIN = 0,
  52. PLATFORM_MINI_V1 = PLATFORM_BEGIN,
  53. PLATFORM_CLOUD_V1,
  54. PLATFORM_MINI_V2,
  55. PLATFORM_LHISI_ES,
  56. PLATFORM_LHISI_CS,
  57. PLATFORM_DC,
  58. PLATFORM_CLOUD_V2,
  59. PLATFORM_END,
  60. } rtPlatformType_t;
  61. typedef enum tagRtCubeFracMKNFp16 {
  62. RT_CUBE_MKN_FP16_2_16_16 = 0,
  63. RT_CUBE_MKN_FP16_4_16_16,
  64. RT_CUBE_MKN_FP16_16_16_16,
  65. RT_CUBE_MKN_FP16_Default,
  66. } rtCubeFracMKNFp16_t;
  67. typedef enum tagRtCubeFracMKNInt8 {
  68. RT_CUBE_MKN_INT8_2_32_16 = 0,
  69. RT_CUBE_MKN_INT8_4_32_4,
  70. RT_CUBE_MKN_INT8_4_32_16,
  71. RT_CUBE_MKN_INT8_16_32_16,
  72. RT_CUBE_MKN_INT8_Default,
  73. } rtCubeFracMKNInt8_t;
  74. typedef enum tagRtVecFracVmulMKNFp16 {
  75. RT_VEC_VMUL_MKN_FP16_1_16_16 = 0,
  76. RT_VEC_VMUL_MKN_FP16_Default,
  77. } rtVecFracVmulMKNFp16_t;
  78. typedef enum tagRtVecFracVmulMKNInt8 {
  79. RT_VEC_VMUL_MKN_INT8_1_32_16 = 0,
  80. RT_VEC_VMUL_MKN_INT8_Default,
  81. } rtVecFracVmulMKNInt8_t;
  82. typedef struct tagRtAiCoreSpec {
  83. uint32_t cubeFreq;
  84. uint32_t cubeMSize;
  85. uint32_t cubeKSize;
  86. uint32_t cubeNSize;
  87. rtCubeFracMKNFp16_t cubeFracMKNFp16;
  88. rtCubeFracMKNInt8_t cubeFracMKNInt8;
  89. rtVecFracVmulMKNFp16_t vecFracVmulMKNFp16;
  90. rtVecFracVmulMKNInt8_t vecFracVmulMKNInt8;
  91. } rtAiCoreSpec_t;
  92. typedef struct tagRtAiCoreRatesPara {
  93. uint32_t ddrRate;
  94. uint32_t l2Rate;
  95. uint32_t l2ReadRate;
  96. uint32_t l2WriteRate;
  97. uint32_t l1ToL0ARate;
  98. uint32_t l1ToL0BRate;
  99. uint32_t l0CToUBRate;
  100. uint32_t ubToL2;
  101. uint32_t ubToDDR;
  102. uint32_t ubToL1;
  103. } rtAiCoreMemoryRates_t;
  104. typedef struct tagRtMemoryConfig {
  105. uint32_t flowtableSize;
  106. uint32_t compilerSize;
  107. } rtMemoryConfig_t;
  108. typedef struct tagRtPlatformConfig {
  109. uint32_t platformConfig;
  110. } rtPlatformConfig_t;
  111. /**
  112. * @ingroup
  113. * @brief get AI core count
  114. * @param [in] aiCoreCnt
  115. * @return aiCoreCnt
  116. */
  117. RTS_API rtError_t rtGetAiCoreCount(uint32_t *aiCoreCnt);
  118. /**
  119. * @ingroup
  120. * @brief get AI cpu count
  121. * @param [in] aiCpuCnt
  122. * @return aiCpuCnt
  123. */
  124. RTS_API rtError_t rtGetAiCpuCount(uint32_t *aiCpuCnt);
  125. /**
  126. * @ingroup
  127. * @brief get AI core frequency
  128. * @param [in] aiCoreSpec
  129. * @return aiCoreSpec
  130. */
  131. RTS_API rtError_t rtGetAiCoreSpec(rtAiCoreSpec_t *aiCoreSpec);
  132. /**
  133. * @ingroup
  134. * @brief AI get core band Info
  135. * @param [in] aiCoreMemoryRates
  136. * @return aiCoreMemoryRates
  137. */
  138. RTS_API rtError_t rtGetAiCoreMemoryRates(rtAiCoreMemoryRates_t *aiCoreMemoryRates);
  139. /**
  140. * @ingroup
  141. * @brief AI get core buffer Info,FlowTable Size,Compiler Size
  142. * @param [in] memoryConfig
  143. * @return memoryConfig
  144. */
  145. RTS_API rtError_t rtGetMemoryConfig(rtMemoryConfig_t *memoryConfig);
  146. /**
  147. * @ingroup
  148. * @brief get l2 buffer Info,virtual baseaddr,Size
  149. * @param [in] stream
  150. * @return RT_ERROR_NONE for ok, errno for failed
  151. */
  152. RTS_API rtError_t rtMemGetL2Info(rtStream_t stream, void **ptr, uint32_t *size);
  153. /**
  154. * @ingroup
  155. * @brief get runtime version. The version is returned as (1000 major + 10 minor). For example, RUNTIME 9.2 would be represented by 9020.
  156. * @param [out] runtimeVersion
  157. * @return RT_ERROR_NONE for ok
  158. * @return RT_ERROR_INVALID_VALUE for error input
  159. */
  160. RTS_API rtError_t rtGetRuntimeVersion(uint32_t *runtimeVersion);
  161. #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE)
  162. }
  163. #endif
  164. #endif // __CCE_RUNTIME_STREAM_H__

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