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 6.7 kB

4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. )
  47. if (NOT ENABLE_D AND NOT ENABLE_ACL)
  48. ############ libge_common.so ############
  49. add_library(ge_common SHARED ${SRC_LIST})
  50. add_dependencies(ge_common
  51. graphengine_protos
  52. )
  53. target_compile_definitions(ge_common PRIVATE
  54. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  55. HOST_VISIBILITY
  56. FMK_SUPPORT_DUMP
  57. OS_CENTOS
  58. google=ascend_private
  59. FUNC_VISIBILITY
  60. )
  61. target_compile_options(ge_common PRIVATE
  62. -fvisibility=hidden
  63. -O2
  64. -Werror
  65. -Wno-deprecated-declarations
  66. -fno-common
  67. )
  68. target_include_directories(ge_common PRIVATE
  69. ${GE_CODE_DIR}/ge
  70. ${GE_CODE_DIR}/inc/external
  71. ${GE_CODE_DIR}/inc
  72. ${GE_CODE_DIR}/inc/framework
  73. ${METADEF_DIR}/inc
  74. ${METADEF_DIR}/inc/external
  75. ${CMAKE_BINARY_DIR}
  76. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  77. #### yellow zone ####
  78. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  79. #### blue zone ####
  80. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  81. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  82. )
  83. target_link_options(ge_common PRIVATE
  84. -Wl,-Bsymbolic
  85. )
  86. target_link_libraries(ge_common PRIVATE
  87. $<BUILD_INTERFACE:intf_pub>
  88. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  89. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  90. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  91. static_mmpa
  92. -Wl,--no-as-needed
  93. graph
  94. ascend_protobuf
  95. register
  96. c_sec
  97. error_manager
  98. slog
  99. -Wl,--as-needed
  100. json
  101. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  102. -ldl
  103. )
  104. ############ libge_common.a ############
  105. add_library(ge_common_static STATIC ${SRC_LIST})
  106. add_dependencies(ge_common_static
  107. graphengine_protos
  108. )
  109. target_compile_definitions(ge_common_static PRIVATE
  110. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  111. HOST_VISIBILITY
  112. FMK_SUPPORT_DUMP
  113. OS_CENTOS
  114. google=ascend_private
  115. $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
  116. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
  117. LOG_CPP
  118. FUNC_VISIBILITY
  119. )
  120. target_compile_options(ge_common_static PRIVATE
  121. $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common>
  122. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  123. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  124. )
  125. target_include_directories(ge_common_static PRIVATE
  126. ${GE_CODE_DIR}/ge
  127. ${GE_CODE_DIR}/inc
  128. ${GE_CODE_DIR}/inc/external
  129. ${GE_CODE_DIR}/inc/framework
  130. ${METADEF_DIR}/inc
  131. ${METADEF_DIR}/inc/external
  132. ${CMAKE_BINARY_DIR}
  133. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  134. #### yellow zone ####
  135. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  136. #### blue zone ####
  137. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  138. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  139. )
  140. target_link_libraries(ge_common_static PRIVATE
  141. $<BUILD_INTERFACE:intf_pub>
  142. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  143. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  144. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  145. ascend_protobuf_static
  146. json
  147. c_sec
  148. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  149. -ldl
  150. )
  151. else ()
  152. ############ libge_common.so w/static protobuf ############
  153. add_library(ge_common SHARED ${SRC_LIST})
  154. add_dependencies(ge_common
  155. graphengine_protos
  156. )
  157. target_compile_definitions(ge_common PRIVATE
  158. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  159. HOST_VISIBILITY
  160. FMK_SUPPORT_DUMP
  161. OS_CENTOS
  162. google=ascend_private
  163. LOG_CPP
  164. FUNC_VISIBILITY
  165. )
  166. target_compile_options(ge_common PRIVATE
  167. -fvisibility=hidden
  168. -O2
  169. -Werror
  170. -Wno-deprecated-declarations
  171. -fno-common
  172. )
  173. target_include_directories(ge_common PRIVATE
  174. ${GE_CODE_DIR}/ge
  175. ${GE_CODE_DIR}/inc/external
  176. ${GE_CODE_DIR}/inc
  177. ${GE_CODE_DIR}/inc/framework
  178. ${METADEF_DIR}/inc
  179. ${METADEF_DIR}/inc/external
  180. ${CMAKE_BINARY_DIR}
  181. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  182. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  183. ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
  184. )
  185. target_link_options(ge_common PRIVATE
  186. -Wl,-Bsymbolic
  187. )
  188. target_link_libraries(ge_common PRIVATE
  189. $<BUILD_INTERFACE:intf_pub>
  190. ascend_protobuf_static
  191. -Wl,--no-as-needed
  192. graph
  193. register
  194. c_sec
  195. error_manager
  196. slog
  197. static_mmpa
  198. -Wl,--as-needed
  199. json
  200. -lrt
  201. -ldl
  202. )
  203. endif ()
  204. ############ install ############
  205. set(INSTALL_BASE_DIR "")
  206. set(INSTALL_LIBRARY_DIR lib)
  207. install(TARGETS ge_common OPTIONAL
  208. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
  209. )

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