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.

prof_acl_api.h 6.1 kB

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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /**
  2. * @file prof_acl_api.h
  3. *
  4. * Copyright (c) Huawei Technologies Co., Ltd. 2019-2022. All rights reserved.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. *
  10. */
  11. #ifndef MSPROFILER_API_PROF_ACL_API_H_
  12. #define MSPROFILER_API_PROF_ACL_API_H_
  13. #include <cstdint>
  14. #include <cstddef>
  15. // DataTypeConfig
  16. constexpr uint64_t PROF_ACL_API = 0x00000001ULL;
  17. constexpr uint64_t PROF_TASK_TIME = 0x00000002ULL;
  18. constexpr uint64_t PROF_AICORE_METRICS = 0x00000004ULL;
  19. constexpr uint64_t PROF_AICPU_TRACE = 0x00000008ULL;
  20. constexpr uint64_t PROF_L2CACHE = 0x00000010ULL;
  21. constexpr uint64_t PROF_HCCL_TRACE = 0x00000020ULL;
  22. constexpr uint64_t PROF_TRAINING_TRACE = 0x00000040ULL;
  23. constexpr uint64_t PROF_MSPROFTX = 0x00000080ULL;
  24. constexpr uint64_t PROF_RUNTIME_API = 0x00000100ULL;
  25. constexpr uint64_t PROF_TASK_FRAMEWORK = 0x00000200ULL;
  26. constexpr uint64_t PROF_TASK_TSFW = 0x00000400ULL;
  27. // system profilinig switch
  28. constexpr uint64_t PROF_CPU = 0x00010000ULL;
  29. constexpr uint64_t PROF_HARDWARE_MEMORY = 0x00020000ULL;
  30. constexpr uint64_t PROF_IO = 0x00040000ULL;
  31. constexpr uint64_t PROF_INTER_CONNECTION = 0x00080000ULL;
  32. constexpr uint64_t PROF_DVPP = 0x00100000ULL;
  33. constexpr uint64_t PROF_SYS_AICORE_SAMPLE = 0x00200000ULL;
  34. constexpr uint64_t PROF_AIVECTORCORE_SAMPLE = 0x00400000ULL;
  35. constexpr uint64_t PROF_MODEL_EXECUTE = 0x0000001000000ULL;
  36. constexpr uint64_t PROF_RUNTIME_TRACE = 0x0000004000000ULL;
  37. constexpr uint64_t PROF_SCHEDULE_TIMELINE = 0x0000008000000ULL;
  38. constexpr uint64_t PROF_SCHEDULE_TRACE = 0x0000010000000ULL;
  39. constexpr uint64_t PROF_AIVECTORCORE_METRICS = 0x0000020000000ULL;
  40. constexpr uint64_t PROF_SUBTASK_TIME = 0x0000040000000ULL;
  41. constexpr uint64_t PROF_OP_DETAIL = 0x0000080000000ULL;
  42. constexpr uint64_t PROF_AICPU_MODEL = 0x4000000000000000ULL;
  43. constexpr uint64_t PROF_MODEL_LOAD = 0x8000000000000000ULL;
  44. constexpr uint64_t PROF_TASK_TRACE = (PROF_MODEL_EXECUTE | PROF_RUNTIME_TRACE | PROF_TRAINING_TRACE |
  45. PROF_HCCL_TRACE | PROF_TASK_TIME);
  46. // DataTypeConfig MASK
  47. constexpr uint64_t PROF_ACL_API_MASK = 0x00000001ULL;
  48. constexpr uint64_t PROF_TASK_TIME_MASK = 0x00000002ULL;
  49. constexpr uint64_t PROF_AICORE_METRICS_MASK = 0x00000004ULL;
  50. constexpr uint64_t PROF_AICPU_TRACE_MASK = 0x00000008ULL;
  51. constexpr uint64_t PROF_L2CACHE_MASK = 0x00000010ULL;
  52. constexpr uint64_t PROF_HCCL_TRACE_MASK = 0x00000020ULL;
  53. constexpr uint64_t PROF_TRAINING_TRACE_MASK = 0x00000040ULL;
  54. constexpr uint64_t PROF_MSPROFTX_MASK = 0x00000080ULL;
  55. constexpr uint64_t PROF_RUNTIME_API_MASK = 0x00000100ULL;
  56. constexpr uint64_t PROF_TASK_FRAMEWORK_MASK = 0x00000200ULL;
  57. constexpr uint64_t PROF_TASK_TSFW_MASK = 0x00000400ULL;
  58. // system profilinig mask
  59. constexpr uint64_t PROF_CPU_MASK = 0x00010000ULL;
  60. constexpr uint64_t PROF_HARDWARE_MEMORY_MASK = 0x00020000ULL;
  61. constexpr uint64_t PROF_IO_MASK = 0x00040000ULL;
  62. constexpr uint64_t PROF_INTER_CONNECTION_MASK = 0x00080000ULL;
  63. constexpr uint64_t PROF_DVPP_MASK = 0x00100000ULL;
  64. constexpr uint64_t PROF_SYS_AICORE_SAMPLE_MASK = 0x00200000ULL;
  65. constexpr uint64_t PROF_AIVECTORCORE_SAMPLE_MASK = 0x00400000ULL;
  66. constexpr uint64_t PROF_MODEL_EXECUTE_MASK = 0x0000001000000ULL;
  67. constexpr uint64_t PROF_RUNTIME_TRACE_MASK = 0x0000004000000ULL;
  68. constexpr uint64_t PROF_SCHEDULE_TIMELINE_MASK = 0x0000008000000ULL;
  69. constexpr uint64_t PROF_SCHEDULE_TRACE_MASK = 0x0000010000000ULL;
  70. constexpr uint64_t PROF_AIVECTORCORE_METRICS_MASK = 0x0000020000000ULL;
  71. constexpr uint64_t PROF_SUBTASK_TIME_MASK = 0x0000040000000ULL;
  72. constexpr uint64_t PROF_OP_DETAIL_MASK = 0x0000080000000ULL;
  73. constexpr uint64_t PROF_AICPU_MODEL_MASK = 0x4000000000000000ULL;
  74. constexpr uint64_t PROF_MODEL_LOAD_MASK = 0x8000000000000000ULL;
  75. #if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER))
  76. #define MSVP_PROF_API __declspec(dllexport)
  77. #else
  78. #define MSVP_PROF_API __attribute__((visibility("default")))
  79. #endif
  80. namespace Msprofiler {
  81. namespace Api {
  82. /**
  83. * @name ProfGetOpExecutionTime
  84. * @brief get op execution time of specific part of data
  85. * @param data [IN] data read from pipe
  86. * @param len [IN] data length
  87. * @param index [IN] index of part(op)
  88. * @return op execution time (us)
  89. */
  90. MSVP_PROF_API uint64_t ProfGetOpExecutionTime(const void *data, uint32_t len, uint32_t index);
  91. }
  92. }
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif
  96. MSVP_PROF_API uint64_t ProfGetOpExecutionTime(const void *data, uint32_t len, uint32_t index);
  97. using Status = int32_t;
  98. typedef struct aclprofSubscribeConfig aclprofSubscribeConfig1;
  99. /**
  100. * @ingroup AscendCL
  101. * @brief subscribe profiling data of graph
  102. * @param [in] graphId: the graph id subscribed
  103. * @param [in] profSubscribeConfig: pointer to config of model subscribe
  104. * @return Status result of function
  105. */
  106. MSVP_PROF_API Status aclgrphProfGraphSubscribe(const uint32_t graphId,
  107. const aclprofSubscribeConfig1 *profSubscribeConfig);
  108. /**
  109. * @ingroup AscendCL
  110. * @brief unsubscribe profiling data of graph
  111. * @param [in] graphId: the graph id subscribed
  112. * @return Status result of function
  113. */
  114. MSVP_PROF_API Status aclgrphProfGraphUnSubscribe(const uint32_t graphId);
  115. /**
  116. * @ingroup AscendCL
  117. * @brief get graph id from subscription data
  118. *
  119. * @param opInfo [IN] pointer to subscription data
  120. * @param opInfoLen [IN] memory size of subscription data
  121. *
  122. * @retval graph id of subscription data
  123. * @retval 0 for failed
  124. */
  125. MSVP_PROF_API size_t aclprofGetGraphId(const void *opInfo, size_t opInfoLen, uint32_t index);
  126. /**
  127. * @ingroup AscendCL
  128. * @brief set stamp pay load
  129. *
  130. *
  131. * @retval void
  132. */
  133. MSVP_PROF_API int aclprofSetStampPayload(void *stamp, const int32_t type, void *value);
  134. /**
  135. * @ingroup AscendCL
  136. * @brief set category and name
  137. *
  138. *
  139. * @retval void
  140. */
  141. MSVP_PROF_API int aclprofSetCategoryName(uint32_t category, const char *categoryName);
  142. /**
  143. * @ingroup AscendCL
  144. * @brief set category to stamp
  145. *
  146. *
  147. * @retval void
  148. */
  149. MSVP_PROF_API int aclprofSetStampCategory(void *stamp, uint32_t category);
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif // MSPROFILER_API_PROF_ACL_API_H_

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