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.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 tag_str_info {
  28. string aic_version;
  29. string ccec_aic_version;
  30. string ccec_aiv_version;
  31. string is_support_ai_cpu_compiler;
  32. } StrInfo;
  33. typedef struct tag_so_c_info {
  34. uint32_t ai_core_cnt;
  35. uint32_t vector_core_cnt;
  36. uint32_t ai_cpu_cnt;
  37. MemoryType memory_type;
  38. uint64_t memory_size;
  39. L2Type l2_type;
  40. uint64_t l2_size;
  41. uint32_t l2PageNum;
  42. } SoCInfo;
  43. typedef struct tag_ai_core_spec {
  44. double cube_freq;
  45. uint64_t cube_m_size;
  46. uint64_t cube_n_size;
  47. uint64_t cube_k_size;
  48. uint64_t vec_calc_size;
  49. uint64_t l0_a_size;
  50. uint64_t l0_b_size;
  51. uint64_t l0_c_size;
  52. uint64_t l1_size;
  53. uint64_t smask_buffer;
  54. uint64_t ub_size;
  55. uint64_t ubblock_size;
  56. uint64_t ubbank_size;
  57. uint64_t ubbank_num;
  58. uint64_t ubburst_in_one_block;
  59. uint64_t ubbank_group_num;
  60. uint32_t unzip_engines;
  61. uint32_t unzip_max_ratios;
  62. uint32_t unzip_channels;
  63. uint8_t unzip_is_tight;
  64. uint8_t cube_vector_split;
  65. } AiCoreSpec;
  66. typedef struct tag_ai_core_memory_rates {
  67. double ddr_rate;
  68. double ddr_read_rate;
  69. double ddr_write_rate;
  70. double l2_rate;
  71. double l2_read_rate;
  72. double l2_write_rate;
  73. double l1_to_l0_a_rate;
  74. double l1_to_l0_b_rate;
  75. double l1_to_ub_rate;
  76. double l0_c_to_ub_rate;
  77. double ub_to_l2_rate;
  78. double ub_to_ddr_rate;
  79. double ub_to_l1_rate;
  80. } AiCoreMemoryRates;
  81. typedef struct tag_vector_core_spec {
  82. double vec_freq;
  83. uint64_t vec_calc_size;
  84. uint64_t smask_buffer;
  85. uint64_t ub_size;
  86. uint64_t ubblock_size;
  87. uint64_t ubbank_size;
  88. uint64_t ubbank_num;
  89. uint64_t ubburst_in_one_block;
  90. uint64_t ubbank_group_num;
  91. uint64_t vector_reg_size;
  92. uint64_t predicate_reg_size;
  93. uint64_t address_reg_size;
  94. uint64_t alignment_reg_size;
  95. } VectorCoreSpec;
  96. typedef struct tag_vector_core_memory_rates {
  97. double ddr_rate;
  98. double ddr_read_rate;
  99. double ddr_write_rate;
  100. double l2_rate;
  101. double l2_read_rate;
  102. double l2_write_rate;
  103. double ub_to_l2_rate;
  104. double ub_to_ddr_rate;
  105. } VectorCoreMemoryRates;
  106. typedef struct tag_cpu_cache {
  107. uint32_t AICPUSyncBySW;
  108. uint32_t TSCPUSyncBySW;
  109. } CPUCache;
  110. typedef struct tag_platform_info {
  111. StrInfo str_info;
  112. SoCInfo soc_info;
  113. AiCoreSpec ai_core_spec;
  114. AiCoreMemoryRates ai_core_memory_rates;
  115. map<string, vector<string>> ai_core_intrinsic_dtype_map;
  116. VectorCoreSpec vector_core_spec;
  117. VectorCoreMemoryRates vector_core_memory_rates;
  118. CPUCache cpucache;
  119. map<string, vector<string>> vector_core_intrinsic_dtype_map;
  120. } PlatformInfo;
  121. typedef struct tag_optional_info {
  122. string soc_version;
  123. string core_type;
  124. uint32_t ai_core_num;
  125. string l1_fusion_flag;
  126. } OptionalInfo;
  127. } // namespace fe
  128. #endif

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