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.

ge_ir.proto 5.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. syntax = "proto3";
  2. package ge.proto;
  3. enum DataType
  4. {
  5. DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set.
  6. DT_FLOAT = 1; // float type
  7. DT_FLOAT16 = 2; // fp16 type
  8. DT_INT8 = 3; // int8 type
  9. DT_UINT8 = 4; // uint8 type
  10. DT_INT16 = 5; // int16 type
  11. DT_UINT16 = 6; // uint16 type
  12. DT_INT32 = 7; //
  13. DT_INT64 = 8; // int64 type
  14. DT_UINT32 = 9; // unsigned int32
  15. DT_UINT64 = 10; // unsigned int64
  16. DT_BOOL = 11; // bool type
  17. DT_DOUBLE = 12; // double type
  18. DT_STRING = 13; // string type
  19. DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */
  20. DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */
  21. DT_COMPLEX64 = 16; // complex64 type
  22. DT_COMPLEX128 = 17; // complex128 type
  23. DT_QINT8 = 18; // qint8 type
  24. DT_QINT16 = 19; // qint16 type
  25. DT_QINT32 = 20; // qint32 type
  26. DT_QUINT8 = 21; // quint8 type
  27. DT_QUINT16 = 22; // quint16 type
  28. DT_RESOURCE = 23; // resource type
  29. DT_STRING_REF = 24; // string_ref type
  30. DT_DUAL = 25; /**< dual output type */
  31. }
  32. message AttrDef
  33. {
  34. message ListValue
  35. {
  36. enum ListValueType{
  37. VT_LIST_NONE = 0;
  38. VT_LIST_STRING = 1;
  39. VT_LIST_INT = 2;
  40. VT_LIST_FLOAT = 3;
  41. VT_LIST_BOOL = 4;
  42. VT_LIST_BYTES = 5;
  43. VT_LIST_TENSOR_DESC = 6;
  44. VT_LIST_TENSOR = 7;
  45. VT_LIST_GRAPH = 8;
  46. VT_LIST_NAMED_ATTRS = 9;
  47. VT_LIST_DATA_TYPE = 10;
  48. }
  49. repeated bytes s = 2; // "list(string)"
  50. repeated int64 i = 3; // "list(int)"
  51. repeated float f = 4; // "list(float)"
  52. repeated bool b = 5; // "list(bool)"
  53. repeated bytes bt = 7;
  54. repeated TensorDescriptor td = 8;
  55. repeated TensorDef t = 9;
  56. repeated GraphDef g = 10;
  57. repeated NamedAttrs na = 11;
  58. repeated int64 dt = 12; // list ge::DataType
  59. ListValueType val_type = 20;
  60. }
  61. message ListListInt{
  62. message ListInt{
  63. repeated int64 list_i = 1; // list int
  64. }
  65. repeated ListInt list_list_i = 1; // list list int
  66. }
  67. oneof value
  68. {
  69. bytes s = 2; // "string"
  70. int64 i = 3; // "int"
  71. float f = 4; // "float"
  72. bool b = 5; // "bool"
  73. bytes bt = 7;
  74. ListValue list = 1; // any "list(...)"
  75. NamedAttrs func = 10; // Used to support attr nesting
  76. TensorDescriptor td = 11; // GeTensorDesc type
  77. TensorDef t = 12; // GeTensor type
  78. GraphDef g = 13; // Graph type
  79. ListListInt list_list_int = 14; // List List Int type
  80. int64 dt = 15; // ge::DataType
  81. }
  82. }
  83. // A list of attr names and their values. The whole list is attached
  84. // with a string name. E.g., MatMul[T=float].
  85. message NamedAttrs
  86. {
  87. string name = 1;
  88. map<string, AttrDef> attr = 2;
  89. }
  90. // Shape / dimension description, using row-major order
  91. message ShapeDef
  92. {
  93. repeated int64 dim = 1; // Size of each dimension
  94. }
  95. // Multidimensional data description
  96. message TensorDescriptor
  97. {
  98. string name = 1; // Optional parameter, tensor name
  99. DataType dtype = 2; // tensor datatype
  100. ShapeDef shape = 3; // Shape / dimension
  101. string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND"
  102. bool has_out_attr = 9;
  103. int64 size = 10;
  104. int64 weight_size = 11;
  105. bool reuse_input = 12;
  106. bool output_tensor = 13;
  107. string device_type = 14;
  108. bool input_tensor =15;
  109. int64 real_dim_cnt = 16;
  110. int64 reuse_input_index = 17;
  111. int64 data_offset = 18;
  112. int64 cmps_size = 19;
  113. string cmps_tab = 20;
  114. int64 cmps_tab_offset = 21;
  115. map<string, AttrDef> attr = 5; // Set of extra parameter fields
  116. }
  117. // GeTensor definition
  118. message TensorDef
  119. {
  120. TensorDescriptor desc = 1; // Tensor description
  121. bytes data = 2; // Tensor data
  122. }
  123. // Operator description
  124. message OpDef
  125. {
  126. string name = 1; // name
  127. string type = 2; // type
  128. repeated string input = 5; // input original op name + outgoing index. op_name:index
  129. map<string, AttrDef> attr = 10; // Set of operator parameter fields
  130. bool has_out_attr = 20;
  131. int64 id = 21;
  132. int64 stream_id =22;
  133. repeated string input_name = 23;
  134. repeated string src_name = 24;
  135. repeated int64 src_index = 25;
  136. repeated string dst_name = 26;
  137. repeated int64 dst_index = 27;
  138. repeated int64 input_i = 28;
  139. repeated int64 output_i = 29;
  140. repeated int64 workspace = 30;
  141. repeated int64 workspace_bytes = 31;
  142. repeated bool is_input_const = 32;
  143. repeated TensorDescriptor input_desc = 33;
  144. repeated TensorDescriptor output_desc = 34;
  145. repeated string subgraph_name = 35;
  146. }
  147. // Graph definition
  148. message GraphDef
  149. {
  150. string name = 1; // name
  151. repeated string input = 4; // Graph input
  152. repeated string output = 5; // Graph output
  153. repeated OpDef op = 6; // List of operators
  154. map<string, AttrDef> attr = 11; // Extended field
  155. }
  156. // model definition
  157. message ModelDef
  158. {
  159. string name = 1; // name
  160. uint32 version = 2; // IR Proto verion
  161. string custom_version = 3; // User model version number, passed in by user
  162. repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef
  163. map<string, AttrDef> attr = 11; // Extended field
  164. }

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