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

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

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