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.

cce.h 2.7 kB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #ifndef CCE_H__
  17. #define CCE_H__
  18. #include <stdint.h>
  19. #include "cce_def.hpp"
  20. namespace cce {
  21. /**
  22. * @ingroup cce
  23. * @brief create cc handler
  24. * @param [in|out] handle point of cc handler
  25. * @return ccStatus_t
  26. */
  27. ccStatus_t ccCreate(ccHandle_t *handle);
  28. /**
  29. * @ingroup cce
  30. * @brief destroy cc handler
  31. * @param [in] *handle cc handler
  32. * @return ccStatus_t
  33. */
  34. ccStatus_t ccDestroy(ccHandle_t *handle);
  35. /**
  36. * @ingroup cce
  37. * @brief bind stream with specified cc handler
  38. * @param [in] handle cc handler
  39. * @param [in] streamId stream
  40. * @return ccStatus_t
  41. */
  42. ccStatus_t ccSetStream(ccHandle_t handle, rtStream_t streamId);
  43. /**
  44. * @ingroup cce
  45. * @brief get the stream from cc handler
  46. * @param [in] handle cc handler
  47. * @param [in|out] streamId point of stream
  48. * @return ccStatus_t
  49. */
  50. ccStatus_t ccGetStream(ccHandle_t handle, rtStream_t *streamId);
  51. /**
  52. * @ingroup cce
  53. * @brief get the stream from cc handler
  54. * @param [in] dataTypeTransMode mode of data type transform
  55. * @param [in] inputData input data point
  56. * @param [in] inputDataSize input data size
  57. * @param [in|out] outputData output data point
  58. * @param [in] outputDataSize output data size
  59. * @return ccStatus_t
  60. */
  61. ccStatus_t ccTransDataType(ccDataTypeTransMode_t dataTypeTransMode, const void *inputData, uint32_t inputDataSize,
  62. void *outputData, const uint32_t outputDataSize);
  63. /**
  64. * @ingroup cce
  65. * @brief cce sys init func
  66. */
  67. void cceSysInit();
  68. /**
  69. * @ingroup cce
  70. * @brief cce Log Start up func
  71. */
  72. void cceLogStartup();
  73. /**
  74. * @ingroup cce
  75. * @brief cce Log Shut down func
  76. */
  77. void cceLogShutdown();
  78. /**
  79. * @ingroup cce
  80. * @brief set the profiling on or off
  81. * @param [in] const unsigned char* target: The engine gets it from ENV. Don't need care about it.
  82. * @param const char* job_ctx: identifies profiling job
  83. * @param [in] uint32_t flag: value: 0, on ; 1, off.
  84. * @return ccStatus_t value: 0, success; 1, fail.
  85. */
  86. ccStatus_t CceProfilingConfig(const char *target, const char *job_ctx, uint32_t flag);
  87. }; // namespace cce
  88. #endif // CCE_H__

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