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.

CMakeLists.txt 7.7 kB

5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 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
5 years ago
4 years ago
5 years ago
5 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
4 years ago
4 years ago
4 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. set(SRC_LIST
  2. "context/ctx.cc"
  3. "model_saver.cc"
  4. "ge/datatype_util.cc"
  5. "helper/om_file_helper.cc"
  6. "helper/model_helper.cc"
  7. "../model/ge_model.cc"
  8. "../model/ge_root_model.cc"
  9. "auth/file_saver.cc"
  10. "fp16_t.cc"
  11. "math/fp16_math.cc"
  12. "debug/memory_dumper.cc"
  13. "formats/utils/formats_trans_utils.cc"
  14. "dump/dump_properties.cc"
  15. "formats/format_transfers/datatype_transfer.cc"
  16. "formats/format_transfers/format_transfer_transpose.cc"
  17. "formats/format_transfers/format_transfer_nchw_nc1hwc0.cc"
  18. "formats/format_transfers/format_transfer_fractal_z.cc"
  19. "formats/format_transfers/format_transfer_fractal_nz.cc"
  20. "formats/format_transfers/format_transfer_fractal_zz.cc"
  21. "formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc"
  22. "formats/format_transfers/format_transfer_nc1hwc0_nchw.cc"
  23. "formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc"
  24. "formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc"
  25. "formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc"
  26. "formats/format_transfers/format_transfer_fracz_nchw.cc"
  27. "formats/format_transfers/format_transfer_fracz_nhwc.cc"
  28. "formats/format_transfers/format_transfer_fracz_hwcn.cc"
  29. "formats/format_transfers/format_transfer_dhwcn_fracz3D.cc"
  30. "formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc"
  31. "formats/format_transfers/format_transfer_nchw_fz_c04.cc"
  32. "formats/formats.cc"
  33. "ge_format_util.cc"
  34. "fmk_error_codes.cc"
  35. "util.cc"
  36. "properties_manager.cc"
  37. "types.cc"
  38. "model_parser/model_parser.cc"
  39. "kernel_store.cc"
  40. "tbe_kernel_store.cc"
  41. "cust_aicpu_kernel_store.cc"
  42. "op/attr_value_util.cc"
  43. "op/ge_op_utils.cc"
  44. "thread_pool.cc"
  45. "ge/tbe_plugin_manager.cc"
  46. "ge_opt_info.cc"
  47. )
  48. if (NOT ENABLE_D AND NOT ENABLE_ACL)
  49. ############ libge_common.so ############
  50. add_library(ge_common SHARED ${SRC_LIST})
  51. add_dependencies(ge_common
  52. graphengine_protos
  53. )
  54. target_compile_definitions(ge_common PRIVATE
  55. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  56. HOST_VISIBILITY
  57. FMK_SUPPORT_DUMP
  58. OS_CENTOS
  59. google=ascend_private
  60. FUNC_VISIBILITY
  61. )
  62. target_compile_options(ge_common PRIVATE
  63. -fvisibility=hidden
  64. -O2
  65. -Werror
  66. -Wno-deprecated-declarations
  67. -fno-common
  68. )
  69. target_include_directories(ge_common PRIVATE
  70. ${GE_CODE_DIR}/ge
  71. ${GE_CODE_DIR}/ge/common
  72. ${GE_CODE_DIR}/ge/common/op
  73. ${GE_CODE_DIR}/inc/external
  74. ${GE_CODE_DIR}/inc
  75. ${GE_CODE_DIR}/inc/framework
  76. ${METADEF_DIR}/inc
  77. ${METADEF_DIR}/inc/external
  78. ${METADEF_DIR}/inc/external/graph
  79. ${METADEF_DIR}/inc/graph
  80. ${CMAKE_BINARY_DIR}
  81. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  82. #### yellow zone ####
  83. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  84. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc/cce>
  85. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/abl/licctrl>
  86. #### blue zone ####
  87. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  88. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  89. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info>
  90. )
  91. target_link_options(ge_common PRIVATE
  92. -Wl,-Bsymbolic
  93. )
  94. target_link_libraries(ge_common PRIVATE
  95. $<BUILD_INTERFACE:intf_pub>
  96. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  97. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  98. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  99. static_mmpa
  100. -Wl,--no-as-needed
  101. graph
  102. ascend_protobuf
  103. register
  104. c_sec
  105. error_manager
  106. slog
  107. opt_feature
  108. -Wl,--as-needed
  109. json
  110. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  111. -ldl
  112. )
  113. ############ libge_common.a ############
  114. add_library(ge_common_static STATIC ${SRC_LIST})
  115. add_dependencies(ge_common_static
  116. graphengine_protos
  117. )
  118. target_compile_definitions(ge_common_static PRIVATE
  119. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  120. HOST_VISIBILITY
  121. FMK_SUPPORT_DUMP
  122. OS_CENTOS
  123. google=ascend_private
  124. $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
  125. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
  126. LOG_CPP
  127. FUNC_VISIBILITY
  128. )
  129. target_compile_options(ge_common_static PRIVATE
  130. $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common>
  131. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  132. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  133. )
  134. target_include_directories(ge_common_static PRIVATE
  135. ${GE_CODE_DIR}/ge
  136. ${GE_CODE_DIR}/ge/common
  137. ${GE_CODE_DIR}/ge/common/op
  138. ${GE_CODE_DIR}/inc
  139. ${GE_CODE_DIR}/inc/external
  140. ${GE_CODE_DIR}/inc/framework
  141. ${METADEF_DIR}/inc
  142. ${METADEF_DIR}/inc/external
  143. ${METADEF_DIR}/inc/external/graph
  144. ${METADEF_DIR}/inc/graph
  145. ${CMAKE_BINARY_DIR}
  146. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  147. #### yellow zone ####
  148. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  149. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc/cce>
  150. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/abl/licctrl>
  151. #### blue zone ####
  152. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  153. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  154. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info>
  155. )
  156. target_link_libraries(ge_common_static PRIVATE
  157. $<BUILD_INTERFACE:intf_pub>
  158. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  159. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  160. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  161. ascend_protobuf_static
  162. json
  163. c_sec
  164. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  165. -ldl
  166. )
  167. else ()
  168. ############ libge_common.so w/static protobuf ############
  169. add_library(ge_common SHARED ${SRC_LIST})
  170. add_dependencies(ge_common
  171. graphengine_protos
  172. )
  173. target_compile_definitions(ge_common PRIVATE
  174. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  175. HOST_VISIBILITY
  176. FMK_SUPPORT_DUMP
  177. OS_CENTOS
  178. google=ascend_private
  179. LOG_CPP
  180. FUNC_VISIBILITY
  181. )
  182. target_compile_options(ge_common PRIVATE
  183. -fvisibility=hidden
  184. -O2
  185. -Werror
  186. -Wno-deprecated-declarations
  187. -fno-common
  188. )
  189. target_include_directories(ge_common PRIVATE
  190. ${GE_CODE_DIR}/ge
  191. ${GE_CODE_DIR}/ge/common
  192. ${GE_CODE_DIR}/ge/common/op
  193. ${GE_CODE_DIR}/inc/external
  194. ${GE_CODE_DIR}/inc
  195. ${GE_CODE_DIR}/inc/framework
  196. ${METADEF_DIR}/inc
  197. ${METADEF_DIR}/inc/external
  198. ${METADEF_DIR}/inc/external/graph
  199. ${METADEF_DIR}/inc/graph
  200. ${CMAKE_BINARY_DIR}
  201. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  202. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  203. ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
  204. ${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info
  205. )
  206. target_link_options(ge_common PRIVATE
  207. -Wl,-Bsymbolic
  208. )
  209. target_link_libraries(ge_common PRIVATE
  210. $<BUILD_INTERFACE:intf_pub>
  211. ascend_protobuf_static
  212. -Wl,--no-as-needed
  213. graph
  214. register
  215. c_sec
  216. error_manager
  217. slog
  218. opt_feature
  219. static_mmpa
  220. -Wl,--as-needed
  221. json
  222. -lrt
  223. -ldl
  224. )
  225. endif ()
  226. ############ install ############
  227. set(INSTALL_BASE_DIR "")
  228. set(INSTALL_LIBRARY_DIR lib)
  229. install(TARGETS ge_common OPTIONAL
  230. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
  231. )

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