mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0__cp311-cp311-win_amd64.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.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +2 -2
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +64 -83
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +47 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +177 -52
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +338 -208
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +84 -133
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +47 -38
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +69 -23
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +5 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +1 -0
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +4 -44
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +425 -19
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +125 -101
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +488 -620
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +86 -85
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +2 -4
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +1 -1
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
- mindspore/ops/auto_generate/gen_extend_func.py +5 -55
- mindspore/ops/auto_generate/gen_ops_def.py +753 -273
- mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +17 -100
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +65 -399
- mindspore/ops/function/nn_func.py +44 -61
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +2 -3
- mindspore/ops/functional_overload.py +486 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +4 -50
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +244 -175
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +6 -7
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +52 -11
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +7 -2
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +9 -17
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +33 -12
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +5 -1
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +7 -6
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +9 -23
- mindspore/parallel/transform_safetensors.py +468 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +22 -30
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +9 -5
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +72 -18
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +49 -47
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +162 -78
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -159,14 +159,6 @@ class FunctionalMapCppGenerator(BaseGenerator):
|
|
|
159
159
|
sig_str += '}\n},'
|
|
160
160
|
return sig_str
|
|
161
161
|
|
|
162
|
-
def _is_input_arg(self, arg_name, op_name):
|
|
163
|
-
res = False
|
|
164
|
-
if op_name in K.INPUT_NAME_MAP and arg_name == K.INPUT_NAME_MAP[op_name]:
|
|
165
|
-
res = True
|
|
166
|
-
elif op_name not in K.INPUT_NAME_MAP and arg_name in K.INPUT_ARGS_NAME:
|
|
167
|
-
res = True
|
|
168
|
-
return res
|
|
169
|
-
|
|
170
162
|
def _generate_single_signature_str(self, func_api_name, tensor_proto, is_tensor_method) -> str:
|
|
171
163
|
"""
|
|
172
164
|
Generates a single function signature string for the given operation prototype.
|
|
@@ -186,7 +178,7 @@ class FunctionalMapCppGenerator(BaseGenerator):
|
|
|
186
178
|
arg_valid_types = []
|
|
187
179
|
for _, arg in enumerate(op_proto.op_args):
|
|
188
180
|
arg_name = arg.arg_name
|
|
189
|
-
if is_tensor_method and
|
|
181
|
+
if is_tensor_method and _is_input_arg(arg_name, op_name):
|
|
190
182
|
continue
|
|
191
183
|
|
|
192
184
|
arg_valid_types = self._handle_arg_valid_types(arg, arg_name, arg_valid_types, func_api_name)
|
|
@@ -502,3 +494,12 @@ class FunctionalMapCppGenerator(BaseGenerator):
|
|
|
502
494
|
self._get_and_append_single_op_varargs_list(func_protos,
|
|
503
495
|
mint_varargs_list)
|
|
504
496
|
return mint_varargs_list
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
def _is_input_arg(arg_name, op_name):
|
|
500
|
+
res = False
|
|
501
|
+
if op_name in K.INPUT_NAME_MAP and arg_name == K.INPUT_NAME_MAP[op_name]:
|
|
502
|
+
res = True
|
|
503
|
+
elif op_name not in K.INPUT_NAME_MAP and arg_name in K.INPUT_ARGS_NAME:
|
|
504
|
+
res = True
|
|
505
|
+
return res
|
|
@@ -37,6 +37,13 @@ class FunctionsHeaderGenerator(BaseGenerator):
|
|
|
37
37
|
"""
|
|
38
38
|
self.FUNCTIONS_H_TEMPLATE = template.FUNCTIONS_H_TEMPLATE
|
|
39
39
|
self.function_interface_template = Template("${return_type} BACKEND_EXPORT ${op_name}(${input_args});")
|
|
40
|
+
self.function_interface_template_comm = Template(
|
|
41
|
+
"${return_type} BACKEND_EXPORT ${op_name}_inner(${input_args}," \
|
|
42
|
+
"CommHandlePtr comm_handle, const std::string& target);"
|
|
43
|
+
)
|
|
44
|
+
self.function_interface_template_comm_return_handle = Template(
|
|
45
|
+
"${return_type_with_handle} BACKEND_EXPORT ${op_name}(${input_args});"
|
|
46
|
+
)
|
|
40
47
|
|
|
41
48
|
def generate(self, work_path, op_protos):
|
|
42
49
|
"""
|
|
@@ -48,14 +55,30 @@ class FunctionsHeaderGenerator(BaseGenerator):
|
|
|
48
55
|
"""
|
|
49
56
|
functions_list = []
|
|
50
57
|
for op_proto in op_protos:
|
|
51
|
-
if op_proto.op_dispatch is None
|
|
58
|
+
if op_proto.op_dispatch is None:
|
|
52
59
|
continue
|
|
53
60
|
input_args_with_type_str = self._get_input_args(op_proto)
|
|
54
61
|
return_type_str = _get_return_type_str(op_proto)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
function_template = (
|
|
63
|
+
self.function_interface_template
|
|
64
|
+
if not op_proto.op_dispatch.is_comm_op
|
|
65
|
+
else self.function_interface_template_comm
|
|
66
|
+
)
|
|
67
|
+
functions = function_template.replace(op_name=op_proto.op_name,
|
|
68
|
+
input_args=input_args_with_type_str,
|
|
69
|
+
return_type=return_type_str)
|
|
58
70
|
functions_list.append(functions)
|
|
71
|
+
if op_proto.op_dispatch.is_comm_op:
|
|
72
|
+
return_type_with_handle = _get_return_type_with_handle_str(return_type_str)
|
|
73
|
+
functions_with_handle = (
|
|
74
|
+
self.function_interface_template_comm_return_handle.replace(
|
|
75
|
+
op_name=op_proto.op_name,
|
|
76
|
+
input_args=input_args_with_type_str,
|
|
77
|
+
return_type=return_type_str,
|
|
78
|
+
return_type_with_handle=return_type_with_handle,
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
functions_list.append(functions_with_handle)
|
|
59
82
|
pyboost_func_h_str = self.FUNCTIONS_H_TEMPLATE.replace(op_call_with_grad=functions_list)
|
|
60
83
|
save_path = os.path.join(work_path, K.MS_PYBOOST_FUNCTIONS_AUTO_GEN_PATH)
|
|
61
84
|
file_name = "functions.h"
|
|
@@ -73,7 +96,7 @@ class FunctionsHeaderGenerator(BaseGenerator):
|
|
|
73
96
|
"""
|
|
74
97
|
args_list = []
|
|
75
98
|
for op_arg in op_proto.op_args:
|
|
76
|
-
input_dtype = get_input_dtype(op_arg.arg_dtype, is_optional_param(op_arg))
|
|
99
|
+
input_dtype = get_input_dtype(op_arg.arg_dtype, is_optional_param(op_arg), op_proto.op_view)
|
|
77
100
|
args_list.append("const " + input_dtype + " &" + op_arg.arg_name)
|
|
78
101
|
return args_list
|
|
79
102
|
|
|
@@ -89,12 +112,19 @@ class FunctionsGenerator(BaseGenerator):
|
|
|
89
112
|
"""
|
|
90
113
|
self.FUNCTIONS_CC_TEMPLATE = template.FUNCTIONS_CC_TEMPLATE
|
|
91
114
|
self.FUNCTION_BODY_TEMPLATE = template.FUNCTION_BODY_TEMPLATE
|
|
115
|
+
self.FUNCTION_COMM_BODY_TEMPLATE = template.FUNCTION_COMM_BODY_TEMPLATE
|
|
92
116
|
self.pyboost_func_include_header_template = Template(
|
|
93
117
|
f'#include "{K.MS_PYBOOST_BASE_PATH}/auto_generate/${{operator_name}}.h"\n'
|
|
94
118
|
)
|
|
95
119
|
self.clone_inplace_input_template = Template(
|
|
96
120
|
'GetCloneFunc()(op, prim::kPrim${class_name}, device_target, {${grad_args}});'
|
|
97
121
|
)
|
|
122
|
+
self.create_aclnn_op_template = Template(
|
|
123
|
+
'auto op = CREATE_PYBOOST_OP(${class_name}, device_target);'
|
|
124
|
+
)
|
|
125
|
+
self.create_internal_op_template = Template(
|
|
126
|
+
'auto op = CREATE_PYBOOST_SELECTED_OP(${class_name}, device_target);'
|
|
127
|
+
)
|
|
98
128
|
|
|
99
129
|
def generate(self, work_path, op_protos):
|
|
100
130
|
"""
|
|
@@ -108,7 +138,7 @@ class FunctionsGenerator(BaseGenerator):
|
|
|
108
138
|
op_call_with_grad_list = []
|
|
109
139
|
ops_inc_head_set = set()
|
|
110
140
|
for op_proto in op_protos:
|
|
111
|
-
if op_proto.op_dispatch is None
|
|
141
|
+
if op_proto.op_dispatch is None:
|
|
112
142
|
continue
|
|
113
143
|
func_include_headers_list.append(
|
|
114
144
|
self.pyboost_func_include_header_template.replace(operator_name=op_proto.op_name))
|
|
@@ -137,8 +167,22 @@ class FunctionsGenerator(BaseGenerator):
|
|
|
137
167
|
inplace_clone_args = self._get_clone_input_args(op_proto, False, False)
|
|
138
168
|
clone_func_str = self._get_clone_inplace_str(op_proto.op_inplace, op_proto.op_class.name, inplace_clone_args)
|
|
139
169
|
return_type_str = _get_return_type_str(op_proto)
|
|
170
|
+
if op_proto.op_dispatch.is_comm_op:
|
|
171
|
+
return_type_with_handle = _get_return_type_with_handle_str(return_type_str)
|
|
172
|
+
comm_body = self.FUNCTION_COMM_BODY_TEMPLATE.replace(op_name=op_proto.op_name,
|
|
173
|
+
class_name=op_proto.op_class.name,
|
|
174
|
+
input_args=input_args,
|
|
175
|
+
clone_func=clone_func_str,
|
|
176
|
+
input_args_with_type=input_args_with_type,
|
|
177
|
+
return_type=return_type_str,
|
|
178
|
+
return_type_with_handle=return_type_with_handle)
|
|
179
|
+
return comm_body
|
|
180
|
+
create_op_str = self.create_aclnn_op_template.replace(class_name=op_proto.op_class.name)
|
|
181
|
+
if getattr(op_proto.op_dispatch, 'internal_op_ascend') != 'None':
|
|
182
|
+
create_op_str = self.create_internal_op_template.replace(class_name=op_proto.op_class.name)
|
|
140
183
|
return self.FUNCTION_BODY_TEMPLATE.replace(op_name=op_proto.op_name,
|
|
141
184
|
class_name=op_proto.op_class.name,
|
|
185
|
+
create_op=create_op_str,
|
|
142
186
|
input_args=input_args,
|
|
143
187
|
clone_func=clone_func_str,
|
|
144
188
|
input_args_with_type=input_args_with_type,
|
|
@@ -157,7 +201,7 @@ class FunctionsGenerator(BaseGenerator):
|
|
|
157
201
|
"""
|
|
158
202
|
args_list = []
|
|
159
203
|
for op_arg in op_proto.op_args:
|
|
160
|
-
input_dtype = get_input_dtype(op_arg.arg_dtype, is_optional_param(op_arg))
|
|
204
|
+
input_dtype = get_input_dtype(op_arg.arg_dtype, is_optional_param(op_arg), op_proto.op_view)
|
|
161
205
|
if has_type:
|
|
162
206
|
args_list.append("const " + input_dtype + " &" + op_arg.arg_name)
|
|
163
207
|
else:
|
|
@@ -194,7 +238,7 @@ class FunctionsGenerator(BaseGenerator):
|
|
|
194
238
|
"""
|
|
195
239
|
args_list = []
|
|
196
240
|
for op_arg in op_proto.op_args:
|
|
197
|
-
input_dtype = get_input_dtype(op_arg.arg_dtype, is_optional_param(op_arg))
|
|
241
|
+
input_dtype = get_input_dtype(op_arg.arg_dtype, is_optional_param(op_arg), op_proto.op_view)
|
|
198
242
|
if has_type:
|
|
199
243
|
args_list.append(f"const {input_dtype} &{op_arg.arg_name}")
|
|
200
244
|
else:
|
|
@@ -205,6 +249,10 @@ class FunctionsGenerator(BaseGenerator):
|
|
|
205
249
|
return args_list
|
|
206
250
|
|
|
207
251
|
|
|
252
|
+
def _get_return_type_with_handle_str(return_type_str):
|
|
253
|
+
return f"std::tuple<{return_type_str}, CommHandlePtr>"
|
|
254
|
+
|
|
255
|
+
|
|
208
256
|
def _get_return_type_str(op_proto):
|
|
209
257
|
"""
|
|
210
258
|
Get the return type string for the function.
|
|
@@ -217,8 +265,8 @@ def _get_return_type_str(op_proto):
|
|
|
217
265
|
"""
|
|
218
266
|
returns_type = []
|
|
219
267
|
type_convert_to_base = {
|
|
220
|
-
'std::vector<mindspore::tensor::TensorPtr>': 'std::vector<mindspore::tensor::
|
|
221
|
-
'mindspore::tensor::TensorPtr': 'mindspore::tensor::
|
|
268
|
+
'std::vector<mindspore::tensor::TensorPtr>': 'std::vector<mindspore::tensor::TensorPtr>',
|
|
269
|
+
'mindspore::tensor::TensorPtr': 'mindspore::tensor::TensorPtr'
|
|
222
270
|
}
|
|
223
271
|
for return_obj in op_proto.op_returns:
|
|
224
272
|
temp_return = get_return_type(return_obj.arg_dtype)
|
|
@@ -81,7 +81,7 @@ class TensorFuncRegCppGenerator(BaseGenerator):
|
|
|
81
81
|
'MS_LOG(INFO) << "Call Tensor${class_name}";\n'
|
|
82
82
|
'auto res = mindspore::pynative::'
|
|
83
83
|
'${pyboost_function}(mindspore::prim::kPrim${class_name}, parse_args.src_types_, ${convert_args});\n'
|
|
84
|
-
'trace::Capture(parse_args.arg_list_,
|
|
84
|
+
'trace::Capture(parse_args.arg_list_, mindspore::prim::kPrim${class_name}, &res);\n'
|
|
85
85
|
'return res;\n'
|
|
86
86
|
)
|
|
87
87
|
self.callback_python_template = Template(
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2025 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
|
+
# ============================================================================
|
|
1
15
|
"""
|
|
2
16
|
Base generator interface for other pyboost file generator classes
|
|
3
17
|
"""
|
|
@@ -55,13 +55,13 @@ TENSOR_PY_CC_PATH = "mindspore/ccsrc/pybind_api/ir/tensor_register/auto_generate
|
|
|
55
55
|
|
|
56
56
|
# yaml keys def
|
|
57
57
|
OP_KEYS = {'args', 'args_signature', 'returns', 'function', 'class', 'view', 'graph_view', 'dispatch', 'labels',
|
|
58
|
-
'bprop_expander'}
|
|
58
|
+
'bprop_expander', 'non-differentiable'}
|
|
59
59
|
ARG_KEYS = {'dtype', 'default', 'prim_init', 'type_cast', 'arg_handler'}
|
|
60
60
|
RETURN_KEYS = {'dtype', 'inplace', 'type_cast'}
|
|
61
61
|
ARG_SIGNATURE_KEYS = {'rw_write', 'rw_read', 'rw_ref', 'dtype_group'}
|
|
62
62
|
CLASS_KEYS = {'name', 'disable'}
|
|
63
63
|
FUNCTION_KEYS = {'name', 'disable'}
|
|
64
|
-
DISPATCH_KEYS = {'enable', 'is_comm_op', 'Ascend', 'GPU', 'CPU'}
|
|
64
|
+
DISPATCH_KEYS = {'enable', 'is_comm_op', 'Ascend', 'InternalOpAscend', 'GPU', 'CPU'}
|
|
65
65
|
TENSOR_FUNC_KEYS = {'op_yaml', 'py_method', 'kwonlyargs',
|
|
66
66
|
'varargs', 'alias', 'Ascend', 'GPU', 'CPU', 'interface'}
|
|
67
67
|
|
|
@@ -89,3 +89,8 @@ MS_OPS_KERNEL_PATH = "mindspore/ops/kernel"
|
|
|
89
89
|
MS_PYBOOST_FUNCTIONS_AUTO_GEN_PATH = "mindspore/ccsrc/pyboost/functions/auto_generate"
|
|
90
90
|
MS_COMMON_PYBOOST_KERNEL_PATH = os.path.join(MS_OPS_KERNEL_PATH, "common/pyboost")
|
|
91
91
|
MS_PYBOOST_BASE_PATH = "mindspore/ccsrc/pyboost"
|
|
92
|
+
MS_PYBOOST_INTERNAL_FUNCTIONS_AUTO_GEN_PATH = os.path.join(MS_OPS_KERNEL_PATH,
|
|
93
|
+
"ascend/pyboost/internal/functions")
|
|
94
|
+
MS_INTERNAL_PYBOOST_GEN_PATH = "mindspore/ccsrc/plugin/device/ascend/kernel/internal/pyboost/auto_gen"
|
|
95
|
+
MS_PLUGIN_INTERNAL_PATH = "mindspore/ccsrc/plugin/device/ascend/kernel/internal"
|
|
96
|
+
MS_OPS_PYBOOST_INTERNAL = "mindspore/ops/kernel/ascend/pyboost/internal"
|
|
@@ -121,25 +121,6 @@ def merge_files(origin_dir, merged_file_path, file_format):
|
|
|
121
121
|
merge_files_to_one_file(op_yaml_file_names, merged_file_path)
|
|
122
122
|
|
|
123
123
|
|
|
124
|
-
def merge_files_append(origin_dir, merged_file_path, file_format):
|
|
125
|
-
"""
|
|
126
|
-
Merge multiple files into one file.
|
|
127
|
-
origin_dir: indicates the origin file directory.
|
|
128
|
-
merged_file_path: indicates the merged file path.
|
|
129
|
-
file_format: indicates the format of regular matching.
|
|
130
|
-
Files whose names meet the regular matching in 'origin_dir' directory will be merged into one file.
|
|
131
|
-
"""
|
|
132
|
-
file_paths = glob.glob(os.path.join(origin_dir, file_format))
|
|
133
|
-
merged_content = ''
|
|
134
|
-
file_paths.sort()
|
|
135
|
-
for file_path in file_paths:
|
|
136
|
-
with open(file_path, 'r') as file:
|
|
137
|
-
merged_content += file.read()
|
|
138
|
-
merged_content += '\n'
|
|
139
|
-
with open(merged_file_path, 'a') as file:
|
|
140
|
-
file.write(merged_content)
|
|
141
|
-
|
|
142
|
-
|
|
143
124
|
def safe_load_yaml(yaml_file_path):
|
|
144
125
|
"""
|
|
145
126
|
Load yaml dictionary from file.
|
|
@@ -112,10 +112,12 @@ class OpDispatch:
|
|
|
112
112
|
gpu (str): The dispatch type for the GPU.
|
|
113
113
|
"""
|
|
114
114
|
|
|
115
|
-
def __init__(self, enable=False, is_comm_op=False, ascend='default',
|
|
115
|
+
def __init__(self, enable=False, is_comm_op=False, ascend='default',
|
|
116
|
+
internal_op_ascend='None', cpu='default', gpu='default'):
|
|
116
117
|
self.enable = enable
|
|
117
118
|
self.is_comm_op = is_comm_op
|
|
118
119
|
self.ascend = ascend
|
|
120
|
+
self.internal_op_ascend = internal_op_ascend
|
|
119
121
|
self.cpu = cpu
|
|
120
122
|
self.gpu = gpu
|
|
121
123
|
|
|
@@ -151,7 +153,8 @@ class OpProto:
|
|
|
151
153
|
op_inplace=False,
|
|
152
154
|
op_labels=None,
|
|
153
155
|
op_deprecated=None,
|
|
154
|
-
bprop_expander=True
|
|
156
|
+
bprop_expander=True,
|
|
157
|
+
non_differentiable=False):
|
|
155
158
|
self.op_name = op_name
|
|
156
159
|
self.op_args = op_args
|
|
157
160
|
self.op_function = op_function
|
|
@@ -165,6 +168,7 @@ class OpProto:
|
|
|
165
168
|
self.op_labels = op_labels
|
|
166
169
|
self.op_deprecated = op_deprecated
|
|
167
170
|
self.bprop_expander = bprop_expander
|
|
171
|
+
self.non_differentiable = non_differentiable
|
|
168
172
|
|
|
169
173
|
@staticmethod
|
|
170
174
|
def load_from_yaml(op_name, op_data):
|
|
@@ -208,10 +212,12 @@ class OpProto:
|
|
|
208
212
|
# get op deprecated
|
|
209
213
|
op_deprecated = op_data.get('deprecated', None)
|
|
210
214
|
bprop_expander = op_data.get('bprop_expander', True)
|
|
215
|
+
non_differentiable = op_data.get('non-differentiable', False)
|
|
211
216
|
op_proto = OpProto(op_name=op_name, op_args=op_args, op_returns=op_returns, op_function=op_function,
|
|
212
217
|
op_class=op_class, op_dispatch=op_dispatch, op_args_signature=op_args_signature,
|
|
213
218
|
op_view=op_view, op_graph_view=op_graph_view, op_inplace=op_inplace, op_labels=op_labels,
|
|
214
|
-
op_deprecated=op_deprecated, bprop_expander=bprop_expander
|
|
219
|
+
op_deprecated=op_deprecated, bprop_expander=bprop_expander,
|
|
220
|
+
non_differentiable=non_differentiable)
|
|
215
221
|
return op_proto
|
|
216
222
|
|
|
217
223
|
|
|
@@ -401,9 +407,10 @@ def get_op_dispatch(op_name, op_data):
|
|
|
401
407
|
f'The dispatch enable value should be bool, but get {type(enable)}, op name is {op_name}.')
|
|
402
408
|
is_comm_op = op_dispatch.get('is_comm_op', False)
|
|
403
409
|
ascend = op_dispatch.get('Ascend', 'default')
|
|
410
|
+
internal_op_ascend = op_dispatch.get('InternalOpAscend', 'None')
|
|
404
411
|
cpu = op_dispatch.get('CPU', 'default')
|
|
405
412
|
gpu = op_dispatch.get('GPU', 'default')
|
|
406
|
-
return OpDispatch(enable, is_comm_op, ascend, cpu, gpu)
|
|
413
|
+
return OpDispatch(enable, is_comm_op, ascend, internal_op_ascend, cpu, gpu)
|
|
407
414
|
|
|
408
415
|
|
|
409
416
|
def get_op_class(op_name, op_data) -> OpClass:
|
|
@@ -93,7 +93,6 @@ ${func_impl_name}_impl = _Pyboost${class_name}Prim()
|
|
|
93
93
|
""")
|
|
94
94
|
|
|
95
95
|
IMPORT_PYBOOST_PRIM_HEADER = f"""
|
|
96
|
-
from mindspore.common._stub_tensor import _convert_stub
|
|
97
96
|
from mindspore.ops._utils.arg_handler import *
|
|
98
97
|
"""
|
|
99
98
|
|
|
@@ -118,19 +117,89 @@ REGISTER_PYBOOST_GRAD_DEFINE_TEMPLATE = Template(
|
|
|
118
117
|
REGISTER_PYBOOST_GRAD_TEMPLATE = Template("${register_func}")
|
|
119
118
|
|
|
120
119
|
PYBOOST_FUNCTION_HEADER_TEMPLATE = Template.load_from_file(
|
|
121
|
-
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/
|
|
120
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_api_h.tpl'))
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/
|
|
122
|
+
PYBOOST_CORE_HEADER_TEMPLATE = Template.load_from_file(
|
|
123
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_header.tpl'))
|
|
124
|
+
PYBOOST_INTERNAL_OP_HEADER_TEMPLATE = Template.load_from_file(
|
|
125
|
+
os.path.join(K.WORK_DIR,
|
|
126
|
+
f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/internal/template/pyboost_internal_header_template.tpl'))
|
|
127
|
+
|
|
128
|
+
PYBOOST_INTERNAL_SINGLE_OP_HEADER_TEMPLATE = Template.load_from_file(
|
|
129
|
+
os.path.join(K.WORK_DIR,
|
|
130
|
+
f'./{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_single_op_header_template.tpl'))
|
|
131
|
+
|
|
132
|
+
PYBOOST_INTERNAL_SINGLE_OP_SOURCE_TEMPLATE = Template.load_from_file(
|
|
133
|
+
os.path.join(K.WORK_DIR,
|
|
134
|
+
f'./{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_single_op_source_template.tpl'))
|
|
135
|
+
|
|
136
|
+
PYBOOST_INTERNAL_SINGLE_OP_CUSTOMIZE_TEMPLATE = Template.load_from_file(
|
|
137
|
+
os.path.join(K.WORK_DIR,
|
|
138
|
+
f'./{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_single_op_customize_source_template.tpl'))
|
|
139
|
+
|
|
140
|
+
PYBOOST_INTERNAL_OP_SOURCE_TEMPLATE = Template.load_from_file(
|
|
141
|
+
os.path.join(K.WORK_DIR,
|
|
142
|
+
f'./{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_source_template.tpl'))
|
|
143
|
+
|
|
144
|
+
PYBOOST_INTERNAL_FUNCTION_HEADER_TEMPLATE = Template.load_from_file(
|
|
145
|
+
os.path.join(K.WORK_DIR,
|
|
146
|
+
f'{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_functions_header_template.tpl'))
|
|
147
|
+
|
|
148
|
+
PYBOOST_INTERNAL_FUNCTION_SOURCE_TEMPLATE = Template.load_from_file(
|
|
149
|
+
os.path.join(K.WORK_DIR,
|
|
150
|
+
f'{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_functions_source_template.tpl'))
|
|
151
|
+
|
|
152
|
+
PYBOOST_INTERNAL_FUNCTION_TEMPLATE = Template.load_from_file(
|
|
153
|
+
os.path.join(K.WORK_DIR,
|
|
154
|
+
f'{K.MS_OPS_PYBOOST_INTERNAL}/template/pyboost_internal_function_template.tpl'))
|
|
155
|
+
|
|
156
|
+
PYBOOST_KERNEL_INFO_ADAPTER_TEMPLATE = Template.load_from_file(
|
|
157
|
+
os.path.join(K.WORK_DIR,
|
|
158
|
+
f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/kernel_info_adapter.tpl'))
|
|
159
|
+
|
|
160
|
+
PYBOOST_KERNEL_INFO_ADAPTER_H_TEMPLATE = Template.load_from_file(
|
|
161
|
+
os.path.join(K.WORK_DIR,
|
|
162
|
+
f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/kernel_info_adapter_h.tpl'))
|
|
163
|
+
|
|
164
|
+
PYBOOST_INTERNAL_KERNEL_INFO_ADAPTER_H_TEMPLATE = Template.load_from_file(
|
|
165
|
+
os.path.join(K.WORK_DIR,
|
|
166
|
+
f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/internal_kernel_info_adapter_h.tpl'))
|
|
167
|
+
|
|
168
|
+
PYBOOST_INTERNAL_KERNEL_INFO_ADAPTER_TEMPLATE = Template.load_from_file(
|
|
169
|
+
os.path.join(K.WORK_DIR,
|
|
170
|
+
f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/internal_kernel_info_adapter.tpl'))
|
|
171
|
+
|
|
172
|
+
PYBOOST_INTERNAL_KERNEL_INFO_ADAPTER_CPP_TEMPLATE = Template.load_from_file(
|
|
173
|
+
os.path.join(K.WORK_DIR,
|
|
174
|
+
f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/internal_kernel_info_adapter_cpp.tpl'))
|
|
175
|
+
|
|
176
|
+
PYBOOST_INTERNAL_KERNEL_INFO_ADAPTER_SINGLE_CPP_TEMPLATE = Template.load_from_file(
|
|
177
|
+
os.path.join(K.WORK_DIR,
|
|
178
|
+
f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/internal_kernel_info_adapter_single_cpp.tpl'))
|
|
125
179
|
|
|
126
|
-
|
|
127
|
-
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/
|
|
180
|
+
PYBOOST_REGISTRY_BODY_CC_TEMPLATE = Template.load_from_file(
|
|
181
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_registry_body_cc.tpl'))
|
|
128
182
|
|
|
129
|
-
|
|
130
|
-
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/
|
|
183
|
+
PYBOOST_CORE_BODY_TEMPLATE = Template.load_from_file(
|
|
184
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_body.tpl'))
|
|
131
185
|
|
|
132
|
-
|
|
133
|
-
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/
|
|
186
|
+
PYBOOST_CORE_BODY_COMM_TEMPLATE = Template.load_from_file(
|
|
187
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_body_comm.tpl'))
|
|
188
|
+
|
|
189
|
+
PYBOOST_CORE_BODY_SYNC_TEMPLATE = Template.load_from_file(
|
|
190
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_body_sync.tpl'))
|
|
191
|
+
|
|
192
|
+
PYBOOST_REGISTRY_CC_TEMPLATE = Template.load_from_file(
|
|
193
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_registry_cc.tpl'))
|
|
194
|
+
|
|
195
|
+
PYBOOST_API_CC_TEMPLATE = Template.load_from_file(
|
|
196
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_api_cc.tpl'))
|
|
197
|
+
|
|
198
|
+
PYBOOST_API_BODY_CC_TEMPLATE = Template.load_from_file(
|
|
199
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_api_body_cc.tpl'))
|
|
200
|
+
|
|
201
|
+
PYBOOST_CORE_CC_TEMPLATE = Template.load_from_file(
|
|
202
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_cc.tpl'))
|
|
134
203
|
|
|
135
204
|
PYBOOST_OVERLOAD_FUNCTIONS_CC_TEMPLATE = Template.load_from_file(
|
|
136
205
|
os.path.join(
|
|
@@ -213,6 +282,10 @@ PYBOOST_OP_REGISTER_TEMPLATE = Template.load_from_file(
|
|
|
213
282
|
PYBOOST_ASCEND_OP_HEADER_TEMPLATE = Template.load_from_file(
|
|
214
283
|
os.path.join(K.WORK_DIR,
|
|
215
284
|
f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_header_template.tpl'))
|
|
285
|
+
PYBOOST_ASCEND_INTERNAL_OP_HEADER_TEMPLATE = Template.load_from_file(
|
|
286
|
+
os.path.join(K.WORK_DIR,
|
|
287
|
+
f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/internal/template/pyboost_internal_header_template.tpl')
|
|
288
|
+
)
|
|
216
289
|
|
|
217
290
|
PYBOOST_ASCEND_OP_SOURCE_TEMPLATE = Template.load_from_file(
|
|
218
291
|
os.path.join(K.WORK_DIR,
|
|
@@ -226,6 +299,8 @@ PYBOOST_ASCEND_SINGLE_HCLL_OP_HEADER_TEMPLATE = Template.load_from_file(
|
|
|
226
299
|
os.path.join(K.WORK_DIR,
|
|
227
300
|
f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_single_hccl_op_header_template.tpl'))
|
|
228
301
|
|
|
302
|
+
PYBOOST_CALL_FUNC_TEMPLATE = Template('${return_type} Call(${call_args_with_type}) override;')
|
|
303
|
+
|
|
229
304
|
PYBOOST_ASCEND_SINGLE_OP_SOURCE_TEMPLATE = Template.load_from_file(
|
|
230
305
|
os.path.join(K.WORK_DIR,
|
|
231
306
|
f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_single_op_source_template.tpl'))
|
|
@@ -373,7 +448,6 @@ from mindspore.ops._primitive_cache import _get_cache_prim
|
|
|
373
448
|
from mindspore.ops._utils.arg_dtype_cast import type_it
|
|
374
449
|
from mindspore.ops._utils.arg_handler import *
|
|
375
450
|
from mindspore._c_expression import OpDtype
|
|
376
|
-
from mindspore.common._stub_tensor import _convert_stub
|
|
377
451
|
from mindspore.common.jit_context import jit_context
|
|
378
452
|
from mindspore._checkparam import is_stub_tensor
|
|
379
453
|
"""
|
|
@@ -509,6 +583,9 @@ FUNCTIONS_CC_TEMPLATE = Template.load_from_file(
|
|
|
509
583
|
FUNCTION_BODY_TEMPLATE = Template.load_from_file(
|
|
510
584
|
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/function_body.tpl'))
|
|
511
585
|
|
|
586
|
+
FUNCTION_COMM_BODY_TEMPLATE = Template.load_from_file(
|
|
587
|
+
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/comm_function_body.tpl'))
|
|
588
|
+
|
|
512
589
|
FUNCTIONS_H_TEMPLATE = Template.load_from_file(
|
|
513
590
|
os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/functions_h.tpl'))
|
|
514
591
|
|
|
@@ -24,7 +24,6 @@ import common.template as template
|
|
|
24
24
|
from common.base_generator import BaseGenerator
|
|
25
25
|
from pyboost import pyboost_utils
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
LITE_OPS_H = """
|
|
29
28
|
#ifndef MINDSPORE_CORE_OPS_GEN_LITE_OPS_H_
|
|
30
29
|
#define MINDSPORE_CORE_OPS_GEN_LITE_OPS_H_
|
|
@@ -122,9 +121,10 @@ class LiteOpsCcGenerator(BaseGenerator):
|
|
|
122
121
|
self.inc_ops_head_templat = template.Template(INC_OPS_HEAD)
|
|
123
122
|
self.lite_ops_cc_template = template.Template(LITE_OPS_CC)
|
|
124
123
|
self.op_template = template.op_template
|
|
125
|
-
self.register_primitive_c_template = template.Template(
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
self.register_primitive_c_template = template.Template(
|
|
125
|
+
"${op_name}::${op_name}():BaseOperator(kName${op_name}) {}\n"
|
|
126
|
+
"REGISTER_PRIMITIVE_C(kName${op_name}, ${op_name});\n"
|
|
127
|
+
"MIND_API_OPERATOR_IMPL(${op_name}, BaseOperator);\n\n")
|
|
128
128
|
|
|
129
129
|
def generate(self, work_path, op_protos):
|
|
130
130
|
"""
|
|
@@ -19,15 +19,12 @@ This module defines the `OpsNameHGenerator` class, which produces C++ code to de
|
|
|
19
19
|
constants for operator names based on given prototypes.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
import os
|
|
23
|
-
|
|
24
22
|
import common.gen_constants as K
|
|
25
23
|
import common.gen_utils as gen_utils
|
|
26
24
|
import common.template as template
|
|
27
25
|
from common.base_generator import BaseGenerator
|
|
28
26
|
from pyboost import pyboost_utils
|
|
29
27
|
|
|
30
|
-
|
|
31
28
|
OP_NAME_OP_DEF = """
|
|
32
29
|
#ifndef MINDSPORE_CORE_OP_NAME_${suffix}_H_
|
|
33
30
|
#define MINDSPORE_CORE_OP_NAME_${suffix}_H_
|
|
@@ -19,15 +19,12 @@ This module defines the `OpsPrimitiveHGenerator` class, which creates C++ header
|
|
|
19
19
|
containing definitions for operator primitives based on provided operator prototypes.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
import os
|
|
23
|
-
|
|
24
22
|
import common.gen_constants as K
|
|
25
23
|
import common.gen_utils as gen_utils
|
|
26
24
|
import common.template as template
|
|
27
25
|
from common.base_generator import BaseGenerator
|
|
28
26
|
from pyboost import pyboost_utils
|
|
29
27
|
|
|
30
|
-
|
|
31
28
|
OP_PRIM_OP_DEF_H = """
|
|
32
29
|
#ifndef MINDSPORE_CORE_OPS_GEN_OPS_PRIMITIVE_${suffix}_H_
|
|
33
30
|
#define MINDSPORE_CORE_OPS_GEN_OPS_PRIMITIVE_${suffix}_H_
|
|
@@ -42,7 +39,6 @@ $ops_prim_gen
|
|
|
42
39
|
#endif // MINDSPORE_CORE_OPS_GEN_OPS_PRIMITIVE_${suffix}_H_
|
|
43
40
|
"""
|
|
44
41
|
|
|
45
|
-
|
|
46
42
|
OP_PRIM_OP_DEF_CC = """
|
|
47
43
|
|
|
48
44
|
#include "$auto_gen_path/gen_ops_primitive_${suffix}.h"
|
|
@@ -142,7 +142,10 @@ class OpPrimPyGenerator(BaseGenerator):
|
|
|
142
142
|
# step1.3: get args set prim arg expression:
|
|
143
143
|
assign_str = self._get_assign_str_by_type_it(op_proto.op_class.name, arg)
|
|
144
144
|
if arg.arg_handler:
|
|
145
|
-
assign_str =
|
|
145
|
+
assign_str = (
|
|
146
|
+
f' self._set_prim_arg_with_handler('
|
|
147
|
+
f'"{arg.arg_name}", {assign_str}, {arg.arg_handler})'
|
|
148
|
+
)
|
|
146
149
|
else:
|
|
147
150
|
assign_str = f""" self._set_prim_arg("{arg.arg_name}", {assign_str})"""
|
|
148
151
|
args_assign.append(assign_str)
|
|
@@ -318,7 +321,7 @@ class OpPrimPyGenerator(BaseGenerator):
|
|
|
318
321
|
call_method_body_str += f"""
|
|
319
322
|
# Add for jit context.
|
|
320
323
|
if jit_context() and jit_context().compiled:
|
|
321
|
-
return
|
|
324
|
+
return jit_context().default_output()"""
|
|
322
325
|
pyboost_func_name = pyboost_utils.get_pyboost_name(op_proto.op_name)
|
|
323
326
|
call_method_body_str += f"""
|
|
324
327
|
res = {pyboost_func_name}(self, [{call_args_list_str}])"""
|