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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 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
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
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
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 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
5 years ago
5 years ago
5 years ago
5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  1. if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES)
  2. add_subdirectory(common)
  3. add_subdirectory(plugin/engine)
  4. add_subdirectory(ge_local_engine)
  5. add_subdirectory(offline)
  6. elseif (ENABLE_D)
  7. add_subdirectory(common)
  8. add_subdirectory(ge_runtime)
  9. endif ()
  10. set(GRAPHENGINE_PROTO_LIST
  11. "${METADEF_DIR}/proto/om.proto"
  12. "${METADEF_DIR}/proto/task.proto"
  13. "${METADEF_DIR}/proto/insert_op.proto"
  14. "${METADEF_DIR}/proto/ge_ir.proto"
  15. "${METADEF_DIR}/proto/ge_api.proto"
  16. "${METADEF_DIR}/proto/fusion_model.proto"
  17. "${METADEF_DIR}/proto/optimizer_priority.proto"
  18. "${METADEF_DIR}/proto/fwk_adapter.proto"
  19. "${METADEF_DIR}/proto/op_mapping.proto"
  20. "${METADEF_DIR}/proto/dump_task.proto"
  21. "${METADEF_DIR}/proto/tensorflow/graph_library.proto"
  22. "${METADEF_DIR}/proto/tensorflow/graph.proto"
  23. "${METADEF_DIR}/proto/tensorflow/node_def.proto"
  24. "${METADEF_DIR}/proto/tensorflow/function.proto"
  25. "${METADEF_DIR}/proto/tensorflow/versions.proto"
  26. "${METADEF_DIR}/proto/tensorflow/attr_value.proto"
  27. "${METADEF_DIR}/proto/tensorflow/op_def.proto"
  28. "${METADEF_DIR}/proto/tensorflow/tensor.proto"
  29. "${METADEF_DIR}/proto/tensorflow/tensor_shape.proto"
  30. "${METADEF_DIR}/proto/tensorflow/types.proto"
  31. "${METADEF_DIR}/proto/tensorflow/resource_handle.proto"
  32. )
  33. protobuf_generate(graphengine_protos GRAPHENGINE_PROTO_SRCS GRAPHENGINE_PROTO_HDRS ${GRAPHENGINE_PROTO_LIST} TARGET)
  34. set(GE_FUSION_MODEL_PROTO_SRCS
  35. "${CMAKE_BINARY_DIR}/proto/graphengine_protos/proto/fusion_model.pb.cc"
  36. "${CMAKE_BINARY_DIR}/proto/graphengine_protos/proto/optimizer_priority.pb.cc"
  37. )
  38. add_library(ge_fusion_model_protos_obj OBJECT ${GE_FUSION_MODEL_PROTO_SRCS})
  39. add_dependencies(ge_fusion_model_protos_obj graphengine_protos)
  40. target_include_directories(ge_fusion_model_protos_obj PRIVATE
  41. #### blue zone ####
  42. ${PROTOBUF_SHARED_PKG_DIR}/include
  43. #### yellow zone ####
  44. ${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include
  45. )
  46. target_compile_definitions(ge_fusion_model_protos_obj PRIVATE
  47. google=ascend_private
  48. )
  49. target_link_libraries(ge_fusion_model_protos_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>)
  50. target_compile_options(ge_fusion_model_protos_obj PRIVATE
  51. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC>
  52. $<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions>
  53. $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>: -Wno-deprecated-declarations -fno-common>
  54. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  55. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  56. )
  57. if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES)
  58. ############ libge_proto_common.a ############
  59. add_library(ge_proto_common STATIC
  60. $<TARGET_OBJECTS:ge_fusion_model_protos_obj>
  61. )
  62. target_compile_definitions(ge_proto_common PRIVATE
  63. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  64. google=ascend_private
  65. )
  66. target_compile_options(ge_proto_common PRIVATE
  67. -O2
  68. -fno-common
  69. )
  70. target_link_libraries(ge_proto_common PRIVATE
  71. $<BUILD_INTERFACE:intf_pub>
  72. ascend_protobuf
  73. )
  74. ############ libge_proto_client.a ############
  75. add_library(ge_proto_client STATIC
  76. $<TARGET_OBJECTS:ge_fusion_model_protos_obj>
  77. )
  78. target_compile_definitions(ge_proto_client PRIVATE
  79. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  80. google=ascend_private
  81. )
  82. target_include_directories(ge_proto_client PRIVATE
  83. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  84. ${CMAKE_BINARY_DIR}/proto/graphengine_protos/proto
  85. )
  86. target_compile_options(ge_proto_client PRIVATE
  87. -O2
  88. -fno-common
  89. )
  90. target_link_libraries(ge_proto_client PRIVATE
  91. $<BUILD_INTERFACE:intf_pub>
  92. ascend_protobuf
  93. )
  94. endif ()
  95. ##################################################################
  96. set(EXECUTOR_SRC_LIST
  97. "common/dump/dump_op.cc"
  98. "common/dump/exception_dumper.cc"
  99. "common/dump/opdebug_register.cc"
  100. "common/ge/op_tiling_manager.cc"
  101. "common/ge/plugin_manager.cc"
  102. "common/profiling/ge_profiling.cc"
  103. "common/profiling/profiling_manager.cc"
  104. "executor/ge_executor.cc"
  105. "ge_local_engine/engine/host_cpu_engine.cc"
  106. "graph/build/memory/var_mem_assign_util.cc"
  107. "graph/execute/graph_execute.cc"
  108. "graph/execute/model_executor.cc"
  109. "graph/load/graph_loader.cc"
  110. "graph/load/model_manager/aipp_utils.cc"
  111. "graph/load/model_manager/cpu_queue_schedule.cc"
  112. "graph/load/model_manager/data_dumper.cc"
  113. "graph/load/model_manager/data_inputer.cc"
  114. "graph/load/model_manager/davinci_model.cc"
  115. "graph/load/model_manager/model_manager.cc"
  116. "graph/load/model_manager/model_utils.cc"
  117. "graph/load/model_manager/task_info/end_graph_task_info.cc"
  118. "graph/load/model_manager/task_info/event_record_task_info.cc"
  119. "graph/load/model_manager/task_info/event_wait_task_info.cc"
  120. "graph/load/model_manager/task_info/ffts_task_info.cc"
  121. "graph/load/model_manager/task_info/fusion_start_task_info.cc"
  122. "graph/load/model_manager/task_info/fusion_stop_task_info.cc"
  123. #"graph/load/model_manager/task_info/hccl_task_info.cc" # Just for runner.
  124. "graph/load/model_manager/task_info/kernel_ex_task_info.cc"
  125. "graph/load/model_manager/task_info/kernel_task_info.cc"
  126. "graph/load/model_manager/task_info/label_goto_ex_task_info.cc"
  127. "graph/load/model_manager/task_info/label_set_task_info.cc"
  128. "graph/load/model_manager/task_info/label_switch_by_index_task_info.cc"
  129. "graph/load/model_manager/task_info/memcpy_addr_async_task_info.cc"
  130. "graph/load/model_manager/task_info/memcpy_async_task_info.cc"
  131. "graph/load/model_manager/task_info/model_exit_task_info.cc"
  132. "graph/load/model_manager/task_info/profiler_trace_task_info.cc"
  133. "graph/load/model_manager/task_info/stream_active_task_info.cc"
  134. "graph/load/model_manager/task_info/stream_switch_task_info.cc"
  135. "graph/load/model_manager/task_info/stream_switchn_task_info.cc"
  136. "graph/load/model_manager/task_info/super_kernel/super_kernel.cc"
  137. "graph/load/model_manager/task_info/super_kernel/super_kernel_factory.cc"
  138. "graph/load/model_manager/task_info/task_info.cc"
  139. "graph/load/model_manager/tbe_handle_store.cc"
  140. "graph/load/model_manager/zero_copy_offset.cc"
  141. "graph/load/model_manager/zero_copy_task.cc"
  142. "graph/manager/graph_caching_allocator.cc"
  143. "graph/manager/graph_manager_utils.cc"
  144. "graph/manager/graph_mem_allocator.cc"
  145. "graph/manager/graph_mem_manager.cc"
  146. "graph/manager/graph_var_manager.cc"
  147. "graph/manager/host_mem_allocator.cc"
  148. "graph/manager/host_mem_manager.cc"
  149. #"graph/manager/memory_api.cc" # Just for runner.
  150. "graph/manager/rdma_pool_allocator.cc"
  151. "graph/manager/session_scope_mem_allocator.cc"
  152. "graph/manager/trans_var_data_utils.cc"
  153. "graph/manager/util/debug.cc"
  154. #"graph/manager/util/hcom_util.cc" # Just for runner.
  155. "graph/passes/pass_utils.cc"
  156. "graph/passes/mds_pass.cc"
  157. "graph/passes/mds_kernels/mds_utils.cc"
  158. "graph/passes/mds_kernels/variable_mds_kernel.cc"
  159. "graph/passes/mds_kernels/conv2d_mds_kernel.cc"
  160. "graph/passes/mds_kernels/base_mds_kernel.cc"
  161. "host_kernels/add_kernel.cc"
  162. "host_kernels/broadcast_args_kernel.cc"
  163. "host_kernels/broadcast_gradient_args_kernel.cc"
  164. "host_kernels/cast_kernel.cc"
  165. "host_kernels/concat_offset_kernel.cc"
  166. "host_kernels/concat_v2_kernel.cc"
  167. "host_kernels/dynamic_stitch_kernel.cc"
  168. "host_kernels/empty_kernel.cc"
  169. "host_kernels/expanddims_kernel.cc"
  170. "host_kernels/fill_kernel.cc"
  171. "host_kernels/floordiv_kernel.cc"
  172. "host_kernels/floormod_kernel.cc"
  173. "host_kernels/gather_v2_kernel.cc"
  174. "host_kernels/greater_kernel.cc"
  175. "host_kernels/identity_kernel.cc"
  176. "host_kernels/kernel_utils.cc"
  177. "host_kernels/maximum_kernel.cc"
  178. "host_kernels/mul_kernel.cc"
  179. "host_kernels/pack_kernel.cc"
  180. "host_kernels/permute_kernel.cc"
  181. "host_kernels/range_kernel.cc"
  182. "host_kernels/rank_kernel.cc"
  183. "host_kernels/reduce_prod_kernel.cc"
  184. "host_kernels/reformat_kernel.cc"
  185. "host_kernels/reshape_kernel.cc"
  186. "host_kernels/rsqrt_kernel.cc"
  187. "host_kernels/shape_kernel.cc"
  188. "host_kernels/shape_n_kernel.cc"
  189. "host_kernels/size_kernel.cc"
  190. "host_kernels/slice_d_kernel.cc"
  191. "host_kernels/slice_kernel.cc"
  192. "host_kernels/squeeze_kernel.cc"
  193. "host_kernels/ssd_prior_box_kernel.cc"
  194. "host_kernels/strided_slice_kernel.cc"
  195. "host_kernels/sub_kernel.cc"
  196. "host_kernels/transdata_kernel.cc"
  197. "host_kernels/transpose_kernel.cc"
  198. "host_kernels/unpack_kernel.cc"
  199. "host_kernels/unsqueeze_kernel.cc"
  200. "hybrid/common/npu_memory_allocator.cc"
  201. "hybrid/common/tensor_value.cc"
  202. "hybrid/executor/hybrid_execution_context.cc"
  203. "hybrid/executor/hybrid_model_async_executor.cc"
  204. "hybrid/executor/hybrid_model_executor.cc"
  205. "hybrid/executor/hybrid_model_pipeline_executor.cc"
  206. "hybrid/executor/hybrid_profiler.cc"
  207. "hybrid/executor/node_done_manager.cc"
  208. "hybrid/executor/node_state.cc"
  209. "hybrid/executor/rt_callback_manager.cc"
  210. "hybrid/executor/subgraph_context.cc"
  211. "hybrid/executor/subgraph_executor.cc"
  212. "hybrid/executor/worker/execution_engine.cc"
  213. "hybrid/executor/worker/shape_inference_engine.cc"
  214. "hybrid/executor/worker/task_compile_engine.cc"
  215. "hybrid/hybrid_davinci_model.cc"
  216. "hybrid/model/graph_item.cc"
  217. "hybrid/model/hybrid_model.cc"
  218. "hybrid/model/hybrid_model_builder.cc"
  219. "hybrid/model/node_item.cc"
  220. "hybrid/node_executor/aicore/aicore_node_executor.cc"
  221. "hybrid/node_executor/aicore/aicore_op_task.cc"
  222. "hybrid/node_executor/aicore/aicore_task_builder.cc"
  223. "hybrid/node_executor/aicpu/aicpu_ext_info.cc"
  224. "hybrid/node_executor/aicpu/aicpu_node_executor.cc"
  225. "hybrid/node_executor/compiledsubgraph/known_node_executor.cc"
  226. "hybrid/node_executor/controlop/control_op_executor.cc"
  227. "hybrid/node_executor/ge_local/ge_local_node_executor.cc"
  228. #"hybrid/node_executor/hccl/hccl_node_executor.cc" # Just for runner.
  229. "hybrid/node_executor/host_cpu/host_cpu_node_executor.cc"
  230. "hybrid/node_executor/node_executor.cc"
  231. "hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc"
  232. "hybrid/node_executor/rts/rts_node_executor.cc"
  233. "hybrid/node_executor/rts/rts_node_task.cc"
  234. "hybrid/node_executor/rts/rts_task_factory.cc"
  235. "hybrid/node_executor/task_context.cc"
  236. "opskernel_manager/ops_kernel_builder_manager.cc"
  237. "single_op/single_op.cc"
  238. "single_op/single_op_manager.cc"
  239. "single_op/single_op_model.cc"
  240. "single_op/stream_resource.cc"
  241. "single_op/task/aicpu_kernel_task_builder.cc"
  242. "single_op/task/aicpu_task_builder.cc"
  243. "single_op/task/build_task_utils.cc"
  244. "single_op/task/op_task.cc"
  245. "single_op/task/rts_kernel_task_builder.cc"
  246. "single_op/task/tbe_task_builder.cc"
  247. )
  248. ##################################################################
  249. set(COMPILER_SRC_LIST
  250. "analyzer/analyzer.cc"
  251. "common/dump/dump_op.cc"
  252. "common/ge/op_tiling_manager.cc"
  253. "common/ge/plugin_manager.cc"
  254. "common/profiling/profiling_manager.cc"
  255. "engine_manager/dnnengine_manager.cc"
  256. "ge_local_engine/engine/host_cpu_engine.cc"
  257. "ge_opt_info/ge_opt_info.cc"
  258. "generator/ge_generator.cc"
  259. "generator/generator_api.cc"
  260. "graph/build/graph_builder.cc"
  261. "graph/build/label_allocator.cc"
  262. "graph/build/logical_stream_allocator.cc"
  263. "graph/build/memory/binary_block_mem_assigner.cc"
  264. "graph/build/memory/block_mem_assigner.cc"
  265. "graph/build/memory/buffer_pool_mem_assigner.cc"
  266. "graph/build/memory/graph_mem_assigner.cc"
  267. "graph/build/memory/hybrid_mem_assigner.cc"
  268. "graph/build/memory/max_block_mem_assigner.cc"
  269. "graph/build/memory/memory_assigner.cc"
  270. "graph/build/memory/var_mem_assign_util.cc"
  271. "graph/build/model_builder.cc"
  272. "graph/build/run_context.cc"
  273. "graph/build/stream_allocator.cc"
  274. "graph/build/stream_graph_optimizer.cc"
  275. "graph/build/task_generator.cc"
  276. "graph/label/case_label_maker.cc"
  277. "graph/label/if_label_maker.cc"
  278. "graph/label/label_maker.cc"
  279. "graph/label/partitioned_call_label_maker.cc"
  280. "graph/label/while_label_maker.cc"
  281. "graph/load/model_manager/model_utils.cc"
  282. "graph/manager/graph_caching_allocator.cc"
  283. "graph/manager/graph_context.cc"
  284. "graph/manager/graph_manager.cc"
  285. "graph/manager/graph_manager_utils.cc"
  286. "graph/manager/graph_mem_allocator.cc"
  287. "graph/manager/graph_mem_manager.cc"
  288. "graph/manager/graph_var_manager.cc"
  289. "graph/manager/host_mem_allocator.cc"
  290. "graph/manager/host_mem_manager.cc"
  291. "graph/manager/rdma_pool_allocator.cc"
  292. "graph/manager/session_scope_mem_allocator.cc"
  293. "graph/manager/trans_var_data_utils.cc"
  294. "graph/manager/util/debug.cc"
  295. "graph/manager/util/rt_context_util.cc"
  296. "graph/manager/util/variable_accelerate_ctrl.cc"
  297. "graph/optimize/graph_optimize.cc"
  298. "graph/optimize/mem_rw_conflict_optimize.cc"
  299. "graph/optimize/summary_optimize.cc"
  300. "graph/partition/dynamic_shape_partition.cc"
  301. "graph/partition/engine_place.cc"
  302. "graph/partition/graph_partition.cc"
  303. "graph/partition/stage_partition.cc"
  304. "graph/passes/addn_pass.cc"
  305. "graph/passes/aicpu_constant_folding_pass.cc"
  306. "graph/passes/assert_pass.cc"
  307. "graph/passes/assign_remove_pass.cc"
  308. "graph/passes/atomic_addr_clean_pass.cc"
  309. "graph/passes/attach_stream_label_pass.cc"
  310. "graph/passes/base_pass.cc"
  311. "graph/passes/bitcast_pass.cc"
  312. "graph/passes/buffer_pool_memory_pass.cc"
  313. "graph/passes/cast_remove_pass.cc"
  314. "graph/passes/cast_translate_pass.cc"
  315. "graph/passes/common_subexpression_elimination_pass.cc"
  316. "graph/passes/compile_nodes_pass.cc"
  317. "graph/passes/cond_pass.cc"
  318. "graph/passes/cond_remove_pass.cc"
  319. "graph/passes/constant_folding_pass.cc"
  320. "graph/passes/constant_fuse_same_pass.cc"
  321. "graph/passes/control_trigger_pass.cc"
  322. "graph/passes/ctrl_edge_transfer_pass.cc"
  323. "graph/passes/data_pass.cc"
  324. "graph/passes/dimension_adjust_pass.cc"
  325. "graph/passes/dimension_compute_pass.cc"
  326. "graph/passes/dropout_pass.cc"
  327. "graph/passes/end_of_sequence_add_control_pass.cc"
  328. "graph/passes/enter_pass.cc"
  329. "graph/passes/flow_ctrl_pass.cc"
  330. "graph/passes/folding_pass.cc"
  331. "graph/passes/for_pass.cc"
  332. "graph/passes/fuse_data_nodes_with_common_input_pass.cc"
  333. "graph/passes/get_original_format_pass.cc"
  334. "graph/passes/global_step_insert_pass.cc"
  335. "graph/passes/guarantee_const_pass.cc"
  336. "graph/passes/hccl_continuous_memcpy_pass.cc"
  337. "graph/passes/hccl_group_pass.cc"
  338. "graph/passes/hccl_memcpy_pass.cc"
  339. "graph/passes/hccl_tailing_optimization_pass.cc"
  340. "graph/passes/identity_pass.cc"
  341. "graph/passes/infer_base_pass.cc"
  342. "graph/passes/infer_value_range_pass.cc"
  343. "graph/passes/infershape_pass.cc"
  344. "graph/passes/inplace_support_check_pass.cc"
  345. "graph/passes/input_output_connection_identify_pass.cc"
  346. "graph/passes/iterator_op_pass.cc"
  347. "graph/passes/link_gen_mask_nodes_pass.cc"
  348. "graph/passes/mark_agnostic_pass.cc"
  349. "graph/passes/mark_force_unknown_for_cond_pass.cc"
  350. "graph/passes/mark_graph_unknown_status_pass.cc"
  351. "graph/passes/mark_node_unknown_shape_pass.cc"
  352. "graph/passes/mark_same_addr_pass.cc"
  353. "graph/passes/memcpy_addr_async_pass.cc"
  354. "graph/passes/merge_input_memcpy_pass.cc"
  355. "graph/passes/merge_pass.cc"
  356. "graph/passes/merge_to_stream_merge_pass.cc"
  357. "graph/passes/multi_batch_clone_pass.cc"
  358. "graph/passes/multi_batch_pass.cc"
  359. "graph/passes/net_output_pass.cc"
  360. "graph/passes/next_iteration_pass.cc"
  361. "graph/passes/no_use_reshape_remove_pass.cc"
  362. "graph/passes/parallel_concat_start_op_pass.cc"
  363. "graph/passes/parallel_group_pass.cc"
  364. "graph/passes/pass_manager.cc"
  365. "graph/passes/pass_utils.cc"
  366. "graph/passes/permute_pass.cc"
  367. "graph/passes/placeholder_with_default_pass.cc"
  368. "graph/passes/prevent_gradient_pass.cc"
  369. "graph/passes/print_op_pass.cc"
  370. "graph/passes/prune_pass.cc"
  371. "graph/passes/ref_identity_delete_op_pass.cc"
  372. "graph/passes/remove_same_const_pass.cc"
  373. "graph/passes/replace_transshape_pass.cc"
  374. "graph/passes/replace_with_empty_const_pass.cc"
  375. "graph/passes/reshape_recovery_pass.cc"
  376. "graph/passes/reshape_remove_pass.cc"
  377. "graph/passes/resource_pair_add_control_pass.cc"
  378. "graph/passes/resource_pair_remove_control_pass.cc"
  379. "graph/passes/same_transdata_breadth_fusion_pass.cc"
  380. "graph/passes/save_pass.cc"
  381. "graph/passes/set_input_output_offset_pass.cc"
  382. "graph/passes/shape_operate_op_remove_pass.cc"
  383. "graph/passes/snapshot_pass.cc"
  384. "graph/passes/stop_gradient_pass.cc"
  385. "graph/passes/subexpression_migration_pass.cc"
  386. "graph/passes/subgraph_const_migration_pass.cc"
  387. "graph/passes/subgraph_pass.cc"
  388. "graph/passes/switch_data_edges_bypass.cc"
  389. "graph/passes/switch_dead_branch_elimination.cc"
  390. "graph/passes/switch_logic_remove_pass.cc"
  391. "graph/passes/switch_to_stream_switch_pass.cc"
  392. "graph/passes/transop_breadth_fusion_pass.cc"
  393. "graph/passes/transop_depth_fusion_pass.cc"
  394. "graph/passes/transop_nearby_allreduce_fusion_pass.cc"
  395. "graph/passes/transop_symmetry_elimination_pass.cc"
  396. "graph/passes/transop_without_reshape_fusion_pass.cc"
  397. "graph/passes/transpose_transdata_pass.cc"
  398. "graph/passes/unused_args_clean_pass.cc"
  399. "graph/passes/unused_const_pass.cc"
  400. "graph/passes/useless_control_out_remove_pass.cc"
  401. "graph/passes/var_is_initialized_op_pass.cc"
  402. "graph/passes/variable_op_pass.cc"
  403. "graph/passes/variable_prepare_op_pass.cc"
  404. "graph/passes/variable_ref_delete_op_pass.cc"
  405. "graph/passes/variable_ref_useless_control_out_delete_pass.cc"
  406. "graph/preprocess/graph_preprocess.cc"
  407. "graph/preprocess/insert_op/ge_aipp_op.cc"
  408. "graph/preprocess/insert_op/util_insert_aipp_op.cc"
  409. "graph/preprocess/multi_batch_copy_graph.cc"
  410. "graph/preprocess/multi_batch_options.cc"
  411. "host_kernels/add_kernel.cc"
  412. "host_kernels/broadcast_args_kernel.cc"
  413. "host_kernels/broadcast_gradient_args_kernel.cc"
  414. "host_kernels/cast_kernel.cc"
  415. "host_kernels/concat_offset_kernel.cc"
  416. "host_kernels/concat_v2_kernel.cc"
  417. "host_kernels/dynamic_stitch_kernel.cc"
  418. "host_kernels/empty_kernel.cc"
  419. "host_kernels/expanddims_kernel.cc"
  420. "host_kernels/fill_kernel.cc"
  421. "host_kernels/floordiv_kernel.cc"
  422. "host_kernels/floormod_kernel.cc"
  423. "host_kernels/gather_v2_kernel.cc"
  424. "host_kernels/greater_kernel.cc"
  425. "host_kernels/identity_kernel.cc"
  426. "host_kernels/kernel_utils.cc"
  427. "host_kernels/maximum_kernel.cc"
  428. "host_kernels/mul_kernel.cc"
  429. "host_kernels/pack_kernel.cc"
  430. "host_kernels/permute_kernel.cc"
  431. "host_kernels/range_kernel.cc"
  432. "host_kernels/rank_kernel.cc"
  433. "host_kernels/reduce_prod_kernel.cc"
  434. "host_kernels/reformat_kernel.cc"
  435. "host_kernels/reshape_kernel.cc"
  436. "host_kernels/rsqrt_kernel.cc"
  437. "host_kernels/shape_kernel.cc"
  438. "host_kernels/shape_n_kernel.cc"
  439. "host_kernels/size_kernel.cc"
  440. "host_kernels/slice_d_kernel.cc"
  441. "host_kernels/slice_kernel.cc"
  442. "host_kernels/squeeze_kernel.cc"
  443. "host_kernels/ssd_prior_box_kernel.cc"
  444. "host_kernels/strided_slice_kernel.cc"
  445. "host_kernels/sub_kernel.cc"
  446. "host_kernels/transdata_kernel.cc"
  447. "host_kernels/transpose_kernel.cc"
  448. "host_kernels/unpack_kernel.cc"
  449. "host_kernels/unsqueeze_kernel.cc"
  450. "hybrid/node_executor/aicpu/aicpu_ext_info.cc"
  451. "init/gelib.cc"
  452. "ir_build/attr_options/keep_dtype_option.cc"
  453. "ir_build/attr_options/utils.cc"
  454. "ir_build/attr_options/weight_compress_option.cc"
  455. "ir_build/ge_ir_build.cc"
  456. "ir_build/option_utils.cc"
  457. "opskernel_manager/ops_kernel_builder_manager.cc"
  458. "opskernel_manager/ops_kernel_manager.cc"
  459. )
  460. set(RUNNER_SRC_LIST
  461. "client/ge_api.cc"
  462. "session/inner_session.cc"
  463. "session/session_manager.cc"
  464. "common/profiling/ge_runner_profiling.cc"
  465. "graph/manager/memory_api.cc"
  466. "graph/manager/util/hcom_util.cc"
  467. "graph/load/model_manager/task_info/hccl_task_info.cc"
  468. "hybrid/node_executor/hccl/hccl_node_executor.cc"
  469. "hybrid/node_executor/aicore/aicore_task_compiler.cc"
  470. )
  471. if (NOT ENABLE_D AND NOT ENABLE_ACL AND NOT ENABLE_MS_TESTCASES)
  472. message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
  473. ############ libge_runner.so ############
  474. add_library(ge_runner SHARED
  475. ${EXECUTOR_SRC_LIST}
  476. ${COMPILER_SRC_LIST}
  477. ${RUNNER_SRC_LIST}
  478. $<TARGET_OBJECTS:$<IF:$<TARGET_EXISTS:msprofiler_fwk>,msprofiler_fwk,msprofiler_fwk_object>>
  479. )
  480. add_library(msprofiler_fwk_object OBJECT IMPORTED GLOBAL)
  481. if (msprofiler_fwk_ext_LIBRARY_DIR)
  482. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object)
  483. execute_process(
  484. COMMAND ar x ${msprofiler_fwk_ext_LIBRARY_DIR}
  485. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object
  486. )
  487. file(GLOB MSPROFILER_FWK_OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_fwk_object/*.o)
  488. set_property(TARGET msprofiler_fwk_object PROPERTY IMPORTED_OBJECTS ${MSPROFILER_FWK_OBJECT_LIST})
  489. endif()
  490. target_compile_definitions(ge_runner PRIVATE
  491. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  492. DAVINCI_SUPPORT_PROFILING
  493. REUSE_MEMORY=1
  494. FMK_SUPPORT_DUMP
  495. DAVINCI_CLOUD
  496. google=ascend_private
  497. FUNC_VISIBILITY
  498. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  499. )
  500. target_compile_options(ge_runner PRIVATE
  501. -O2
  502. -fno-common
  503. -fvisibility=hidden
  504. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
  505. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
  506. )
  507. target_include_directories(ge_runner SYSTEM PRIVATE
  508. ${GE_CODE_DIR}/ge
  509. ${GE_CODE_DIR}/inc
  510. ${GE_CODE_DIR}/inc/external
  511. ${GE_CODE_DIR}/inc/framework
  512. ${METADEF_DIR}/inc
  513. ${METADEF_DIR}/inc/external
  514. ${CMAKE_BINARY_DIR}
  515. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  516. #### yellow zone ####
  517. ${GE_CODE_DIR}/../inc
  518. ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external
  519. ${GE_CODE_DIR}/../abl/adump/external
  520. ${GE_CODE_DIR}/../abl/licctrl
  521. ${GE_CODE_DIR}/../ace/comop/inc
  522. ${GE_CODE_DIR}/../ace/comop/inc/external
  523. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  524. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<TARGET_PROPERTY:runtime_headers,INTERFACE_INCLUDE_DIRECTORIES>>
  525. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<TARGET_PROPERTY:cce_headers,INTERFACE_INCLUDE_DIRECTORIES>>
  526. #### blue zone ####
  527. ${ASCEND_DIR}/driver/include
  528. ${ASCEND_DIR}/fwkacllib/include
  529. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  530. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  531. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info>
  532. )
  533. target_link_options(ge_runner PRIVATE
  534. -Wl,-Bsymbolic
  535. )
  536. target_link_libraries(ge_runner PRIVATE
  537. $<BUILD_INTERFACE:intf_pub>
  538. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  539. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  540. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  541. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
  542. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:cce_headers>>
  543. adump_server
  544. static_mmpa
  545. ge_proto_common
  546. ge_proto_client
  547. -Wl,--no-as-needed
  548. graph
  549. ge_common
  550. ascend_protobuf
  551. register
  552. c_sec
  553. slog
  554. runtime
  555. error_manager
  556. ascend_hal_stub
  557. opt_feature
  558. -Wl,--as-needed
  559. json
  560. -lrt
  561. -ldl
  562. )
  563. ############ libge_compiler.so ############
  564. add_library(ge_compiler SHARED
  565. ${COMPILER_SRC_LIST}
  566. )
  567. add_dependencies(ge_compiler
  568. graphengine_protos
  569. )
  570. target_compile_definitions(ge_compiler PRIVATE
  571. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  572. REUSE_MEMORY=1
  573. FMK_SUPPORT_DUMP
  574. FMK_HOST_INFER
  575. google=ascend_private
  576. FUNC_VISIBILITY
  577. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  578. )
  579. target_compile_options(ge_compiler PRIVATE
  580. -O2
  581. -fno-common
  582. -fvisibility=hidden
  583. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
  584. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
  585. )
  586. target_include_directories(ge_compiler SYSTEM PRIVATE
  587. ${GE_CODE_DIR}/ge
  588. ${GE_CODE_DIR}/inc
  589. ${GE_CODE_DIR}/inc/external
  590. ${GE_CODE_DIR}/inc/framework
  591. ${METADEF_DIR}/inc
  592. ${METADEF_DIR}/inc/external
  593. ${CMAKE_BINARY_DIR}
  594. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  595. #### yellow zone ####
  596. ${GE_CODE_DIR}/../inc
  597. ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external
  598. ${GE_CODE_DIR}/../abl/adump/external
  599. ${GE_CODE_DIR}/../abl/licctrl
  600. ${GE_CODE_DIR}/../ace/comop/inc
  601. ${GE_CODE_DIR}/../ace/comop/inc/external
  602. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  603. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<TARGET_PROPERTY:runtime_headers,INTERFACE_INCLUDE_DIRECTORIES>>
  604. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<TARGET_PROPERTY:cce_headers,INTERFACE_INCLUDE_DIRECTORIES>>
  605. #### blue zone ####
  606. ${ASCEND_DIR}/driver/include
  607. ${ASCEND_DIR}/fwkacllib/include
  608. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  609. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  610. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/opt_info>
  611. )
  612. target_link_options(ge_compiler PRIVATE
  613. -Wl,-Bsymbolic
  614. )
  615. target_link_libraries(ge_compiler PRIVATE
  616. $<BUILD_INTERFACE:intf_pub>
  617. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  618. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  619. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  620. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
  621. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:cce_headers>>
  622. static_mmpa
  623. ge_proto_common
  624. -Wl,--no-as-needed
  625. graph
  626. ge_common
  627. ascend_protobuf
  628. register
  629. c_sec
  630. error_manager
  631. slog
  632. runtime
  633. opt_feature
  634. -Wl,--as-needed
  635. json
  636. -lrt
  637. -ldl
  638. )
  639. ######## libge_executor.a ########
  640. add_library(ge_executor STATIC
  641. ${EXECUTOR_SRC_LIST}
  642. )
  643. add_dependencies(ge_executor
  644. graphengine_protos
  645. )
  646. target_compile_options(ge_executor PRIVATE
  647. $<$<OR:$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>,$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common>
  648. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Debug>>:/MTd>
  649. $<$<AND:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,$<STREQUAL:${CMAKE_CONFIGURATION_TYPES},Release>>:/MT>
  650. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-variable>
  651. $<$<STREQUAL:${CMAKE_CXX_COMPILER_VERSION},7.3.0>:-Werror=unused-const-variable -Werror=format>
  652. )
  653. target_compile_definitions(ge_executor PRIVATE
  654. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  655. DAVINCI_SUPPORT_PROFILING
  656. google=ascend_private
  657. $<IF:$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>,OS_TYPE=WIN,OS_TYPE=0>
  658. $<$<STREQUAL:${TARGET_SYSTEM_NAME},Windows>:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX>
  659. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  660. LOG_CPP
  661. )
  662. target_include_directories(ge_executor SYSTEM PRIVATE
  663. ${GE_CODE_DIR}/ge
  664. ${GE_CODE_DIR}/inc
  665. ${GE_CODE_DIR}/inc/external
  666. ${GE_CODE_DIR}/inc/framework
  667. ${METADEF_DIR}/inc
  668. ${METADEF_DIR}/inc/external
  669. ${CMAKE_BINARY_DIR}
  670. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  671. #### yellow zone ####
  672. ${GE_CODE_DIR}/../ace/comop/inc
  673. ${GE_CODE_DIR}/../ace/comop/inc/external
  674. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  675. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<TARGET_PROPERTY:runtime_headers,INTERFACE_INCLUDE_DIRECTORIES>>
  676. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<TARGET_PROPERTY:cce_headers,INTERFACE_INCLUDE_DIRECTORIES>>
  677. #### blue zone ####
  678. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  679. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain>
  680. )
  681. target_link_libraries(ge_executor PRIVATE
  682. $<BUILD_INTERFACE:intf_pub>
  683. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  684. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  685. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  686. json
  687. ascend_protobuf_static
  688. c_sec
  689. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  690. -ldl
  691. )
  692. ######## libge_executor.so ########
  693. add_library(ge_executor_shared SHARED
  694. ${EXECUTOR_SRC_LIST}
  695. )
  696. add_dependencies(ge_executor_shared
  697. graphengine_protos
  698. )
  699. target_compile_options(ge_executor_shared PRIVATE
  700. -fno-common
  701. -Werror
  702. -O2
  703. -Wno-deprecated-declarations
  704. -fvisibility=hidden
  705. )
  706. target_compile_definitions(ge_executor_shared PRIVATE
  707. PROTOBUF_INLINE_NOT_IN_HEADERS=0
  708. DAVINCI_SUPPORT_PROFILING
  709. google=ascend_private
  710. FUNC_VISIBILITY
  711. $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
  712. )
  713. target_include_directories(ge_executor_shared PRIVATE
  714. ${GE_CODE_DIR}/ge
  715. ${GE_CODE_DIR}/inc
  716. ${GE_CODE_DIR}/inc/external
  717. ${GE_CODE_DIR}/inc/framework
  718. ${METADEF_DIR}/inc
  719. ${METADEF_DIR}/inc/external
  720. ${CMAKE_BINARY_DIR}
  721. ${CMAKE_BINARY_DIR}/proto/graphengine_protos
  722. #### yellow zone ####
  723. ${GE_CODE_DIR}/../ace/comop/inc
  724. ${GE_CODE_DIR}/../ace/comop/inc/external
  725. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:${GE_DEPEND_DIR}/inc>
  726. #### blue zone ####
  727. $<$<BOOL:${ENABLE_OPEN_SRC}>:${GE_CODE_DIR}/third_party/fwkacllib/inc>
  728. )
  729. target_link_options(ge_executor_shared PRIVATE
  730. -Wl,-Bsymbolic
  731. -Wl,--exclude-libs,ALL
  732. )
  733. target_link_libraries(ge_executor_shared PRIVATE
  734. $<BUILD_INTERFACE:intf_pub>
  735. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:slog_headers>>
  736. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:msprof_headers>>
  737. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:mmpa_headers>>
  738. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:runtime_headers>>
  739. $<$<NOT:$<BOOL:${ENABLE_OPEN_SRC}>>:$<BUILD_INTERFACE:cce_headers>>
  740. -Wl,--no-as-needed
  741. ge_common
  742. runtime
  743. slog
  744. graph
  745. register
  746. error_manager
  747. ascend_protobuf
  748. c_sec
  749. -Wl,--as-needed
  750. json
  751. $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME},Android>>:-lrt>
  752. -ldl
  753. )
  754. set_target_properties(ge_executor_shared PROPERTIES
  755. OUTPUT_NAME ge_executor
  756. )
  757. ############ libascendcl.so ############
  758. file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "")
  759. #add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c)
  760. #set(DUMMY_OBJ $<TARGET_OBJECTS:dummy_obj>)
  761. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object)
  762. if(EXISTS ${STATIC_ACL_LIB}/libascendcl.a)
  763. execute_process(
  764. COMMAND ar x ${STATIC_ACL_LIB}/libascendcl.a
  765. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object
  766. )
  767. file(GLOB OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object/*.o)
  768. else()
  769. set(OBJECT_LIST ${CMAKE_BINARY_DIR}/dummy.c)
  770. endif()
  771. add_library(opensrc_ascendcl SHARED
  772. ${OBJECT_LIST}
  773. $<TARGET_OBJECTS:$<IF:$<TARGET_EXISTS:msprofiler>,msprofiler,msprofiler_object>>
  774. )
  775. add_library(msprofiler_object OBJECT IMPORTED GLOBAL)
  776. if (msprofiler_ext_LIBRARY_DIR)
  777. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_object)
  778. execute_process(
  779. COMMAND ar x ${msprofiler_ext_LIBRARY_DIR}
  780. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_object
  781. )
  782. file(GLOB MSPROFILER_OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/msprofiler_object/*.o)
  783. set_property(TARGET msprofiler_object PROPERTY IMPORTED_OBJECTS ${MSPROFILER_OBJECT_LIST})
  784. endif()
  785. target_compile_definitions(opensrc_ascendcl PRIVATE
  786. google=ascend_private
  787. )
  788. target_compile_options(opensrc_ascendcl PRIVATE
  789. -O2
  790. -fvisibility=hidden
  791. )
  792. target_link_options(opensrc_ascendcl PRIVATE
  793. -rdynamic
  794. -Wl,--allow-multiple-definition
  795. -Wl,-z,muldefs
  796. -Wl,-Bsymbolic
  797. -Wl,--exclude-libs,ALL
  798. )
  799. target_link_libraries(opensrc_ascendcl PRIVATE
  800. -Wl,--whole-archive
  801. ge_executor
  802. ge_common_static
  803. graph_static
  804. static_mmpa
  805. ascend_protobuf_static
  806. register_static
  807. error_manager_static
  808. adump_server
  809. -Wl,--no-whole-archive
  810. -Wl,--no-as-needed
  811. c_sec
  812. runtime
  813. slog
  814. ascend_hal_stub
  815. -Wl,--as-needed
  816. -lrt
  817. -ldl
  818. json
  819. )
  820. set_target_properties(opensrc_ascendcl PROPERTIES
  821. OUTPUT_NAME ascendcl
  822. )
  823. ##################################################################
  824. add_custom_command(
  825. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/stub_ge_ir_build.cc
  826. ${CMAKE_CURRENT_BINARY_DIR}/stub_ge_api.cc
  827. COMMAND echo "Generating stub files."
  828. && ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/stub/gen_stubapi.py ${GE_CODE_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR}
  829. && mv ge_ir_build.cc stub_ge_ir_build.cc
  830. && mv ge_api.cc stub_ge_api.cc
  831. && echo "Generating stub files end."
  832. #WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  833. #DEPENDS stub/gen_stubapi.py ${TOP_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR}
  834. )
  835. add_custom_target(ge_stub
  836. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stub_ge_ir_build.cc
  837. ${CMAKE_CURRENT_BINARY_DIR}/stub_ge_api.cc
  838. )
  839. ##################################################################
  840. ############ stub/libge_compiler.so ############
  841. add_library(atc_stub_ge_compiler SHARED
  842. stub_ge_ir_build.cc
  843. )
  844. add_dependencies(atc_stub_ge_compiler ge_stub)
  845. target_compile_options(atc_stub_ge_compiler PRIVATE
  846. -fno-common
  847. )
  848. target_link_libraries(atc_stub_ge_compiler PRIVATE
  849. $<BUILD_INTERFACE:intf_pub>
  850. )
  851. set_target_properties(atc_stub_ge_compiler PROPERTIES
  852. OUTPUT_NAME ge_compiler
  853. LIBRARY_OUTPUT_DIRECTORY atc_stub
  854. )
  855. target_include_directories(atc_stub_ge_compiler PRIVATE
  856. ${GE_CODE_DIR}/ge
  857. ${GE_CODE_DIR}/inc
  858. ${GE_CODE_DIR}/inc/framework
  859. ${GE_CODE_DIR}/inc/external
  860. ${METADEF_DIR}/inc/external
  861. ${METADEF_DIR}/inc
  862. #### yellow zone ####
  863. ${GE_CODE_DIR}/../inc
  864. ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external
  865. ${GE_CODE_DIR}/../abl/adump/external
  866. #### blue zone ####
  867. ${ASCEND_DIR}/driver/include
  868. ${ASCEND_DIR}/fwkacllib/include
  869. )
  870. ############ stub/libge_runner.so ############
  871. add_library(fwk_stub_ge_runner SHARED
  872. stub_ge_api.cc
  873. stub_ge_ir_build.cc
  874. )
  875. add_dependencies(fwk_stub_ge_runner ge_stub)
  876. target_compile_options(fwk_stub_ge_runner PRIVATE
  877. -fno-common
  878. )
  879. target_link_libraries(fwk_stub_ge_runner PRIVATE
  880. $<BUILD_INTERFACE:intf_pub>
  881. )
  882. set_target_properties(fwk_stub_ge_runner PROPERTIES
  883. OUTPUT_NAME ge_runner
  884. LIBRARY_OUTPUT_DIRECTORY fwk_stub
  885. )
  886. target_include_directories(fwk_stub_ge_runner PRIVATE
  887. ${GE_CODE_DIR}/ge
  888. ${GE_CODE_DIR}/inc
  889. ${GE_CODE_DIR}/inc/external
  890. ${GE_CODE_DIR}/inc/framework
  891. ${METADEF_DIR}/inc/external
  892. ${METADEF_DIR}/inc
  893. #### yellow zone ####
  894. ${GE_CODE_DIR}/../inc
  895. ${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external
  896. ${GE_CODE_DIR}/../abl/adump/external
  897. #### blue zone ####
  898. ${ASCEND_DIR}/driver/include
  899. ${ASCEND_DIR}/fwkacllib/include
  900. )
  901. ###############################################################
  902. add_custom_target(
  903. engine_conf.json ALL
  904. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/engine_conf.json
  905. )
  906. add_custom_command(
  907. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/engine_conf.json
  908. COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/engine_manager/engine_conf.json ${CMAKE_CURRENT_BINARY_DIR}/
  909. )
  910. ###############################################################
  911. add_custom_target(
  912. optimizer_priority.pbtxt ALL
  913. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt
  914. )
  915. add_custom_command(
  916. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt
  917. COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/opskernel_manager/optimizer_priority.pbtxt ${CMAKE_CURRENT_BINARY_DIR}/
  918. )
  919. ###############################################################
  920. ############ install ############
  921. set(INSTALL_BASE_DIR "")
  922. set(INSTALL_LIBRARY_DIR lib)
  923. install(TARGETS ge_runner ge_compiler ge_executor_shared opensrc_ascendcl OPTIONAL
  924. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
  925. )
  926. install(TARGETS atc_stub_ge_compiler fwk_stub_ge_runner OPTIONAL
  927. LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/stub
  928. )
  929. install(FILES
  930. ${CMAKE_CURRENT_BINARY_DIR}/engine_conf.json
  931. ${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt OPTIONAL
  932. DESTINATION ${INSTALL_LIBRARY_DIR}
  933. )
  934. endif()

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