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

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