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

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

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