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

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
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
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. )
  7. set(DUMP_PROTO_LIST
  8. "${METADEF_DIR}/proto/dump_task.proto"
  9. "${METADEF_DIR}/proto/op_mapping_info.proto"
  10. )
  11. protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})
  12. protobuf_generate(ge_static PROTO_STATIC_SRCS PROTO_STATIC_HDRS ${PROTO_LIST})
  13. protobuf_generate(ge_dump DUMP_PROTO_SRCS DUMP_PROTO_HDRS ${DUMP_PROTO_LIST})
  14. ############ libge_proto_dump.a ############
  15. add_library(ge_proto_dump STATIC
  16. ${DUMP_PROTO_SRCS}
  17. )
  18. target_compile_definitions(ge_proto_dump PRIVATE
  19. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  20. google=ascend_private
  21. $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
  22. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
  23. )
  24. target_compile_options(ge_proto_dump PRIVATE
  25. -O2
  26. -fno-common
  27. -fvisibility=hidden
  28. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  29. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  30. )
  31. target_link_libraries(ge_proto_dump PRIVATE
  32. $<BUILD_INTERFACE:intf_pub>
  33. ascend_protobuf_static
  34. )
  35. target_link_options(ge_proto_dump PRIVATE
  36. -Wl,-Bsymbolic
  37. )
  38. ##################################################################
  39. set(SRC_LIST
  40. "ge_executor.cc"
  41. "../common/profiling/profiling_manager.cc"
  42. "../common/ge/plugin_manager.cc"
  43. "../common/ge/op_tiling_manager.cc"
  44. "../common/dump/dump_properties.cc"
  45. "../common/dump/exception_dumper.cc"
  46. "../common/dump/dump_manager.cc"
  47. "../common/dump/dump_op.cc"
  48. "../common/dump/opdebug_register.cc"
  49. "../common/profiling/ge_profiling.cc"
  50. "../graph/load/graph_loader.cc"
  51. "../graph/execute/graph_execute.cc"
  52. "../omm/csa_interact.cc"
  53. "../graph/manager/graph_manager_utils.cc"
  54. "../graph/manager/graph_var_manager.cc"
  55. "../graph/manager/graph_mem_allocator.cc"
  56. "../graph/manager/graph_caching_allocator.cc"
  57. "../graph/manager/trans_var_data_utils.cc"
  58. "../graph/manager/util/debug.cc"
  59. "../graph/manager/rdma_pool_allocator.cc"
  60. "../graph/manager/host_mem_allocator.cc"
  61. "../hybrid/node_executor/aicpu/aicpu_ext_info.cc"
  62. "../model/ge_model.cc"
  63. "../model/ge_root_model.cc"
  64. "../graph/load/model_manager/davinci_model.cc"
  65. "../graph/load/model_manager/model_manager.cc"
  66. "../graph/load/model_manager/tbe_handle_store.cc"
  67. "../graph/load/model_manager/cpu_queue_schedule.cc"
  68. "../graph/load/model_manager/model_utils.cc"
  69. "../graph/load/model_manager/aipp_utils.cc"
  70. "../graph/load/model_manager/data_inputer.cc"
  71. "../graph/load/model_manager/data_dumper.cc"
  72. "../graph/load/model_manager/zero_copy_task.cc"
  73. "../graph/load/model_manager/zero_copy_offset.cc"
  74. "../graph/load/model_manager/task_info/task_info.cc"
  75. "../graph/load/model_manager/task_info/event_record_task_info.cc"
  76. "../graph/load/model_manager/task_info/event_wait_task_info.cc"
  77. "../graph/load/model_manager/task_info/fusion_start_task_info.cc"
  78. "../graph/load/model_manager/task_info/fusion_stop_task_info.cc"
  79. "../graph/load/model_manager/task_info/kernel_ex_task_info.cc"
  80. "../graph/load/model_manager/task_info/kernel_task_info.cc"
  81. "../graph/load/model_manager/task_info/label_set_task_info.cc"
  82. "../graph/load/model_manager/task_info/label_switch_by_index_task_info.cc"
  83. "../graph/load/model_manager/task_info/label_goto_ex_task_info.cc"
  84. "../graph/load/model_manager/task_info/memcpy_async_task_info.cc"
  85. "../graph/load/model_manager/task_info/memcpy_addr_async_task_info.cc"
  86. "../graph/load/model_manager/task_info/profiler_trace_task_info.cc"
  87. "../graph/load/model_manager/task_info/stream_active_task_info.cc"
  88. "../graph/load/model_manager/task_info/stream_switch_task_info.cc"
  89. "../graph/load/model_manager/task_info/stream_switchn_task_info.cc"
  90. "../graph/load/model_manager/task_info/end_graph_task_info.cc"
  91. "../graph/load/model_manager/task_info/model_exit_task_info.cc"
  92. "../graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc"
  93. "../graph/load/model_manager/task_info/super_kernel/super_kernel.cc"
  94. "../graph/common/local_context.cc"
  95. "../opskernel_manager/ops_kernel_builder_manager.cc"
  96. "../single_op/single_op_manager.cc"
  97. "../single_op/single_op_model.cc"
  98. "../single_op/single_op.cc"
  99. "../single_op/stream_resource.cc"
  100. "../single_op/task/op_task.cc"
  101. "../single_op/task/build_task_utils.cc"
  102. "../single_op/task/tbe_task_builder.cc"
  103. "../single_op/task/aicpu_task_builder.cc"
  104. "../single_op/task/aicpu_kernel_task_builder.cc"
  105. "../hybrid/common/tensor_value.cc"
  106. "../hybrid/common/npu_memory_allocator.cc"
  107. "../hybrid/executor/rt_callback_manager.cc"
  108. "../hybrid/executor/node_state.cc"
  109. "../hybrid/executor/node_done_manager.cc"
  110. "../hybrid/executor/hybrid_profiler.cc"
  111. "../hybrid/executor/hybrid_model_executor.cc"
  112. "../hybrid/executor/hybrid_model_pipeline_executor.cc"
  113. "../hybrid/executor/hybrid_model_async_executor.cc"
  114. "../hybrid/executor/hybrid_execution_context.cc"
  115. "../hybrid/executor/subgraph_context.cc"
  116. "../hybrid/executor/subgraph_executor.cc"
  117. "../hybrid/executor/worker/task_compile_engine.cc"
  118. "../hybrid/executor/worker/shape_inference_engine.cc"
  119. "../hybrid/executor/worker/execution_engine.cc"
  120. "../hybrid/model/hybrid_model.cc"
  121. "../hybrid/model/hybrid_model_builder.cc"
  122. "../hybrid/model/node_item.cc"
  123. "../hybrid/model/graph_item.cc"
  124. "../hybrid/node_executor/aicore/aicore_node_executor.cc"
  125. "../hybrid/node_executor/aicore/aicore_op_task.cc"
  126. "../hybrid/node_executor/aicore/aicore_task_builder.cc"
  127. "../hybrid/node_executor/aicpu/aicpu_node_executor.cc"
  128. "../hybrid/node_executor/compiledsubgraph/known_node_executor.cc"
  129. "../hybrid/node_executor/ge_local/ge_local_node_executor.cc"
  130. "../hybrid/node_executor/host_cpu/host_cpu_node_executor.cc"
  131. "../hybrid/node_executor/host_cpu/kernel_factory.cc"
  132. "../hybrid/node_executor/host_cpu/kernel/no_op_kernel.cc"
  133. "../hybrid/node_executor/host_cpu/kernel/variable_kernel.cc"
  134. "../hybrid/node_executor/host_cpu/kernel/assign_kernel.cc"
  135. "../hybrid/node_executor/host_cpu/kernel/random_uniform_kernel.cc"
  136. "../hybrid/node_executor/host_cpu/kernel/data_kernel.cc"
  137. "../hybrid/node_executor/controlop/control_op_executor.cc"
  138. "../hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc"
  139. "../hybrid/node_executor/rts/rts_node_executor.cc"
  140. "../hybrid/node_executor/node_executor.cc"
  141. "../hybrid/node_executor/task_context.cc"
  142. "../hybrid/hybrid_davinci_model.cc"
  143. "../ge_local_engine/engine/host_cpu_engine.cc"
  144. "../graph/common/omg_util.cc"
  145. "../graph/manager/host_mem_manager.cc"
  146. "../graph/build/memory/var_mem_assign_util.cc"
  147. "../host_kernels/transpose_kernel.cc"
  148. "../host_kernels/add_kernel.cc"
  149. "../host_kernels/broadcast_args_kernel.cc"
  150. "../host_kernels/broadcast_gradient_args_kernel.cc"
  151. "../host_kernels/cast_kernel.cc"
  152. "../host_kernels/concat_offset_kernel.cc"
  153. "../host_kernels/concat_v2_kernel.cc"
  154. "../host_kernels/dynamic_stitch_kernel.cc"
  155. "../host_kernels/identity_kernel.cc"
  156. "../host_kernels/empty_kernel.cc"
  157. "../host_kernels/expanddims_kernel.cc"
  158. "../host_kernels/fill_kernel.cc"
  159. "../host_kernels/floordiv_kernel.cc"
  160. "../host_kernels/floormod_kernel.cc"
  161. "../host_kernels/gather_v2_kernel.cc"
  162. "../host_kernels/greater_kernel.cc"
  163. "../host_kernels/kernel_utils.cc"
  164. "../host_kernels/maximum_kernel.cc"
  165. "../host_kernels/mul_kernel.cc"
  166. "../host_kernels/pack_kernel.cc"
  167. "../host_kernels/permute_kernel.cc"
  168. "../host_kernels/range_kernel.cc"
  169. "../host_kernels/rank_kernel.cc"
  170. "../host_kernels/reduce_prod_kernel.cc"
  171. "../host_kernels/reshape_kernel.cc"
  172. "../host_kernels/rsqrt_kernel.cc"
  173. "../host_kernels/shape_kernel.cc"
  174. "../host_kernels/shape_n_kernel.cc"
  175. "../host_kernels/size_kernel.cc"
  176. "../host_kernels/slice_d_kernel.cc"
  177. "../host_kernels/slice_kernel.cc"
  178. "../host_kernels/squeeze_kernel.cc"
  179. "../host_kernels/unsqueeze_kernel.cc"
  180. "../host_kernels/ssd_prior_box_kernel.cc"
  181. "../host_kernels/strided_slice_kernel.cc"
  182. "../host_kernels/sub_kernel.cc"
  183. "../host_kernels/transdata_kernel.cc"
  184. "../host_kernels/unpack_kernel.cc"
  185. "../graph/passes/pass_utils.cc"
  186. "../graph/common/bcast.cc"
  187. "../common/fp16_t.cc"
  188. "../common/formats/format_transfers/format_transfer_transpose.cc"
  189. "../common/formats/utils/formats_trans_utils.cc"
  190. )
  191. ######## libge_executor.a ########
  192. add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS})
  193. target_compile_options(ge_executor PRIVATE
  194. $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common>
  195. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  196. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  197. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
  198. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
  199. )
  200. target_compile_definitions(ge_executor PRIVATE
  201. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  202. DAVINCI_SUPPORT_PROFILING
  203. google=ascend_private
  204. $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
  205. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
  206. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  207. LOG_CPP
  208. )
  209. target_include_directories(ge_executor SYSTEM PRIVATE
  210. ${GE_CODE_DIR}/ge
  211. ${GE_CODE_DIR}/inc
  212. ${GE_CODE_DIR}/inc/external
  213. ${GE_CODE_DIR}/inc/framework
  214. ${METADEF_DIR}/inc
  215. ${METADEF_DIR}/inc/external
  216. ${METADEF_DIR}/inc/external/graph
  217. ${METADEF_DIR}/inc/graph
  218. ${CMAKE_BINARY_DIR}
  219. ${CMAKE_BINARY_DIR}/proto/ge_dump
  220. ${CMAKE_BINARY_DIR}/proto/ge_static
  221. #### yellow zone ####
  222. ${GE_CODE_DIR}/../inc
  223. ${GE_CODE_DIR}/../inc/cce
  224. #### blue zone ####
  225. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  226. )
  227. target_link_libraries(ge_executor PRIVATE
  228. $<BUILD_INTERFACE:intf_pub>
  229. json
  230. ascend_protobuf_static
  231. ge_proto_dump
  232. c_sec
  233. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  234. -ldl
  235. )
  236. ######## libge_executor.so ########
  237. add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS})
  238. target_compile_options(ge_executor_shared PRIVATE
  239. -fno-common
  240. -Werror
  241. -O2
  242. -Wno-deprecated-declarations
  243. -fvisibility=hidden
  244. )
  245. target_compile_definitions(ge_executor_shared PRIVATE
  246. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  247. DAVINCI_SUPPORT_PROFILING
  248. google=ascend_private
  249. FUNC_VISIBILITY
  250. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  251. )
  252. target_include_directories(ge_executor_shared PRIVATE
  253. ${GE_CODE_DIR}/ge
  254. ${GE_CODE_DIR}/inc
  255. ${GE_CODE_DIR}/inc/external
  256. ${GE_CODE_DIR}/inc/framework
  257. ${METADEF_DIR}/inc
  258. ${METADEF_DIR}/inc/external
  259. ${METADEF_DIR}/inc/external/graph
  260. ${METADEF_DIR}/inc/graph
  261. ${CMAKE_BINARY_DIR}
  262. ${CMAKE_BINARY_DIR}/proto/ge_dump
  263. ${CMAKE_BINARY_DIR}/proto/ge
  264. #### yellow zone ####
  265. ${GE_CODE_DIR}/../inc
  266. ${GE_CODE_DIR}/../inc/cce
  267. #### blue zone ####
  268. ${GE_CODE_DIR}/third_party/fwkacllib/inc
  269. )
  270. target_link_options(ge_executor_shared PRIVATE
  271. -Wl,-Bsymbolic
  272. -Wl,--exclude-libs,ALL
  273. )
  274. target_link_libraries(ge_executor_shared PRIVATE
  275. $<BUILD_INTERFACE:intf_pub>
  276. msprofiler
  277. static_mmpa
  278. ge_proto_dump
  279. -Wl,--no-as-needed
  280. ge_common
  281. runtime
  282. slog
  283. graph
  284. register
  285. error_manager
  286. ascend_protobuf
  287. c_sec
  288. -Wl,--as-needed
  289. json
  290. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  291. -ldl
  292. )
  293. set_target_properties(ge_executor_shared PROPERTIES
  294. OUTPUT_NAME ge_executor
  295. )
  296. ############ install ############
  297. set(INSTALL_BASE_DIR "")
  298. set(INSTALL_LIBRARY_DIR lib)
  299. install(TARGETS ge_executor_shared OPTIONAL
  300. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
  301. )

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