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.

task.proto 4.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /**
  2. * Copyright 2019-2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. syntax = "proto3";
  17. package domi;
  18. message ModelTaskDef {
  19. string version = 1;
  20. map<string, string> attr = 9; // Extended field
  21. repeated TaskDef task = 10;
  22. uint64 memory_size = 11;
  23. uint32 stream_num = 12;
  24. uint32 event_num = 13;
  25. uint64 weight_size = 14;
  26. repeated bytes op = 15; // input/output opdef in bytes
  27. uint64 base_addr = 16; // base addr
  28. uint64 weight_addr = 17; // weight addr
  29. uint32 batch_num = 18;
  30. }
  31. message TaskDef {
  32. uint32 id = 1;
  33. uint32 type = 2;
  34. uint32 stream_id = 10;
  35. uint32 event_id = 11;
  36. KernelDef kernel = 20;
  37. KernelExDef kernel_ex = 21;
  38. KernelHcclDef kernel_hccl = 25;
  39. EventExDef event_ex = 26;
  40. LogTimeStampDef log_timestamp = 28;
  41. uint32 label_id = 30;
  42. MemcpyAsyncDef memcpy_async = 31;
  43. StreamSwitchDef stream_switch = 32;
  44. StreamActiveDef stream_active = 33;
  45. bytes private_def = 34;
  46. uint64 ops_kernel_store_ptr = 35; // adjustments to other fields in the future
  47. StreamSwitchNDef stream_switch_n = 36;
  48. LabelSetDef label_set = 37;
  49. LabelGotoExDef label_goto_ex = 38;
  50. LabelSwitchByIndexDef label_switch_by_index = 39;
  51. }
  52. message KernelDef {
  53. KernelContext context = 1;
  54. string stub_func = 10;
  55. uint32 block_dim = 11;
  56. uint32 args_size = 12;
  57. bytes args = 13;
  58. bytes sm_desc = 14;
  59. bytes flowtable = 15;
  60. string so_name = 16;
  61. string kernel_name = 17;
  62. bytes kernel_ext_info = 18;
  63. uint32 kernel_ext_info_size = 19;
  64. }
  65. message KernelContext {
  66. uint32 kernel_type = 1;
  67. uint32 op_id = 2; // OP type in CCE
  68. uint32 kernel_func_id = 3;
  69. uint32 op_index = 4; // TE/Custom operator
  70. bool is_flowtable = 5; // Identify whether args is a flowtable structure
  71. bytes args_offset = 6; // args offset information
  72. uint32 args_count = 7; // args count
  73. repeated uint32 origin_op_index = 8;
  74. }
  75. message KernelExDef {
  76. uint32 flags = 1;
  77. uint32 op_index = 4;
  78. uint32 args_size = 12;
  79. bytes args = 13;
  80. bytes task_info = 14; // serialized nodeDef, funcDef, inputoutput
  81. uint32 task_info_size = 15;
  82. bytes kernel_ext_info = 16;
  83. uint32 kernel_ext_info_size = 17;
  84. }
  85. message KernelHcclDef {
  86. uint32 op_index = 8;
  87. string hccl_type = 9;
  88. }
  89. message EventExDef {
  90. uint32 op_index = 1;
  91. uint32 event_type = 2;
  92. }
  93. message LogTimeStampDef {
  94. uint64 logid = 1;
  95. bool notify = 2;
  96. uint32 flat = 3;
  97. }
  98. message MemcpyAsyncDef {
  99. uint64 dst = 1;
  100. uint64 dst_max = 2;
  101. uint64 src = 3;
  102. uint64 count = 4;
  103. uint32 kind = 5;
  104. uint32 op_index = 6;
  105. }
  106. message StreamSwitchDef {
  107. uint32 op_index = 1;
  108. uint32 true_stream_id = 2;
  109. int64 value = 3;
  110. uint64 value_ptr = 4;
  111. uint32 data_type = 5;
  112. }
  113. message StreamActiveDef {
  114. uint32 op_index = 1;
  115. uint32 active_stream_id = 2;
  116. }
  117. message StreamSwitchNDef {
  118. uint32 op_index = 1;
  119. uint32 size = 2;
  120. repeated int64 target_value = 3;
  121. repeated uint32 true_stream_id = 4;
  122. uint32 element_size = 5;
  123. uint32 data_type = 6;
  124. }
  125. message LabelSetDef {
  126. uint32 op_index = 1;
  127. uint32 label_id = 2;
  128. uint32 model_id = 3;
  129. }
  130. message LabelGotoExDef {
  131. uint32 op_index = 1;
  132. uint32 label_id = 2;
  133. uint32 model_id = 3;
  134. }
  135. message LabelSwitchByIndexDef {
  136. uint32 op_index = 1;
  137. uint32 label_max = 2;
  138. }

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