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

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

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