mindspore 2.4.10__cp310-cp310-manylinux1_x86_64.whl → 2.5.0__cp310-cp310-manylinux1_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mindspore might be problematic. Click here for more details.

Files changed (705) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Third_Party_Open_Source_Software_Notice +39 -0
  3. mindspore/__init__.py +8 -3
  4. mindspore/_akg/akg/composite/build_module.py +6 -2
  5. mindspore/_akg/akg/utils/kernel_exec.py +2 -2
  6. mindspore/_c_dataengine.cpython-310-x86_64-linux-gnu.so +0 -0
  7. mindspore/_c_expression.cpython-310-x86_64-linux-gnu.so +0 -0
  8. mindspore/_c_mindrecord.cpython-310-x86_64-linux-gnu.so +0 -0
  9. mindspore/_checkparam.py +0 -5
  10. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  11. mindspore/_extends/parse/compile_config.py +64 -0
  12. mindspore/_extends/parse/deprecated/__init__.py +0 -0
  13. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +375 -0
  14. mindspore/_extends/parse/parser.py +23 -5
  15. mindspore/_extends/parse/standard_method.py +123 -27
  16. mindspore/_extends/pijit/pijit_func_white_list.py +1 -1
  17. mindspore/amp.py +7 -1
  18. mindspore/boost/boost_cell_wrapper.py +136 -41
  19. mindspore/common/__init__.py +3 -1
  20. mindspore/common/_register_for_tensor.py +0 -1
  21. mindspore/common/_stub_tensor.py +25 -4
  22. mindspore/common/_tensor_cpp_method.py +17 -0
  23. mindspore/common/_tensor_docs.py +6132 -0
  24. mindspore/common/api.py +98 -21
  25. mindspore/common/dtype.py +34 -34
  26. mindspore/common/dump.py +2 -1
  27. mindspore/common/file_system.py +8 -3
  28. mindspore/common/generator.py +2 -0
  29. mindspore/common/hook_handle.py +3 -1
  30. mindspore/common/initializer.py +3 -4
  31. mindspore/common/lazy_inline.py +8 -2
  32. mindspore/common/mindir_util.py +10 -2
  33. mindspore/common/parameter.py +31 -15
  34. mindspore/common/tensor.py +713 -1337
  35. mindspore/communication/__init__.py +1 -1
  36. mindspore/communication/_comm_helper.py +5 -0
  37. mindspore/communication/comm_func.py +215 -173
  38. mindspore/communication/management.py +23 -20
  39. mindspore/context.py +285 -191
  40. mindspore/dataset/__init__.py +23 -19
  41. mindspore/dataset/callback/ds_callback.py +2 -1
  42. mindspore/dataset/core/config.py +84 -3
  43. mindspore/dataset/engine/cache_admin.py +3 -3
  44. mindspore/dataset/engine/cache_client.py +5 -4
  45. mindspore/dataset/engine/datasets.py +192 -149
  46. mindspore/dataset/engine/datasets_audio.py +14 -0
  47. mindspore/dataset/engine/datasets_standard_format.py +11 -11
  48. mindspore/dataset/engine/datasets_text.py +38 -1
  49. mindspore/dataset/engine/datasets_user_defined.py +100 -66
  50. mindspore/dataset/engine/datasets_vision.py +81 -8
  51. mindspore/dataset/engine/iterators.py +281 -63
  52. mindspore/dataset/engine/obs/util.py +8 -0
  53. mindspore/dataset/engine/queue.py +40 -0
  54. mindspore/dataset/engine/samplers.py +26 -2
  55. mindspore/dataset/engine/serializer_deserializer.py +1 -1
  56. mindspore/dataset/engine/validators.py +43 -11
  57. mindspore/dataset/transforms/py_transforms_util.py +17 -0
  58. mindspore/dataset/transforms/transforms.py +29 -12
  59. mindspore/dataset/vision/validators.py +1 -2
  60. mindspore/device_context/__init__.py +21 -0
  61. mindspore/device_context/ascend/__init__.py +25 -0
  62. mindspore/device_context/ascend/device.py +72 -0
  63. mindspore/device_context/ascend/op_debug.py +94 -0
  64. mindspore/device_context/ascend/op_precision.py +193 -0
  65. mindspore/device_context/ascend/op_tuning.py +127 -0
  66. mindspore/device_context/cpu/__init__.py +25 -0
  67. mindspore/device_context/cpu/device.py +62 -0
  68. mindspore/device_context/cpu/op_tuning.py +43 -0
  69. mindspore/device_context/gpu/__init__.py +21 -0
  70. mindspore/device_context/gpu/device.py +70 -0
  71. mindspore/device_context/gpu/op_precision.py +67 -0
  72. mindspore/device_context/gpu/op_tuning.py +175 -0
  73. mindspore/device_manager.py +134 -0
  74. mindspore/experimental/llm_boost/__init__.py +1 -0
  75. mindspore/experimental/llm_boost/ascend_native/__init__.py +22 -0
  76. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +211 -0
  77. mindspore/experimental/llm_boost/ascend_native/llm_boost.py +52 -0
  78. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  79. mindspore/experimental/llm_boost/atb/llama_boost.py +6 -1
  80. mindspore/experimental/llm_boost/register.py +1 -0
  81. mindspore/experimental/optim/adadelta.py +26 -22
  82. mindspore/experimental/optim/adam.py +3 -0
  83. mindspore/experimental/optim/lr_scheduler.py +33 -24
  84. mindspore/experimental/optim/radam.py +33 -30
  85. mindspore/hal/device.py +28 -0
  86. mindspore/hal/event.py +17 -0
  87. mindspore/hal/memory.py +94 -3
  88. mindspore/hal/stream.py +91 -6
  89. mindspore/include/api/context.h +0 -1
  90. mindspore/lib/libavcodec.so.59 +0 -0
  91. mindspore/lib/libavdevice.so.59 +0 -0
  92. mindspore/lib/libavfilter.so.8 +0 -0
  93. mindspore/lib/libavformat.so.59 +0 -0
  94. mindspore/lib/libavutil.so.57 +0 -0
  95. mindspore/lib/libdnnl.so.2 +0 -0
  96. mindspore/lib/libmindspore_backend.so +0 -0
  97. mindspore/lib/libmindspore_common.so +0 -0
  98. mindspore/lib/libmindspore_core.so +0 -0
  99. mindspore/lib/libmindspore_gpr.so.15 +0 -0
  100. mindspore/lib/libmindspore_grpc++.so.1 +0 -0
  101. mindspore/lib/libmindspore_grpc.so.15 +0 -0
  102. mindspore/lib/libmindspore_ops.so +0 -0
  103. mindspore/lib/libmpi_adapter.so +0 -0
  104. mindspore/lib/libmpi_collective.so +0 -0
  105. mindspore/lib/libnnacl.so +0 -0
  106. mindspore/lib/libopencv_core.so.4.5 +0 -0
  107. mindspore/lib/libopencv_imgcodecs.so.4.5 +0 -0
  108. mindspore/lib/libopencv_imgproc.so.4.5 +0 -0
  109. mindspore/lib/libps_cache.so +0 -0
  110. mindspore/lib/libswresample.so.4 +0 -0
  111. mindspore/lib/libswscale.so.6 +0 -0
  112. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend910_93/aic-ascend910_93-ops-info.json +2048 -0
  113. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
  114. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
  115. mindspore/lib/plugin/ascend/custom_ascendc_910/op_api/lib/libcust_opapi.so +0 -0
  116. mindspore/lib/plugin/ascend/custom_ascendc_910/op_impl/ai_core/tbe/custom_ascendc_910_impl/dynamic/decoder_kv_cache.py +1 -1
  117. mindspore/lib/plugin/ascend/custom_ascendc_910/op_impl/ai_core/tbe/custom_ascendc_910_impl/dynamic/prompt_kv_cache.py +1 -1
  118. mindspore/lib/plugin/ascend/custom_ascendc_910/op_impl/ai_core/tbe/op_tiling/lib/linux/x86_64/libcust_opmaster_rt2.0.so +0 -0
  119. mindspore/lib/plugin/ascend/custom_ascendc_910/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
  120. mindspore/lib/plugin/ascend/custom_ascendc_910/op_proto/lib/linux/x86_64/libcust_opsproto_rt2.0.so +0 -0
  121. mindspore/lib/plugin/ascend/custom_ascendc_910/version.info +1 -1
  122. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_api/lib/libcust_opapi.so +0 -0
  123. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/config/ascend910_93/aic-ascend910_93-ops-info.json +224 -0
  124. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/custom_ascendc_910b_impl/dynamic/all_finite.py +1 -1
  125. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/custom_ascendc_910b_impl/dynamic/decoder_kv_cache.py +1 -1
  126. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/custom_ascendc_910b_impl/dynamic/prompt_kv_cache.py +1 -1
  127. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/all_finite/AllFinite_52f59e2a65d9b1bb002de35c2819754a.json +78 -0
  128. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/all_finite/AllFinite_52f59e2a65d9b1bb002de35c2819754a.o +0 -0
  129. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/all_finite/AllFinite_6b5e50e30256d85838d6ce83514df20f.json +78 -0
  130. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/all_finite/AllFinite_6b5e50e30256d85838d6ce83514df20f.o +0 -0
  131. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/all_finite/AllFinite_74e4ac02880d452e3308c94af273562e.json +78 -0
  132. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/all_finite/AllFinite_74e4ac02880d452e3308c94af273562e.o +0 -0
  133. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_0d5520cc587ad44ce634bf3fbcffc272.json +156 -0
  134. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_0d5520cc587ad44ce634bf3fbcffc272.o +0 -0
  135. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_20390d30b3c4c0d23167ccca6c030c2b.json +156 -0
  136. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_20390d30b3c4c0d23167ccca6c030c2b.o +0 -0
  137. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_2d151f0b1d2db51faa2968d5b67544e2.json +156 -0
  138. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_2d151f0b1d2db51faa2968d5b67544e2.o +0 -0
  139. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_561690ec17cc1def3d2fcf68c1b07b56.json +156 -0
  140. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_561690ec17cc1def3d2fcf68c1b07b56.o +0 -0
  141. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_570f9aaa99e5e773b3dd0a33784363f4.json +156 -0
  142. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_570f9aaa99e5e773b3dd0a33784363f4.o +0 -0
  143. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_59668a0f0764afb98fda8ab9e84126f1.json +156 -0
  144. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_59668a0f0764afb98fda8ab9e84126f1.o +0 -0
  145. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_91d9833e4792b70b670e4e2b916abd86.json +156 -0
  146. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_91d9833e4792b70b670e4e2b916abd86.o +0 -0
  147. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_c74cdc5fef094383401856f8519504af.json +156 -0
  148. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/decoder_kv_cache/DecoderKvCache_c74cdc5fef094383401856f8519504af.o +0 -0
  149. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_0515c7b1a4cd614449e38c5e9a7e3f8d.json +165 -0
  150. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_0515c7b1a4cd614449e38c5e9a7e3f8d.o +0 -0
  151. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_09f22d898d6358c91e7c4fc48bac48e7.json +165 -0
  152. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_09f22d898d6358c91e7c4fc48bac48e7.o +0 -0
  153. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_0cb9a6f894b925250227136e5aab7061.json +165 -0
  154. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_0cb9a6f894b925250227136e5aab7061.o +0 -0
  155. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_2fa8702ffd7ca85e9e194f62644415d5.json +165 -0
  156. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_2fa8702ffd7ca85e9e194f62644415d5.o +0 -0
  157. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_570b62f187dfd439b64613d881deedb7.json +165 -0
  158. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_570b62f187dfd439b64613d881deedb7.o +0 -0
  159. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_585218c11411ff84709b9e725b66c435.json +165 -0
  160. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_585218c11411ff84709b9e725b66c435.o +0 -0
  161. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_5c9365ccde170b358c5b126d69dae13e.json +165 -0
  162. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_5c9365ccde170b358c5b126d69dae13e.o +0 -0
  163. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_6d97c45b7c43bc16fcff8baa5dacac4e.json +165 -0
  164. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/ascend910_93/prompt_kv_cache/PromptKvCache_6d97c45b7c43bc16fcff8baa5dacac4e.o +0 -0
  165. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/config/ascend910_93/all_finite.json +139 -0
  166. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/config/ascend910_93/binary_info_config.json +361 -0
  167. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/config/ascend910_93/decoder_kv_cache.json +892 -0
  168. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/kernel/config/ascend910_93/prompt_kv_cache.json +892 -0
  169. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/op_tiling/lib/linux/x86_64/libcust_opmaster_rt2.0.so +0 -0
  170. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
  171. mindspore/lib/plugin/ascend/custom_ascendc_910b/op_proto/lib/linux/x86_64/libcust_opsproto_rt2.0.so +0 -0
  172. mindspore/lib/plugin/ascend/custom_ascendc_910b/version.info +1 -1
  173. mindspore/lib/plugin/ascend/custom_compiler/setup.py +1 -1
  174. mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
  175. mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
  176. mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
  177. mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
  178. mindspore/lib/plugin/ascend/libmindspore_internal_kernels.so +0 -0
  179. mindspore/lib/plugin/ascend/libms_ascend_native_boost.so +0 -0
  180. mindspore/lib/plugin/ascend/libms_atb_boost.so +0 -0
  181. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +960 -958
  182. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{acme/include/base_type.h → base_type.h} +25 -20
  183. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{cast/cast_tiling.h → internal.h} +6 -4
  184. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_op.h +114 -0
  185. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/llm/boost_kernel.h +70 -0
  186. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/llm/llama_impl.h +85 -0
  187. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/llm/model_interface.h +52 -0
  188. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/llm/tensor.h +81 -0
  189. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_creator.h +123 -0
  190. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +155 -110
  191. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{acme/include/tiling_info.h → tiling_info.h} +12 -9
  192. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tiling_utils.h +178 -0
  193. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layer_norm_op.so +0 -0
  194. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_op.so +0 -0
  195. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_quant_op.so +0 -0
  196. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_310p_op.so +0 -0
  197. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_op.so +0 -0
  198. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_op.so +0 -0
  199. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcompare_op.so +0 -0
  200. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_op.so +0 -0
  201. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libllama_op.so +0 -0
  202. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_op.so +0 -0
  203. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
  204. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_optiling.so +0 -0
  205. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmulti_weight_matmul_kernel_op.so +0 -0
  206. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_nz_op.so +0 -0
  207. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_op.so +0 -0
  208. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_op.so +0 -0
  209. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/object_kernels/internal_pp_matmul_f16_nz/internal_pp_matmul_f16_nz.o +0 -0
  210. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/object_kernels/internal_pp_matmul_f16_nz/internal_pp_matmul_f16_nz_0.o +0 -0
  211. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/object_kernels/internal_pp_matmul_i8_nz_compress/internal_pp_matmul_i8_nz_compress.o +0 -0
  212. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/object_kernels/internal_pp_matmul_i8_nz_compress/internal_pp_matmul_i8_nz_compress_0.o +0 -0
  213. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/object_kernels/internal_pp_matmul_int8_nz/internal_pp_matmul_int8_nz.o +0 -0
  214. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/object_kernels/internal_pp_matmul_int8_nz/internal_pp_matmul_int8_nz_0.o +0 -0
  215. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/so_kernels/libadd_rms_norm_quant_ascend310p.so +0 -0
  216. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libapply_rotary_pos_emb_310p_impl.so → op_kernels/ascend310p/so_kernels/libapply_rotary_pos_emb_310p_ascend310p.so} +0 -0
  217. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/so_kernels/libcast_ascend310p.so +0 -0
  218. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/so_kernels/libcompare_ascend310p.so +0 -0
  219. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/so_kernels/libgelu_ascend310p.so +0 -0
  220. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/so_kernels/libmatmul_ascend310p.so +0 -0
  221. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend310p/so_kernels/libreshape_and_cache_nz_ascend310p.so +0 -0
  222. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/hphol_kernels/add_rms_norm_dynamic_quant/AddRmsNormDynamicQuant_4b60f88cdc28b25a36bad2d8b0a88092.json +163 -0
  223. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/hphol_kernels/add_rms_norm_dynamic_quant/AddRmsNormDynamicQuant_4b60f88cdc28b25a36bad2d8b0a88092.o +0 -0
  224. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/hphol_kernels/add_rms_norm_dynamic_quant/AddRmsNormDynamicQuant_cde61da2bd6fededcb1ba310a6ad16ee.json +163 -0
  225. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/hphol_kernels/add_rms_norm_dynamic_quant/AddRmsNormDynamicQuant_cde61da2bd6fededcb1ba310a6ad16ee.o +0 -0
  226. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
  227. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
  228. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_bf16_bsh_full_mix.o +0 -0
  229. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
  230. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
  231. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
  232. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_fp16_bsh_full_mix.o +0 -0
  233. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/flash_attention_score/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
  234. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/internal_matmul_postfusion_mix/internal_matmul_postfusion_mix.o +0 -0
  235. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/internal_matmul_postfusion_mix/internal_matmul_postfusion_mix_mix_aic_0.o +0 -0
  236. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/internal_matmul_postfusion_mix/internal_matmul_postfusion_mix_mix_aiv_0.o +0 -0
  237. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/internal_multi_weight_matmul_postfusion_mix/internal_multi_weight_matmul_postfusion_mix.o +0 -0
  238. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/internal_multi_weight_matmul_postfusion_mix/internal_multi_weight_matmul_postfusion_mix_mix_aic_0.o +0 -0
  239. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/internal_multi_weight_matmul_postfusion_mix/internal_multi_weight_matmul_postfusion_mix_mix_aiv_0.o +0 -0
  240. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/matmul_add_rmsnorm/matmul_add_rmsnorm_bf16_bf16.o +0 -0
  241. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/matmul_add_rmsnorm/matmul_add_rmsnorm_bf16_fp16.o +0 -0
  242. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/matmul_add_rmsnorm/matmul_add_rmsnorm_bf16_fp32.o +0 -0
  243. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/matmul_add_rmsnorm/matmul_add_rmsnorm_fp16_bf16.o +0 -0
  244. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/matmul_add_rmsnorm/matmul_add_rmsnorm_fp16_fp16.o +0 -0
  245. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/matmul_add_rmsnorm/matmul_add_rmsnorm_fp16_fp32.o +0 -0
  246. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/paged_attention_v2/paged_attention_v2.o +0 -0
  247. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/paged_attention_v2/paged_attention_v2_mix_aic_0.o +0 -0
  248. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/object_kernels/paged_attention_v2/paged_attention_v2_mix_aiv_0.o +0 -0
  249. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/so_kernels/libadd_layer_norm_ascend910b.so +0 -0
  250. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libadd_rms_norm_impl.so → op_kernels/ascend910b/so_kernels/libadd_rms_norm_ascend910b.so} +0 -0
  251. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/so_kernels/libadd_rms_norm_quant_ascend910b.so +0 -0
  252. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libapply_rotary_pos_emb_impl.so → op_kernels/ascend910b/so_kernels/libapply_rotary_pos_emb_ascend910b.so} +0 -0
  253. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libcast_impl.so → op_kernels/ascend910b/so_kernels/libcast_ascend910b.so} +0 -0
  254. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libnot_equal_impl.so → op_kernels/ascend910b/so_kernels/libcompare_ascend910b.so} +0 -0
  255. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libgelu_impl.so → op_kernels/ascend910b/so_kernels/libgelu_ascend910b.so} +0 -0
  256. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/so_kernels/libllama_ascend910b.so +0 -0
  257. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libmatmul_impl.so → op_kernels/ascend910b/so_kernels/libmatmul_ascend910b.so} +0 -0
  258. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libmulti_weight_matmul_kernel_impl.so → op_kernels/ascend910b/so_kernels/libmulti_weight_matmul_kernel_ascend910b.so} +0 -0
  259. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/libreshape_and_cache_impl.so → op_kernels/ascend910b/so_kernels/libreshape_and_cache_ascend910b.so} +0 -0
  260. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/{lib/librms_norm_impl.so → op_kernels/ascend910b/so_kernels/librms_norm_ascend910b.so} +0 -0
  261. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
  262. mindspore/lib/plugin/gpu/libcuda_ops.so.10 +0 -0
  263. mindspore/lib/plugin/gpu/libcuda_ops.so.11 +0 -0
  264. mindspore/lib/plugin/gpu10.1/libnccl.so.2 +0 -0
  265. mindspore/lib/plugin/gpu10.1/libnvidia_collective.so +0 -0
  266. mindspore/lib/plugin/gpu11.1/libnccl.so.2 +0 -0
  267. mindspore/lib/plugin/gpu11.1/libnvidia_collective.so +0 -0
  268. mindspore/lib/plugin/gpu11.6/libnccl.so.2 +0 -0
  269. mindspore/lib/plugin/gpu11.6/libnvidia_collective.so +0 -0
  270. mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
  271. mindspore/lib/plugin/libmindspore_gpu.so.10.1 +0 -0
  272. mindspore/lib/plugin/libmindspore_gpu.so.11.1 +0 -0
  273. mindspore/lib/plugin/libmindspore_gpu.so.11.6 +0 -0
  274. mindspore/log.py +12 -0
  275. mindspore/mindrecord/__init__.py +1 -1
  276. mindspore/mindrecord/config.py +17 -316
  277. mindspore/mindrecord/filereader.py +1 -9
  278. mindspore/mindrecord/filewriter.py +5 -15
  279. mindspore/mindrecord/mindpage.py +1 -9
  280. mindspore/mint/__init__.py +824 -218
  281. mindspore/mint/distributed/__init__.py +66 -4
  282. mindspore/mint/distributed/distributed.py +2594 -44
  283. mindspore/mint/linalg/__init__.py +6 -0
  284. mindspore/mint/nn/__init__.py +473 -14
  285. mindspore/mint/nn/functional.py +486 -11
  286. mindspore/mint/nn/layer/__init__.py +17 -4
  287. mindspore/mint/nn/layer/_functions.py +330 -0
  288. mindspore/mint/nn/layer/activation.py +169 -1
  289. mindspore/mint/nn/layer/basic.py +123 -0
  290. mindspore/mint/nn/layer/conv.py +727 -0
  291. mindspore/mint/nn/layer/normalization.py +215 -19
  292. mindspore/mint/nn/layer/padding.py +797 -0
  293. mindspore/mint/nn/layer/pooling.py +170 -0
  294. mindspore/mint/optim/__init__.py +2 -1
  295. mindspore/mint/optim/adam.py +223 -0
  296. mindspore/mint/optim/adamw.py +26 -19
  297. mindspore/mint/special/__init__.py +2 -1
  298. mindspore/multiprocessing/__init__.py +5 -0
  299. mindspore/nn/cell.py +126 -19
  300. mindspore/nn/dynamic_lr.py +2 -1
  301. mindspore/nn/layer/activation.py +6 -6
  302. mindspore/nn/layer/basic.py +35 -25
  303. mindspore/nn/layer/channel_shuffle.py +3 -3
  304. mindspore/nn/layer/embedding.py +3 -3
  305. mindspore/nn/layer/normalization.py +8 -7
  306. mindspore/nn/layer/padding.py +4 -3
  307. mindspore/nn/layer/pooling.py +47 -13
  308. mindspore/nn/layer/rnn_cells.py +1 -1
  309. mindspore/nn/layer/rnns.py +2 -1
  310. mindspore/nn/layer/timedistributed.py +5 -5
  311. mindspore/nn/layer/transformer.py +48 -26
  312. mindspore/nn/learning_rate_schedule.py +5 -3
  313. mindspore/nn/loss/loss.py +31 -36
  314. mindspore/nn/optim/ada_grad.py +1 -0
  315. mindspore/nn/optim/adadelta.py +2 -2
  316. mindspore/nn/optim/adam.py +1 -1
  317. mindspore/nn/optim/lars.py +1 -4
  318. mindspore/nn/optim/optimizer.py +1 -1
  319. mindspore/nn/optim/rprop.py +2 -2
  320. mindspore/nn/optim/thor.py +2 -1
  321. mindspore/nn/utils/init.py +13 -11
  322. mindspore/nn/wrap/cell_wrapper.py +4 -6
  323. mindspore/nn/wrap/loss_scale.py +3 -4
  324. mindspore/numpy/array_creations.py +60 -62
  325. mindspore/numpy/array_ops.py +148 -143
  326. mindspore/numpy/logic_ops.py +41 -42
  327. mindspore/numpy/math_ops.py +361 -359
  328. mindspore/numpy/utils.py +16 -16
  329. mindspore/numpy/utils_const.py +4 -4
  330. mindspore/ops/__init__.py +2 -1
  331. mindspore/ops/_grad_experimental/grad_comm_ops.py +94 -13
  332. mindspore/ops/_grad_experimental/grad_debug_ops.py +6 -1
  333. mindspore/ops/_grad_experimental/grad_inner_ops.py +9 -0
  334. mindspore/ops/_grad_experimental/grad_math_ops.py +2 -1
  335. mindspore/ops/_op_impl/cpu/__init__.py +1 -0
  336. mindspore/ops/_op_impl/cpu/raise_op.py +28 -0
  337. mindspore/ops/_vmap/vmap_array_ops.py +20 -19
  338. mindspore/ops/_vmap/vmap_base.py +0 -2
  339. mindspore/ops/_vmap/vmap_grad_nn_ops.py +19 -13
  340. mindspore/ops/_vmap/vmap_math_ops.py +11 -9
  341. mindspore/ops/_vmap/vmap_nn_ops.py +20 -34
  342. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +149 -12
  343. mindspore/ops/auto_generate/gen_arg_handler.py +0 -61
  344. mindspore/ops/auto_generate/gen_extend_func.py +554 -60
  345. mindspore/ops/auto_generate/gen_ops_def.py +1621 -115
  346. mindspore/ops/auto_generate/gen_ops_prim.py +8024 -3409
  347. mindspore/ops/auto_generate/pyboost_inner_prim.py +183 -79
  348. mindspore/ops/composite/base.py +1 -1
  349. mindspore/ops/composite/multitype_ops/_compile_utils.py +229 -30
  350. mindspore/ops/composite/multitype_ops/pow_impl.py +0 -29
  351. mindspore/ops/function/__init__.py +12 -0
  352. mindspore/ops/function/array_func.py +561 -159
  353. mindspore/ops/function/clip_func.py +64 -0
  354. mindspore/ops/function/debug_func.py +28 -20
  355. mindspore/ops/function/image_func.py +1 -1
  356. mindspore/ops/function/linalg_func.py +5 -4
  357. mindspore/ops/function/math_func.py +1659 -290
  358. mindspore/ops/function/nn_func.py +988 -317
  359. mindspore/ops/function/parameter_func.py +3 -56
  360. mindspore/ops/function/random_func.py +243 -33
  361. mindspore/ops/function/sparse_unary_func.py +1 -1
  362. mindspore/ops/functional.py +18 -5
  363. mindspore/ops/functional_overload.py +897 -0
  364. mindspore/ops/operations/__init__.py +3 -2
  365. mindspore/ops/operations/_embedding_cache_ops.py +4 -4
  366. mindspore/ops/operations/_grad_ops.py +2 -34
  367. mindspore/ops/operations/_infer_ops.py +2 -1
  368. mindspore/ops/operations/_inner_ops.py +38 -8
  369. mindspore/ops/operations/array_ops.py +45 -303
  370. mindspore/ops/operations/comm_ops.py +19 -16
  371. mindspore/ops/operations/custom_ops.py +11 -55
  372. mindspore/ops/operations/debug_ops.py +42 -47
  373. mindspore/ops/operations/inner_ops.py +6 -4
  374. mindspore/ops/operations/linalg_ops.py +3 -2
  375. mindspore/ops/operations/manually_defined/ops_def.py +185 -104
  376. mindspore/ops/operations/math_ops.py +11 -216
  377. mindspore/ops/operations/nn_ops.py +146 -308
  378. mindspore/ops/primitive.py +23 -21
  379. mindspore/ops/tensor_method.py +1669 -0
  380. mindspore/ops_generate/aclnn_kernel_register_auto_cc_generator.py +110 -0
  381. mindspore/ops_generate/add_tensor_docs_generator.py +54 -0
  382. mindspore/ops_generate/arg_handler.py +0 -61
  383. mindspore/ops_generate/auto_grad_impl_cc_generator.py +135 -0
  384. mindspore/ops_generate/auto_grad_reg_cc_generator.py +93 -0
  385. mindspore/ops_generate/base_generator.py +11 -0
  386. mindspore/ops_generate/cpp_create_prim_instance_helper_generator.py +108 -0
  387. mindspore/ops_generate/functional_map_cpp_generator.py +491 -0
  388. mindspore/ops_generate/functional_overload_py_generator.py +110 -0
  389. mindspore/ops_generate/functions_cc_generator.py +233 -0
  390. mindspore/ops_generate/gen_aclnn_implement.py +110 -114
  391. mindspore/ops_generate/gen_constants.py +157 -3
  392. mindspore/ops_generate/gen_ops.py +245 -990
  393. mindspore/ops_generate/gen_pyboost_func.py +97 -998
  394. mindspore/ops_generate/gen_utils.py +119 -33
  395. mindspore/ops_generate/lite_ops_cpp_generator.py +155 -0
  396. mindspore/ops_generate/op_api_proto.py +206 -0
  397. mindspore/ops_generate/op_def_py_generator.py +131 -0
  398. mindspore/ops_generate/op_prim_py_generator.py +480 -0
  399. mindspore/ops_generate/op_proto.py +373 -108
  400. mindspore/ops_generate/op_template_parser.py +436 -0
  401. mindspore/ops_generate/ops_def_cc_generator.py +288 -0
  402. mindspore/ops_generate/ops_def_h_generator.py +74 -0
  403. mindspore/ops_generate/ops_name_h_generator.py +68 -0
  404. mindspore/ops_generate/ops_primitive_h_generator.py +81 -0
  405. mindspore/ops_generate/pyboost_functions_cpp_generator.py +370 -0
  406. mindspore/ops_generate/pyboost_functions_h_generator.py +68 -0
  407. mindspore/ops_generate/pyboost_functions_py_generator.py +148 -0
  408. mindspore/ops_generate/pyboost_grad_function_cpp_generator.py +154 -0
  409. mindspore/ops_generate/pyboost_inner_prim_generator.py +131 -0
  410. mindspore/ops_generate/pyboost_native_grad_functions_generator.py +268 -0
  411. mindspore/ops_generate/pyboost_op_cpp_code_generator.py +851 -0
  412. mindspore/ops_generate/pyboost_overload_functions_cpp_generator.py +344 -0
  413. mindspore/ops_generate/pyboost_utils.py +92 -33
  414. mindspore/ops_generate/template.py +294 -44
  415. mindspore/ops_generate/tensor_func_reg_cpp_generator.py +422 -0
  416. mindspore/parallel/__init__.py +3 -3
  417. mindspore/parallel/_auto_parallel_context.py +24 -33
  418. mindspore/parallel/_parallel_serialization.py +13 -2
  419. mindspore/parallel/_utils.py +4 -1
  420. mindspore/parallel/algo_parameter_config.py +1 -1
  421. mindspore/parallel/checkpoint_transform.py +44 -0
  422. mindspore/parallel/cluster/process_entity/_api.py +131 -37
  423. mindspore/parallel/cluster/process_entity/_utils.py +41 -6
  424. mindspore/parallel/cluster/run.py +20 -3
  425. mindspore/parallel/parameter_broadcast.py +1 -1
  426. mindspore/parallel/shard.py +3 -0
  427. mindspore/parallel/transform_safetensors.py +119 -253
  428. mindspore/profiler/__init__.py +17 -4
  429. mindspore/profiler/analysis/__init__.py +0 -0
  430. mindspore/profiler/analysis/parser/__init__.py +0 -0
  431. mindspore/profiler/analysis/parser/ascend_cann_parser.py +166 -0
  432. mindspore/profiler/analysis/parser/base_parser.py +158 -0
  433. mindspore/profiler/analysis/parser/framework_cann_relation_parser.py +45 -0
  434. mindspore/profiler/analysis/parser/ms_framework_parser.py +142 -0
  435. mindspore/profiler/analysis/parser/ms_minddata_parser.py +145 -0
  436. mindspore/profiler/analysis/parser/timeline_assembly_factory/__init__.py +0 -0
  437. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +261 -0
  438. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +40 -0
  439. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +84 -0
  440. mindspore/profiler/analysis/parser/timeline_creator/__init__.py +0 -0
  441. mindspore/profiler/analysis/parser/timeline_creator/base_timeline_creator.py +44 -0
  442. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +90 -0
  443. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +76 -0
  444. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +103 -0
  445. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +134 -0
  446. mindspore/profiler/analysis/parser/timeline_event/__init__.py +0 -0
  447. mindspore/profiler/analysis/parser/timeline_event/base_event.py +233 -0
  448. mindspore/profiler/analysis/parser/timeline_event/cpu_op_event.py +47 -0
  449. mindspore/profiler/analysis/parser/timeline_event/flow_event.py +36 -0
  450. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +260 -0
  451. mindspore/profiler/analysis/parser/timeline_event/msprof_event.py +73 -0
  452. mindspore/profiler/analysis/parser/timeline_event/scope_layer_event.py +53 -0
  453. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +146 -0
  454. mindspore/profiler/analysis/task_manager.py +131 -0
  455. mindspore/profiler/analysis/time_converter.py +84 -0
  456. mindspore/profiler/analysis/viewer/__init__.py +0 -0
  457. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +333 -0
  458. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +87 -0
  459. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +252 -0
  460. mindspore/profiler/analysis/viewer/ascend_memory_viewer.py +313 -0
  461. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +322 -0
  462. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +265 -0
  463. mindspore/profiler/analysis/viewer/ascend_timeline_viewer.py +58 -0
  464. mindspore/profiler/analysis/viewer/base_viewer.py +26 -0
  465. mindspore/profiler/analysis/viewer/ms_dataset_viewer.py +97 -0
  466. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +581 -0
  467. mindspore/profiler/analysis/work_flow.py +73 -0
  468. mindspore/profiler/common/ascend_msprof_exporter.py +138 -0
  469. mindspore/profiler/common/command_executor.py +90 -0
  470. mindspore/profiler/common/constant.py +174 -3
  471. mindspore/profiler/common/file_manager.py +208 -0
  472. mindspore/profiler/common/log.py +130 -0
  473. mindspore/profiler/common/msprof_cmd_tool.py +202 -0
  474. mindspore/profiler/common/path_manager.py +371 -0
  475. mindspore/profiler/common/process_bar.py +168 -0
  476. mindspore/profiler/common/process_pool.py +9 -3
  477. mindspore/profiler/common/profiler_context.py +476 -0
  478. mindspore/profiler/common/profiler_info.py +304 -0
  479. mindspore/profiler/common/profiler_output_path.py +284 -0
  480. mindspore/profiler/common/profiler_parameters.py +210 -0
  481. mindspore/profiler/common/profiler_path_manager.py +120 -0
  482. mindspore/profiler/common/record_function.py +76 -0
  483. mindspore/profiler/common/tlv_decoder.py +76 -0
  484. mindspore/profiler/common/util.py +75 -2
  485. mindspore/profiler/dynamic_profiler.py +270 -37
  486. mindspore/profiler/envprofiler.py +138 -0
  487. mindspore/profiler/mstx.py +199 -0
  488. mindspore/profiler/platform/__init__.py +21 -0
  489. mindspore/profiler/platform/base_profiler.py +40 -0
  490. mindspore/profiler/platform/cpu_profiler.py +124 -0
  491. mindspore/profiler/platform/gpu_profiler.py +74 -0
  492. mindspore/profiler/platform/npu_profiler.py +309 -0
  493. mindspore/profiler/profiler.py +580 -93
  494. mindspore/profiler/profiler_action_controller.py +187 -0
  495. mindspore/profiler/profiler_interface.py +114 -0
  496. mindspore/profiler/schedule.py +208 -0
  497. mindspore/rewrite/api/symbol_tree.py +1 -2
  498. mindspore/run_check/_check_version.py +2 -6
  499. mindspore/runtime/__init__.py +37 -0
  500. mindspore/runtime/device.py +27 -0
  501. mindspore/runtime/event.py +209 -0
  502. mindspore/runtime/executor.py +148 -0
  503. mindspore/runtime/memory.py +392 -0
  504. mindspore/runtime/stream.py +460 -0
  505. mindspore/runtime/thread_bind_core.py +401 -0
  506. mindspore/train/__init__.py +2 -2
  507. mindspore/train/_utils.py +53 -18
  508. mindspore/train/amp.py +8 -4
  509. mindspore/train/callback/_checkpoint.py +32 -18
  510. mindspore/train/callback/_early_stop.py +1 -1
  511. mindspore/train/callback/_flops_collector.py +105 -69
  512. mindspore/train/callback/_history.py +1 -1
  513. mindspore/train/callback/_summary_collector.py +44 -6
  514. mindspore/train/callback/_tft_register.py +31 -10
  515. mindspore/train/dataset_helper.py +11 -11
  516. mindspore/train/metrics/precision.py +4 -5
  517. mindspore/train/mind_ir_pb2.py +167 -46
  518. mindspore/train/model.py +13 -15
  519. mindspore/train/serialization.py +462 -76
  520. mindspore/train/summary/summary_record.py +1 -2
  521. mindspore/train/train_thor/model_thor.py +1 -1
  522. mindspore/utils/__init__.py +4 -2
  523. mindspore/utils/bin/dataset-cache +0 -0
  524. mindspore/utils/bin/dataset-cache-server +0 -0
  525. mindspore/utils/dryrun.py +138 -0
  526. mindspore/utils/runtime_execution_order_check.py +550 -0
  527. mindspore/version.py +1 -1
  528. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/METADATA +2 -3
  529. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/RECORD +532 -466
  530. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/entry_points.txt +1 -1
  531. mindspore/_data_dump.cpython-310-x86_64-linux-gnu.so +0 -0
  532. mindspore/bin/cache_admin +0 -0
  533. mindspore/bin/cache_server +0 -0
  534. mindspore/common/_tensor_overload.py +0 -139
  535. mindspore/lib/libmindspore_np_dtype.so +0 -0
  536. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme.h +0 -24
  537. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme_op.h +0 -82
  538. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_creator.h +0 -113
  539. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_param.h +0 -193
  540. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/dtype_registry.h +0 -90
  541. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/kernel_register.h +0 -46
  542. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/platform_configs.h +0 -89
  543. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/rt_funcs.h +0 -135
  544. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_layer_norm_op.h +0 -60
  545. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_rms_norm_op.h +0 -50
  546. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_rms_norm_quant_op.h +0 -50
  547. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/apply_rotary_pos_emb_nz_op.h +0 -42
  548. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/apply_rotary_pos_emb_op.h +0 -55
  549. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_elewise_op.h +0 -34
  550. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_only_ops.h +0 -94
  551. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_op_base.h +0 -97
  552. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/cast_op.h +0 -52
  553. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/flash_attention_score_op.h +0 -97
  554. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/gelu_op.h +0 -44
  555. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/matmul_add_rmsnorm_op.h +0 -73
  556. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/matmul_op.h +0 -108
  557. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/multi_impls_op.h +0 -64
  558. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/multi_weight_matmul_op.h +0 -91
  559. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/paged_attention_op.h +0 -99
  560. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/reshape_and_cache_nz_op.h +0 -44
  561. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/reshape_and_cache_op.h +0 -44
  562. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/rms_norm_op.h +0 -64
  563. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/asd_utils.h +0 -179
  564. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/comm_utils.h +0 -69
  565. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/profiling_util.h +0 -366
  566. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/add_impl.h +0 -56
  567. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/kernel/add.h +0 -21
  568. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/tiling/add_tiling.h +0 -43
  569. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +0 -46
  570. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb.h +0 -23
  571. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_base.h +0 -456
  572. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_bf16.h +0 -217
  573. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp.h +0 -391
  574. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp16.h +0 -126
  575. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp32.h +0 -230
  576. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_tiling.h +0 -43
  577. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_value.h +0 -27
  578. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/apply_rotary_pos_emb_nz_impl.h +0 -34
  579. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/kernel/apply_rotary_pos_emb_nz.h +0 -23
  580. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/kernel/apply_rotary_pos_emb_nz_base.h +0 -460
  581. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/kernel/apply_rotary_pos_emb_nz_fp16.h +0 -116
  582. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/kernel/apply_rotary_pos_emb_nz_fp32.h +0 -230
  583. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/kernel/apply_rotary_pos_emb_nz_tiling.h +0 -43
  584. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb_nz/kernel/apply_rotary_pos_emb_nz_value.h +0 -27
  585. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -74
  586. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/backend_param.h +0 -74
  587. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/cast/cast_impl.h +0 -48
  588. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/cast/kernel/cast_kernel.h +0 -21
  589. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/compare_impl.h +0 -55
  590. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/compare_tiling.h +0 -27
  591. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/kernel/compare_kernel.h +0 -23
  592. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/and_impl.h +0 -29
  593. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/div_impl.h +0 -29
  594. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_impl.h +0 -48
  595. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_tiling.h +0 -25
  596. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/and_kernel.h +0 -46
  597. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/div_kernel.h +0 -46
  598. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_base.h +0 -260
  599. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_kernel.h +0 -35
  600. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/max_kernel.h +0 -66
  601. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/min_kernel.h +0 -66
  602. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/mul_kernel.h +0 -66
  603. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/or_kernel.h +0 -46
  604. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/max_impl.h +0 -29
  605. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/min_impl.h +0 -29
  606. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/mul_impl.h +0 -29
  607. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/or_impl.h +0 -29
  608. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/abs_impl.h +0 -29
  609. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_impl.h +0 -47
  610. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_tiling.h +0 -24
  611. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/exp_impl.h +0 -29
  612. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/abs_kernel.h +0 -45
  613. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_base.h +0 -148
  614. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_kernel.h +0 -31
  615. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/exp_kernel.h +0 -45
  616. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/ln_kernel.h +0 -45
  617. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/not_kernel.h +0 -45
  618. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/reciprocal_kernel.h +0 -45
  619. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/relu_kernel.h +0 -55
  620. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/rsqrt_kernel.h +0 -45
  621. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/sqrt_kernel.h +0 -45
  622. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/ln_impl.h +0 -29
  623. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/not_impl.h +0 -29
  624. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/reciprocal_impl.h +0 -29
  625. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/relu_impl.h +0 -29
  626. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/rsqrt_impl.h +0 -29
  627. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/sqrt_impl.h +0 -29
  628. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_impl.h +0 -68
  629. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_kernel.h +0 -99
  630. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_rtbackend.h +0 -21
  631. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/lccl/lccl_wrapper.h +0 -58
  632. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/ms_int_types.h +0 -91
  633. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/ms_int_utils.h +0 -108
  634. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_impl.h +0 -64
  635. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/add_param.h +0 -68
  636. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/attention_param.h +0 -40
  637. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/cast_param.h +0 -30
  638. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/compare_param.h +0 -31
  639. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/elewise_param.h +0 -41
  640. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/grouped_matmul_param.h +0 -40
  641. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +0 -38
  642. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_qkv_param.h +0 -42
  643. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +0 -33
  644. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/profiling_util.h +0 -377
  645. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/reshape_and_cache_nz/kernel/reshape_and_cache_nz.h +0 -24
  646. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/reshape_and_cache_nz/reshape_and_cache_nz_impl.h +0 -42
  647. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/reshape_and_cache_nz/reshape_and_cache_nz_tiling.h +0 -27
  648. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +0 -46
  649. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/kernel/sub_kernel.h +0 -20
  650. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +0 -48
  651. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_tiling.h +0 -25
  652. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +0 -399
  653. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/utils.h +0 -41
  654. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/backend.h +0 -45
  655. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/elewise_tiling.h +0 -29
  656. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/elewise_utils.h +0 -30
  657. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log.h +0 -69
  658. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_core.h +0 -43
  659. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_entity.h +0 -38
  660. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_sink.h +0 -69
  661. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_stream.h +0 -41
  662. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +0 -71
  663. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_utils.h +0 -165
  664. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/math.h +0 -20
  665. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_creator.h +0 -39
  666. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_registry.h +0 -121
  667. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/utils.h +0 -106
  668. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
  669. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
  670. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layer_norm_impl.so +0 -0
  671. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_quant_acme_impl.so +0 -0
  672. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_310p_old_impl.so +0 -0
  673. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_old_impl.so +0 -0
  674. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_nz_impl.so +0 -0
  675. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_nz_old_impl.so +0 -0
  676. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMatMulPostFusionMixTactic/acme_matmul_postfusion_mix.json +0 -19
  677. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMatMulPostFusionMixTactic/acme_matmul_postfusion_mix.o +0 -0
  678. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMatMulPostFusionMixTactic/acme_matmul_postfusion_mix_mix_aic_0.o +0 -0
  679. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMatMulPostFusionMixTactic/acme_matmul_postfusion_mix_mix_aiv_0.o +0 -0
  680. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMultiWeightMatMulPostFusionMixTactic/acme_multi_weight_matmul_postfusion_mix.json +0 -19
  681. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMultiWeightMatMulPostFusionMixTactic/acme_multi_weight_matmul_postfusion_mix.o +0 -0
  682. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMultiWeightMatMulPostFusionMixTactic/acme_multi_weight_matmul_postfusion_mix_mix_aic_0.o +0 -0
  683. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/AcmeMultiWeightMatMulPostFusionMixTactic/acme_multi_weight_matmul_postfusion_mix_mix_aiv_0.o +0 -0
  684. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
  685. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
  686. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_bf16_bsh_full_mix.o +0 -0
  687. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
  688. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
  689. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
  690. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_fp16_bsh_full_mix.o +0 -0
  691. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/flash_attention_score/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
  692. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/matmul_add_rmsnorm/matmul_add_rmsnorm_bf16_bf16.o +0 -0
  693. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/matmul_add_rmsnorm/matmul_add_rmsnorm_bf16_fp16.o +0 -0
  694. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/matmul_add_rmsnorm/matmul_add_rmsnorm_bf16_fp32.o +0 -0
  695. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/matmul_add_rmsnorm/matmul_add_rmsnorm_fp16_bf16.o +0 -0
  696. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/matmul_add_rmsnorm/matmul_add_rmsnorm_fp16_fp16.o +0 -0
  697. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/matmul_add_rmsnorm/matmul_add_rmsnorm_fp16_fp32.o +0 -0
  698. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/paged_attention/paged_attention_bf16_bnsd_mix.o +0 -0
  699. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/paged_attention/paged_attention_bf16_bsh_mix.o +0 -0
  700. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/paged_attention/paged_attention_fp16_bnsd_mix.o +0 -0
  701. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/paged_attention/paged_attention_fp16_bsh_mix.o +0 -0
  702. mindspore/profiler/envprofiling.py +0 -254
  703. mindspore/profiler/profiling.py +0 -1926
  704. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/WHEEL +0 -0
  705. {mindspore-2.4.10.dist-info → mindspore-2.5.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,154 @@
1
+ # Copyright 2024 Huawei Technologies Co., Ltd
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ============================================================================
15
+ """
16
+ This module defines the PyboostGradFunctionsGenerator class, which is responsible for generating PyBoost gradient
17
+ functions and saving the corresponding C++ source files. The generator parses operator prototypes and constructs
18
+ function definitions, includes necessary headers, and generates the registration code for the PyBoost functions.
19
+ """
20
+
21
+
22
+ import os
23
+
24
+ import template
25
+ from template import Template
26
+ from gen_utils import save_file
27
+ import gen_constants as K
28
+ from op_proto import OpProto
29
+ from base_generator import BaseGenerator
30
+ from op_template_parser import OpTemplateParser
31
+ import pyboost_utils
32
+
33
+
34
+ class PyboostGradFunctionsGenerator(BaseGenerator):
35
+ """
36
+ PyboostGradFunctionsGenerator generates PyBoost gradient functions based on operator prototypes (instances of
37
+ OpProto).
38
+
39
+ This class processes operator prototypes (`op_protos`) to generate PyBoost functions. It defines the function
40
+ body, handles value conversion, creates contiguous tensor values, and generates the necessary header includes and
41
+ registration code. The generated content is then saved to a specified location in the file system.
42
+ """
43
+
44
+ def __init__(self):
45
+ super().__init__()
46
+ self.pyboost_func_include_header_template = Template(
47
+ f'#include "{K.MS_COMMON_PYBOOST_KERNEL_PATH}/auto_generate/${{operator_name}}.h"\n')
48
+ self.GEN_OPS_DEF_HEADER_TEMPLATE = template.GEN_OPS_DEF_HEADER_TEMPLATE
49
+ self.contiguous_template = Template(
50
+ "convert_$arg_name = runtime::ValueConverter::ContiguousTensorValue($device_target, convert_$arg_name);\n")
51
+
52
+ def generate(self, work_path, op_protos):
53
+ """
54
+ Generates the PyBoost gradient functions and writes them to the appropriate files.
55
+
56
+ This method processes a list of operator prototypes (`op_protos`), extracting necessary information such as
57
+ operator names, arguments, and conversion types. It uses this data to construct function bodies, includes,
58
+ and registration code. The generated content is saved to a specified path as a C++ source file.
59
+
60
+ Args:
61
+ work_path (str): The file path where the generated files will be saved.
62
+ op_protos (list): A list of operator prototypes containing information about the operators to be processed.
63
+
64
+ Returns:
65
+ None
66
+ """
67
+ pyboost_func_str = ''
68
+ pyboost_func_reg_def = ''
69
+ pyboost_func_include_headers_str = ''
70
+ for op_proto in op_protos:
71
+ if (op_proto.op_dispatch is None) or (not op_proto.op_dispatch.enable):
72
+ continue
73
+ op_parser = OpTemplateParser(op_proto)
74
+ op_pyboost_func_name = op_parser.get_pyboost_func_name()
75
+ operator_name = op_proto.op_name
76
+ op_name_str = op_proto.op_class.name
77
+ op_args_str = [op_arg.arg_name for op_arg in op_proto.op_args]
78
+ convert_value_type_str = self._convert_value_type(op_proto)
79
+ device_target = "op_runner_info->device_target"
80
+ convert_value_type_str += self._contiguous_tensor_value(op_proto, device_target)
81
+
82
+ call_args_str = []
83
+ for op_arg in op_proto.op_args:
84
+ call_arg = 'convert_' + op_arg.arg_name
85
+ call_args_str.append(call_arg)
86
+ pyboost_func_str += template.PYBOOST_GRAD_FUNCTION_TEMPLATE.replace(
87
+ func_name=op_pyboost_func_name,
88
+ op_name=op_name_str,
89
+ op_args=op_args_str,
90
+ convert_body=convert_value_type_str,
91
+ call_args=call_args_str)
92
+ pyboost_func_str = pyboost_func_str + template.NEW_LINE
93
+ pyboost_func_reg_def += template.REGISTER_PYBOOST_GRAD_DEFINE_TEMPLATE.replace(
94
+ pyboost_op_name=op_proto.op_class.name,
95
+ pyboost_cfunc_name=op_pyboost_func_name)
96
+ pyboost_func_include_headers_str += self.pyboost_func_include_header_template.replace(
97
+ operator_name=operator_name)
98
+
99
+ register_func_str = template.REGISTER_PYBOOST_GRAD_TEMPLATE.replace(register_func=pyboost_func_reg_def)
100
+ pyboost_func_file = \
101
+ template.PYBOOST_GRAD_HEADER_TEMPLATE.replace(include_op_header=pyboost_func_include_headers_str,
102
+ function_body=pyboost_func_str,
103
+ register_function_body=register_func_str)
104
+ save_path = os.path.join(work_path, K.RUNTIME_PYBOOST_FUNC_GEN_PATH)
105
+ file_name = "pyboost_grad_functions.cc"
106
+ save_file(save_path, file_name, pyboost_func_file)
107
+
108
+ def _convert_value_type(self, op_proto: OpProto) -> str:
109
+ """
110
+ Generates the code for converting the operator's input values to the required types.
111
+
112
+ This method iterates over the operator's arguments, checks if they are optional, and generates the appropriate
113
+ conversion code based on the argument's data type.
114
+
115
+ Args:
116
+ op_proto (OpProto): The operator prototype containing information about the operator's arguments.
117
+
118
+ Returns:
119
+ str: A string containing the code for converting the input values to the required types.
120
+ """
121
+ convert_template = Template(
122
+ "auto convert_$arg_name = ValueConverter::${convert_func}(op_runner_info->inputs[$arg_index]);\n")
123
+ parser_func_str = ''
124
+ for index, arg in enumerate(op_proto.op_args):
125
+ is_optional = pyboost_utils.is_optional_param(arg)
126
+ convert_type_str = pyboost_utils.get_value_convert_type_str(arg.arg_dtype, is_optional)
127
+ parser_func_str += convert_template.replace(arg_name=arg.arg_name, convert_func=convert_type_str,
128
+ arg_index=pyboost_utils.get_index(index))
129
+ return parser_func_str
130
+
131
+ def _contiguous_tensor_value(self, op_proto: OpProto, device_target: str) -> str:
132
+ """
133
+ Generates the code for converting tensors to contiguous format if required.
134
+
135
+ This method checks the data type of the operator's arguments and generates code for converting tensors
136
+ to contiguous format, which is necessary for certain types of tensors.
137
+
138
+ Args:
139
+ op_proto (OpProto): The operator prototype containing information about the operator's arguments.
140
+ device_target (str): The device target string used in the conversion code.
141
+
142
+ Returns:
143
+ str: A string containing the code for converting tensors to contiguous format.
144
+ If the operator is a view operation, an empty string is returned.
145
+ """
146
+ if op_proto.op_view:
147
+ return ''
148
+ contiguous_func_str = ''
149
+ need_contiguous_dtype = {'tensor', 'tuple[tensor]'}
150
+ for arg in op_proto.op_args:
151
+ if arg.arg_dtype not in need_contiguous_dtype:
152
+ continue
153
+ contiguous_func_str += self.contiguous_template.replace(arg_name=arg.arg_name, device_target=device_target)
154
+ return contiguous_func_str
@@ -0,0 +1,131 @@
1
+ # Copyright 2024 Huawei Technologies Co., Ltd
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ============================================================================
15
+ """
16
+ This module defines the PyboostInnerPrimGenerator class, which is responsible for generating Python primitive
17
+ wrappers for Pyboost operations. The generator constructs Python function definitions based on operator prototypes,
18
+ generates necessary import statements, and writes the generated content into Python source files.
19
+
20
+ The primary functionality is to take operator prototypes, extract relevant fields, and create Python function wrappers
21
+ that can be used to call the Pyboost primitive implementations.
22
+ """
23
+
24
+ import os
25
+ import template
26
+ import gen_constants as K
27
+ from gen_utils import save_file
28
+
29
+ from op_proto import OpProto
30
+ from op_template_parser import OpTemplateParser
31
+ from base_generator import BaseGenerator
32
+
33
+
34
+ class PyboostInnerPrimGenerator(BaseGenerator):
35
+ """
36
+ PyboostInnerPrimGenerator is responsible for generating Python primitive wrappers for Pyboost operators.
37
+
38
+ This class processes operator prototypes (`op_protos`) to generate Python function implementations. It handles the
39
+ inclusion of necessary headers, processes operator arguments, and creates Python functions that wrap Pyboost
40
+ primitives.
41
+
42
+ Attributes:
43
+ IMPORT_PYBOOST_PRIM_HEADER (Template): Template for importing Pyboost primitive headers.
44
+ PYBOOST_PY_FUNC_IMPORT_HEADER (Template): Template for importing Python functions related to Pyboost.
45
+ PYTHON_PRIM_TEMPLATE (Template): Template for generating Python primitive functions.
46
+ """
47
+
48
+ def __init__(self):
49
+ """
50
+ Initializes the PyboostInnerPrimGenerator class.
51
+
52
+ This constructor sets up the required templates for generating import headers, Python function imports,
53
+ and Python primitive function wrappers.
54
+ """
55
+ self.IMPORT_PYBOOST_PRIM_HEADER = template.IMPORT_PYBOOST_PRIM_HEADER
56
+ self.PYBOOST_PY_FUNC_IMPORT_HEADER = template.PYBOOST_PY_FUNC_IMPORT_HEADEAR
57
+ self.PYTHON_PRIM_TEMPLATE = template.PYTHON_PRIM_TEMPLATE
58
+
59
+ def generate(self, work_path, op_protos):
60
+ """
61
+ Generates Python wrappers for Pyboost primitives and writes them to a Python source file.
62
+
63
+ This method processes a list of operator prototypes (`op_protos`), extracting necessary information such as
64
+ class names, arguments, and handlers. It constructs Python function wrappers for the Pyboost primitives and
65
+ generates the required import statements. The generated Python code is saved to a specified path.
66
+
67
+ Args:
68
+ work_path (str): The file path where the generated Python file will be saved.
69
+ op_protos (list): A list of operator prototypes containing information about the operators to be processed.
70
+
71
+ Returns:
72
+ None
73
+ """
74
+ gen_py = ''
75
+ gen_header = K.PY_LICENSE + self.IMPORT_PYBOOST_PRIM_HEADER
76
+ for op_proto in op_protos:
77
+ # only process pyboost enabled scenario
78
+ if op_proto.op_dispatch is None:
79
+ continue
80
+ if not op_proto.op_dispatch.enable:
81
+ continue
82
+ op_parser = OpTemplateParser(op_proto)
83
+ if not op_parser.has_prim_init():
84
+ continue
85
+
86
+ gen_header += self.PYBOOST_PY_FUNC_IMPORT_HEADER.replace(class_name=op_proto.op_class.name)
87
+ input_args, process_func, processed_args = self._get_fields_for_prim_tpl(op_proto)
88
+ gen_py += self.PYTHON_PRIM_TEMPLATE.replace(class_name=op_proto.op_class.name,
89
+ input_args=input_args,
90
+ process_func=process_func,
91
+ func_impl_name=op_proto.op_name,
92
+ processed_args=processed_args)
93
+
94
+ save_file(os.path.join(work_path, K.PY_AUTO_GEN_PATH), "pyboost_inner_prim.py", gen_header + gen_py)
95
+
96
+ def _get_fields_for_prim_tpl(self, op_proto: OpProto):
97
+ """
98
+ Extracts the necessary fields for the primitive template from the operator prototype.
99
+
100
+ This method processes the arguments of the operator prototype and generates the input arguments, the function
101
+ that handles argument processing, and the processed arguments list, which will be used in the final Python
102
+ function definition.
103
+
104
+ Args:
105
+ op_proto (OpProto): The operator prototype from which the argument data will be extracted.
106
+
107
+ Returns:
108
+ tuple: A tuple containing three return values required for the primitive template to be generated:
109
+ - input_args (list): List of input argument names for the Python function.
110
+ - process_func (str): String representing the argument processing logic for the function.
111
+ - processed_args (list): List of processed argument names used in the function call.
112
+ """
113
+ args = op_proto.op_args
114
+ operator_name = op_proto.op_name
115
+
116
+ input_args = []
117
+ process_func = ''
118
+ processed_args = []
119
+
120
+ for arg in args:
121
+ arg_name = arg.arg_name
122
+ arg_handler = arg.arg_handler
123
+ processed_arg = arg_name
124
+ if arg_handler != '' and arg_handler != 'dtype_to_type_id':
125
+ process_func += \
126
+ f"""converted_{arg_name} = {arg_handler}('{operator_name}', '{arg_name}', {arg_name})\n"""
127
+ processed_arg = 'converted_' + arg_name
128
+ input_args.append(arg_name)
129
+ processed_args.append(processed_arg)
130
+
131
+ return input_args, process_func, processed_args
@@ -0,0 +1,268 @@
1
+ # Copyright 2024 Huawei Technologies Co., Ltd
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ============================================================================
15
+ """
16
+ This module defines the PyboostGradFunctionsCppGenerator and PyboostGradFunctionsHeaderGenerator classes,
17
+ which are responsible for generating C++ gradient function implementations and headers for PyBoost operations.
18
+
19
+ The PyboostGradFunctionsCppGenerator generates the actual function definitions for the gradient functions,
20
+ while the PyboostGradFunctionsHeaderGenerator creates the corresponding function declarations in header files.
21
+ """
22
+
23
+ import os
24
+
25
+ import pyboost_utils
26
+ from pyboost_utils import is_optional_param
27
+ import template
28
+ from template import Template
29
+ import gen_constants as K
30
+ from gen_utils import save_file
31
+ from op_proto import OpProto
32
+ from base_generator import BaseGenerator
33
+
34
+
35
+ class PyboostGradFunctionsCppGenerator(BaseGenerator):
36
+ """
37
+ PyboostGradFunctionsCppGenerator generates C++ implementations for PyBoost gradient functions.
38
+
39
+ This class processes operator prototypes (`op_protos`) to create C++ function definitions that
40
+ wrap PyBoost gradient functionality. It constructs function bodies, handles value conversion,
41
+ and generates necessary include statements for each operator.
42
+
43
+ Attributes:
44
+ PYBOOST_NATIVE_GRAD_FUNCTION_TEMPLATE (Template): Template for generating native gradient function definitions.
45
+ PYBOOST_NATIVE_GRAD_FUNCTIONS_TEMPLATE (Template): Template for generating the overall gradient functions file.
46
+ native_function_multi_output_template (Template): Template for handling multiple output functions.
47
+ native_function_single_output_template (str): Template for handling single output functions.
48
+ native_include_header_template (Template): Template for generating include headers for each operator.
49
+ convert_template (Template): Template for converting argument values to native types.
50
+ """
51
+
52
+ def __init__(self):
53
+ self.PYBOOST_NATIVE_GRAD_FUNCTION_TEMPLATE = template.PYBOOST_NATIVE_GRAD_FUNCTION_TEMPLATE
54
+ self.PYBOOST_NATIVE_GRAD_FUNCTIONS_TEMPLATE = template.PYBOOST_NATIVE_GRAD_FUNCTIONS_TEMPLATE
55
+ self.native_function_multi_output_template = template.MULTI_OUTPUT_TEMPLATE
56
+ self.native_function_single_output_template = "const auto &output_value = op->outputs()[0];\n"
57
+ self.native_include_header_template = Template(
58
+ f'#include "{K.MS_COMMON_PYBOOST_KERNEL_PATH}/auto_generate/${{operator_name}}.h"\n')
59
+ self.convert_template = Template(
60
+ "auto convert_$arg_name = runtime::ValueConverter::${convert_func}(ConvertNode2Value($arg_name));\n")
61
+
62
+ def generate(self, work_path, op_protos):
63
+ """
64
+ Generates C++ gradient function implementations and writes them to a source file.
65
+
66
+ This method processes a list of operator prototypes (`op_protos`), extracting necessary information such as
67
+ operator names, arguments, and conversion types. It constructs C++ function bodies and generates the required
68
+ include statements. The generated content is saved to a specified path.
69
+
70
+ Args:
71
+ work_path (str): The file path where the generated C++ file will be saved.
72
+ op_protos (list): A list of operator prototypes containing information about the operators to be processed.
73
+
74
+ Returns:
75
+ None
76
+ """
77
+ pyboost_func_str = ''
78
+ pyboost_func_include_headers_str = ''
79
+ for op_proto in op_protos:
80
+ if op_proto.op_dispatch is None:
81
+ continue
82
+ if not op_proto.op_dispatch.enable:
83
+ continue
84
+
85
+ op_args_str = [op_arg.arg_name for op_arg in op_proto.op_args]
86
+ convert_value_type_str = self._convert_native_value_type(op_proto)
87
+ convert_value_type_str += self._contiguous_tensor_value(op_proto, "device_target_")
88
+ call_args_str = self._get_call_args(op_proto)
89
+ call_args_with_type = self._get_call_args_with_type(op_proto)
90
+
91
+ first_var_name = op_proto.op_args[0].arg_name
92
+ output_expr = self._get_output_expr(op_proto)
93
+
94
+ pyboost_func_str += \
95
+ template.PYBOOST_NATIVE_GRAD_FUNCTION_TEMPLATE.replace(func_name=op_proto.op_class.name,
96
+ op_name=op_proto.op_class.name,
97
+ op_args=op_args_str,
98
+ convert_body=convert_value_type_str,
99
+ call_args=call_args_str,
100
+ call_args_with_type=call_args_with_type,
101
+ first_var_name=first_var_name,
102
+ output_expr=output_expr)
103
+ pyboost_func_str = pyboost_func_str + template.NEW_LINE
104
+ pyboost_func_include_headers_str += (
105
+ self.native_include_header_template.replace(operator_name=op_proto.op_name))
106
+ native_grad_func_file = \
107
+ self.PYBOOST_NATIVE_GRAD_FUNCTIONS_TEMPLATE.replace(include_op_header=pyboost_func_include_headers_str,
108
+ function_body=pyboost_func_str)
109
+ save_file(os.path.join(work_path, K.PYBOOST_NATIVE_GRAD_FUNC_GEN_PATH),
110
+ "pyboost_native_grad_functions.cc", native_grad_func_file)
111
+
112
+ def _convert_native_value_type(self, op_proto: OpProto) -> str:
113
+ """
114
+ Generates native value conversion functions for operator arguments.
115
+
116
+ This method processes each argument of the operator prototype and constructs conversion statements
117
+ based on the argument's data type.
118
+
119
+ Args:
120
+ op_proto (OpProto): The operator prototype from which the argument data will be extracted.
121
+
122
+ Returns:
123
+ str: A string containing the conversion statements for the operator's arguments.
124
+ """
125
+ parser_func_str = ''
126
+ for op_arg in op_proto.op_args:
127
+ is_optional = is_optional_param(op_arg)
128
+ convert_type_str = pyboost_utils.get_value_convert_type_str(op_arg.arg_dtype, is_optional)
129
+ parser_func_str += self.convert_template.replace(arg_name=op_arg.arg_name, convert_func=convert_type_str)
130
+ return parser_func_str
131
+
132
+ def _contiguous_tensor_value(self, op_proto: OpProto, device_target: str) -> str:
133
+ """
134
+ Generates contiguous tensor value conversion functions if applicable.
135
+
136
+ This method constructs conversion statements for tensors that need to be contiguous. If the operator is a view
137
+ operation, no conversion is performed.
138
+
139
+ Args:
140
+ op_proto (OpProto): The operator prototype that contains the argument data.
141
+ device_target (str): The device target to be used in the conversion statements.
142
+
143
+ Returns:
144
+ str: A string containing the contiguous tensor conversion statements.
145
+ """
146
+ if op_proto.op_view:
147
+ return ''
148
+ contiguous_template = Template(
149
+ "convert_$arg_name = runtime::ValueConverter::ContiguousTensorValue($device_target, convert_$arg_name);\n")
150
+ contiguous_func_str = ''
151
+ need_contiguous_dtype = {'tensor', 'tuple[tensor]'}
152
+ for op_arg in op_proto.op_args:
153
+ if op_arg.arg_dtype not in need_contiguous_dtype:
154
+ continue
155
+ contiguous_func_str += contiguous_template.replace(arg_name=op_arg.arg_name, device_target=device_target)
156
+ return contiguous_func_str
157
+
158
+ def _get_output_expr(self, op_proto: OpProto):
159
+ """
160
+ Determines the output expression based on the operator prototype.
161
+
162
+ This method checks if the operator produces multiple outputs and returns the corresponding output expression.
163
+
164
+ Args:
165
+ op_proto (OpProto): The operator prototype to evaluate.
166
+
167
+ Returns:
168
+ str: The output expression used in the function implementation.
169
+ """
170
+ output_expr = self.native_function_single_output_template
171
+ if pyboost_utils.is_op_multi_output(op_proto.op_returns):
172
+ output_expr = self.native_function_multi_output_template
173
+ return output_expr
174
+
175
+ def _get_call_args(self, op_proto: OpProto):
176
+ """
177
+ Generates the list of call arguments for the operator function.
178
+
179
+ This method constructs a list of argument names prefixed with 'convert_' for use in the function call.
180
+
181
+ Args:
182
+ op_proto (OpProto): The operator prototype containing the argument information.
183
+
184
+ Returns:
185
+ list: A list of formatted argument names to be used in the function call.
186
+ """
187
+ call_args_str = []
188
+ for op_arg in op_proto.op_args:
189
+ call_arg = 'convert_' + op_arg.arg_name
190
+ call_args_str.append(call_arg)
191
+ return call_args_str
192
+
193
+ def _get_call_args_with_type(self, op_proto: OpProto):
194
+ """
195
+ Generates the list of call arguments with type information.
196
+
197
+ This method constructs a list of argument declarations with the appropriate type for the function definition.
198
+
199
+ Args:
200
+ op_proto (OpProto): The operator prototype containing the argument information.
201
+
202
+ Returns:
203
+ list: A list of argument declarations with types for the function definition.
204
+ """
205
+ call_args_with_type = []
206
+ for op_arg in op_proto.op_args:
207
+ call_args_with_type.append('const NodePtr &' + op_arg.arg_name)
208
+ return call_args_with_type
209
+
210
+
211
+ class PyboostGradFunctionsHeaderGenerator(BaseGenerator):
212
+ """
213
+ PyboostGradFunctionsHeaderGenerator generates C++ header declarations for PyBoost gradient functions.
214
+
215
+ This class processes operator prototypes to create function declarations for the grad functions in a header file.
216
+ """
217
+
218
+ def __init__(self):
219
+ self.native_function_header_template = Template("static NodePtr $func_name(${call_args_with_type});\n")
220
+
221
+ def generate(self, work_path, op_protos):
222
+ """
223
+ Generates C++ header declarations for gradient functions and writes them to a header file.
224
+
225
+ This method processes a list of operator prototypes (`op_protos`), extracting necessary information
226
+ and constructing the function declarations. The generated content is saved to a specified path.
227
+
228
+ Args:
229
+ work_path (str): The file path where the generated header file will be saved.
230
+ op_protos (list): A list of operator prototypes containing information about the operators to be processed.
231
+
232
+ Returns:
233
+ None
234
+ """
235
+ native_function_headers_str = ''
236
+ for op_proto in op_protos:
237
+ if op_proto.op_dispatch is None:
238
+ continue
239
+ if not op_proto.op_dispatch.enable:
240
+ continue
241
+
242
+ call_args_with_type = self._get_call_args_with_type(op_proto)
243
+
244
+ func_header = self.native_function_header_template.replace(func_name=op_proto.op_class.name,
245
+ call_args_with_type=call_args_with_type)
246
+ native_function_headers_str += func_header
247
+ native_grad_func_header_file = template.PYBOOST_NATIVE_GRAD_FUNCTIONS_HEADER_TEMPLATE.replace(
248
+ native_grad_func_def=native_function_headers_str)
249
+
250
+ save_file(os.path.join(work_path, K.PYBOOST_NATIVE_GRAD_FUNC_GEN_PATH),
251
+ "pyboost_native_grad_functions.h", native_grad_func_header_file)
252
+
253
+ def _get_call_args_with_type(self, op_proto: OpProto):
254
+ """
255
+ Generates the list of call arguments with type information for the header declarations.
256
+
257
+ This method constructs a list of argument declarations with the appropriate type for the function declaration.
258
+
259
+ Args:
260
+ op_proto (OpProto): The operator prototype containing the argument information.
261
+
262
+ Returns:
263
+ list: A list of argument declarations with types for the function declaration.
264
+ """
265
+ call_args_with_type = []
266
+ for op_arg in op_proto.op_args:
267
+ call_args_with_type.append('const NodePtr &' + op_arg.arg_name)
268
+ return call_args_with_type