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

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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. set(SRC_LIST
  19. "context/ctx.cc"
  20. "model_saver.cc"
  21. "ge/datatype_util.cc"
  22. "helper/om_file_helper.cc"
  23. "helper/model_helper.cc"
  24. "../model/ge_model.cc"
  25. "../model/ge_root_model.cc"
  26. "auth/file_saver.cc"
  27. "fp16_t.cc"
  28. "math/fp16_math.cc"
  29. "debug/memory_dumper.cc"
  30. "formats/utils/formats_trans_utils.cc"
  31. "dump/dump_properties.cc"
  32. "formats/format_transfers/datatype_transfer.cc"
  33. "formats/format_transfers/format_transfer_transpose.cc"
  34. "formats/format_transfers/format_transfer_nchw_nc1hwc0.cc"
  35. "formats/format_transfers/format_transfer_fractal_z.cc"
  36. "formats/format_transfers/format_transfer_fractal_nz.cc"
  37. "formats/format_transfers/format_transfer_fractal_zz.cc"
  38. "formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc"
  39. "formats/format_transfers/format_transfer_nc1hwc0_nchw.cc"
  40. "formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc"
  41. "formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc"
  42. "formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc"
  43. "formats/format_transfers/format_transfer_fracz_nchw.cc"
  44. "formats/format_transfers/format_transfer_fracz_nhwc.cc"
  45. "formats/format_transfers/format_transfer_fracz_hwcn.cc"
  46. "formats/format_transfers/format_transfer_dhwcn_fracz3D.cc"
  47. "formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc"
  48. "formats/format_transfers/format_transfer_nchw_fz_c04.cc"
  49. "formats/formats.cc"
  50. "ge_format_util.cc"
  51. "fmk_error_codes.cc"
  52. "util.cc"
  53. "properties_manager.cc"
  54. "types.cc"
  55. "model_parser/base.cc"
  56. "kernel_store.cc"
  57. "tbe_kernel_store.cc"
  58. "cust_aicpu_kernel_store.cc"
  59. "op/attr_value_util.cc"
  60. "op/ge_op_utils.cc"
  61. "thread_pool.cc"
  62. "ge/tbe_plugin_manager.cc"
  63. )
  64. if (NOT ENABLE_D AND NOT ENABLE_ACL)
  65. ############ libge_common.so ############
  66. add_library(ge_common SHARED ${SRC_LIST} ${PROTO_HDRS})
  67. target_compile_definitions(ge_common PRIVATE
  68. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  69. HOST_VISIBILITY
  70. FMK_SUPPORT_DUMP
  71. OS_CENTOS
  72. google=ascend_private
  73. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  74. )
  75. target_compile_options(ge_common PRIVATE
  76. -fvisibility=hidden
  77. -O2
  78. -Werror
  79. -Wno-deprecated-declarations
  80. -fno-common
  81. )
  82. target_include_directories(ge_common PRIVATE
  83. ${GE_CODE_DIR}/ge
  84. ${GE_CODE_DIR}/ge/common
  85. ${GE_CODE_DIR}/ge/common/op
  86. ${GE_CODE_DIR}/inc/external
  87. ${GE_CODE_DIR}/inc
  88. ${GE_CODE_DIR}/inc/framework
  89. ${METADEF_DIR}/inc
  90. ${METADEF_DIR}/inc/external
  91. ${METADEF_DIR}/inc/external/graph
  92. ${METADEF_DIR}/inc/graph
  93. ${CMAKE_BINARY_DIR}
  94. ${CMAKE_BINARY_DIR}/proto/ge
  95. #### yellow zone ####
  96. ${GE_DEPEND_DIR}/inc
  97. ${GE_DEPEND_DIR}/inc/cce
  98. #### blue zone ####
  99. #${GE_DEPEND_DIR}/include
  100. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  101. ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
  102. )
  103. target_link_libraries(ge_common PRIVATE
  104. $<BUILD_INTERFACE:intf_pub>
  105. static_mmpa
  106. -Wl,--no-as-needed
  107. graph
  108. ascend_protobuf
  109. register
  110. c_sec
  111. error_manager
  112. slog
  113. -Wl,--as-needed
  114. json
  115. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  116. -ldl
  117. )
  118. ############ libge_common.a ############
  119. add_library(ge_common_static STATIC ${SRC_LIST} ${PROTO_HDRS})
  120. target_compile_definitions(ge_common_static PRIVATE
  121. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  122. HOST_VISIBILITY
  123. FMK_SUPPORT_DUMP
  124. OS_CENTOS
  125. google=ascend_private
  126. $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
  127. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
  128. LOG_CPP
  129. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  130. )
  131. target_compile_options(ge_common_static PRIVATE
  132. $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common>
  133. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  134. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  135. )
  136. target_include_directories(ge_common_static PRIVATE
  137. ${GE_CODE_DIR}/ge
  138. ${GE_CODE_DIR}/ge/common
  139. ${GE_CODE_DIR}/ge/common/op
  140. ${GE_CODE_DIR}/inc
  141. ${GE_CODE_DIR}/inc/external
  142. ${GE_CODE_DIR}/inc/framework
  143. ${METADEF_DIR}/inc
  144. ${METADEF_DIR}/inc/external
  145. ${METADEF_DIR}/inc/external/graph
  146. ${METADEF_DIR}/inc/graph
  147. ${CMAKE_BINARY_DIR}
  148. ${CMAKE_BINARY_DIR}/proto/ge
  149. #### yellow zone ####
  150. ${GE_DEPEND_DIR}/inc
  151. ${GE_DEPEND_DIR}/inc/cce
  152. #### blue zone ####
  153. #${GE_DEPEND_DIR}/include
  154. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  155. ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
  156. )
  157. target_link_libraries(ge_common_static PRIVATE
  158. $<BUILD_INTERFACE:intf_pub>
  159. ascend_protobuf
  160. json
  161. c_sec
  162. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  163. -ldl
  164. )
  165. else ()
  166. ############ libge_common.so w/static protobuf ############
  167. add_library(ge_common SHARED ${SRC_LIST} ${PROTO_HDRS})
  168. target_compile_definitions(ge_common PRIVATE
  169. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  170. HOST_VISIBILITY
  171. FMK_SUPPORT_DUMP
  172. OS_CENTOS
  173. google=ascend_private
  174. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  175. )
  176. target_compile_options(ge_common PRIVATE
  177. -fvisibility=hidden
  178. -O2
  179. -Werror
  180. )
  181. target_include_directories(ge_common PRIVATE
  182. ${GE_CODE_DIR}/ge
  183. ${GE_CODE_DIR}/ge/common
  184. ${GE_CODE_DIR}/ge/common/op
  185. ${GE_CODE_DIR}/inc/external
  186. ${GE_CODE_DIR}/inc
  187. ${GE_CODE_DIR}/inc/framework
  188. ${METADEF_DIR}/inc
  189. ${METADEF_DIR}/inc/external
  190. ${METADEF_DIR}/inc/external/graph
  191. ${METADEF_DIR}/inc/graph
  192. ${CMAKE_BINARY_DIR}
  193. ${CMAKE_BINARY_DIR}/proto/ge
  194. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  195. ${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
  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两部分组成,详细的架构图如下所示