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

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

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