mindspore 2.6.0rc1__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 +65 -84
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +58 -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 +178 -53
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +377 -203
- 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 +5 -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 +117 -131
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +67 -55
- 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 +70 -24
- 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 +3 -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 +27 -7
- 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 +6 -46
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +429 -23
- 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 +140 -104
- 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 +491 -623
- 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 +117 -110
- 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 +4 -6
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/asgd.py +2 -0
- 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 +5 -5
- 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 +31 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +54 -13
- mindspore/ops/auto_generate/gen_extend_func.py +27 -145
- mindspore/ops/auto_generate/gen_ops_def.py +1027 -347
- mindspore/ops/auto_generate/gen_ops_prim.py +2341 -1117
- 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 +133 -109
- 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 +19 -102
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +77 -572
- mindspore/ops/function/nn_func.py +46 -94
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +44 -5
- mindspore/ops/function/vmap_func.py +2 -1
- mindspore/ops/functional.py +4 -4
- mindspore/ops/functional_overload.py +594 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +16 -11
- mindspore/ops/operations/_custom_ops_utils.py +689 -34
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +5 -51
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +303 -177
- mindspore/ops/operations/debug_ops.py +59 -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 +8 -40
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +63 -15
- 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 +8 -3
- 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_def_cc_generator.py +0 -3
- 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 +16 -23
- mindspore/parallel/_cell_wrapper.py +113 -45
- 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 +35 -14
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +13 -7
- 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 +12 -12
- 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 +10 -25
- mindspore/parallel/transform_safetensors.py +469 -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 +12 -6
- 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 +31 -32
- 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 +17 -7
- 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 +98 -21
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +133 -69
- 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 +163 -77
- 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.0rc1.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/RECORD +403 -442
- 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.0rc1.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -71,7 +71,7 @@ class PyboostOverloadFunctionsGenerator(BaseGenerator):
|
|
|
71
71
|
'${arg_handler_processor}\n'
|
|
72
72
|
'MS_LOG(INFO) << "Call Tensor${class_name}";\n'
|
|
73
73
|
'auto res = ${pyboost_base_func_name}_OP(${prim_name}, parse_args.src_types_, ${convert_args});\n'
|
|
74
|
-
'trace::Capture(parse_args.arg_list_,
|
|
74
|
+
'trace::Capture(parse_args.arg_list_, mindspore::prim::kPrim${class_name}, &res);\n'
|
|
75
75
|
'return res;\n'
|
|
76
76
|
)
|
|
77
77
|
self.callback_python_template = Template(
|
|
@@ -68,7 +68,7 @@ def get_index(index: int):
|
|
|
68
68
|
return "kIndex" + str(index)
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def get_convert_type_str(dtype: str, optional):
|
|
71
|
+
def get_convert_type_str(dtype: str, optional, use_basic_type=False):
|
|
72
72
|
"""
|
|
73
73
|
Convert type
|
|
74
74
|
"""
|
|
@@ -106,16 +106,30 @@ def get_convert_type_str(dtype: str, optional):
|
|
|
106
106
|
'list[bool]': 'ToBoolListOptional<py::list>',
|
|
107
107
|
'list[tensor]': 'ToTensorListOptional<py::list>',
|
|
108
108
|
}
|
|
109
|
+
basic_optional_type_convert = {
|
|
110
|
+
'tuple[int]': "ToBasicIntVectorOptional",
|
|
111
|
+
'list[int]': "ToBasicIntVectorOptional",
|
|
112
|
+
'int': "ToBasicIntOptional",
|
|
113
|
+
}
|
|
114
|
+
basic_type_convert = {
|
|
115
|
+
'tuple[int]': "ToBasicIntVector",
|
|
116
|
+
'list[int]': "ToBasicIntVector",
|
|
117
|
+
'int': "ToBasicInt",
|
|
118
|
+
}
|
|
109
119
|
if optional:
|
|
120
|
+
if use_basic_type and dtype in basic_optional_type_convert:
|
|
121
|
+
return basic_optional_type_convert[dtype]
|
|
110
122
|
if dtype in optional_type_convert:
|
|
111
123
|
return optional_type_convert[dtype]
|
|
112
124
|
raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
|
|
125
|
+
if use_basic_type and dtype in basic_type_convert:
|
|
126
|
+
return basic_type_convert[dtype]
|
|
113
127
|
if dtype in native_type_convert:
|
|
114
128
|
return native_type_convert[dtype]
|
|
115
129
|
raise TypeError(f"""Unsupported convert type {dtype} for args.""")
|
|
116
130
|
|
|
117
131
|
|
|
118
|
-
def get_input_args_type_str(dtype: str, optional):
|
|
132
|
+
def get_input_args_type_str(dtype: str, optional, use_basic_type=False):
|
|
119
133
|
"""
|
|
120
134
|
Convert type
|
|
121
135
|
"""
|
|
@@ -153,17 +167,52 @@ def get_input_args_type_str(dtype: str, optional):
|
|
|
153
167
|
'list[bool]': 'std::optional<ValueTuplePtr>',
|
|
154
168
|
'list[tensor]': 'std::optional<ValueTuplePtr>',
|
|
155
169
|
}
|
|
170
|
+
basic_optional_type_convert = {
|
|
171
|
+
'tuple[int]': "std::optional<std::vector<int64_t>>",
|
|
172
|
+
'list[int]': "std::optional<std::vector<int64_t>>",
|
|
173
|
+
'int': "std::optional<int64_t>",
|
|
174
|
+
}
|
|
175
|
+
basic_type_convert = {
|
|
176
|
+
'tuple[int]': "std::vector<int64_t>",
|
|
177
|
+
'list[int]': "std::vector<int64_t>",
|
|
178
|
+
'int': "int64_t",
|
|
179
|
+
}
|
|
156
180
|
if optional:
|
|
181
|
+
if use_basic_type and dtype in basic_optional_type_convert:
|
|
182
|
+
return basic_optional_type_convert[dtype]
|
|
157
183
|
if dtype in optional_type:
|
|
158
184
|
return optional_type[dtype]
|
|
159
185
|
raise TypeError(f"""Unknown optional type {dtype} for args.""")
|
|
186
|
+
if use_basic_type and dtype in basic_type_convert:
|
|
187
|
+
return basic_type_convert[dtype]
|
|
160
188
|
if dtype in native_type:
|
|
161
189
|
return native_type[dtype]
|
|
162
190
|
raise TypeError(f"""Unknown type {dtype} for args.""")
|
|
163
191
|
|
|
164
192
|
|
|
193
|
+
def basic_type_convert_str(dtype: str, optional):
|
|
194
|
+
"""
|
|
195
|
+
Convert type
|
|
196
|
+
"""
|
|
197
|
+
optional_type = {
|
|
198
|
+
'tuple[int]': "ToBasicIntVectorOptional",
|
|
199
|
+
'list[int]': "ToBasicIntVectorOptional",
|
|
200
|
+
'int': "ToBasicIntOptional",
|
|
201
|
+
}
|
|
202
|
+
native_type = {
|
|
203
|
+
'tuple[int]': "ToBasicIntVector",
|
|
204
|
+
'list[int]': "ToBasicIntVector",
|
|
205
|
+
'int': "ToBasicInt",
|
|
206
|
+
}
|
|
207
|
+
if optional:
|
|
208
|
+
if dtype in optional_type:
|
|
209
|
+
return optional_type[dtype]
|
|
210
|
+
if dtype in native_type:
|
|
211
|
+
return native_type[dtype]
|
|
212
|
+
return ""
|
|
213
|
+
|
|
165
214
|
|
|
166
|
-
def get_value_convert_type_str(dtype: str, optional):
|
|
215
|
+
def get_value_convert_type_str(dtype: str, optional, use_basic_type=False):
|
|
167
216
|
"""
|
|
168
217
|
Convert type
|
|
169
218
|
"""
|
|
@@ -193,10 +242,24 @@ def get_value_convert_type_str(dtype: str, optional):
|
|
|
193
242
|
'tuple[bool]': 'ToValueTupleOptional',
|
|
194
243
|
'tuple[tensor]': 'ToValueTupleOptional',
|
|
195
244
|
}
|
|
245
|
+
basic_optional_type_convert = {
|
|
246
|
+
'tuple[int]': "ToBasicIntVectorOptional",
|
|
247
|
+
'list[int]': "ToBasicIntVectorOptional",
|
|
248
|
+
'int': "ToBasicIntOptional",
|
|
249
|
+
}
|
|
250
|
+
basic_type_convert = {
|
|
251
|
+
'tuple[int]': "ToBasicIntVector",
|
|
252
|
+
'list[int]': "ToBasicIntVector",
|
|
253
|
+
'int': "ToBasicInt",
|
|
254
|
+
}
|
|
196
255
|
if optional:
|
|
256
|
+
if use_basic_type and dtype in basic_optional_type_convert:
|
|
257
|
+
return basic_optional_type_convert[dtype]
|
|
197
258
|
if dtype in optional_type_convert:
|
|
198
259
|
return optional_type_convert[dtype]
|
|
199
260
|
raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
|
|
261
|
+
if use_basic_type and dtype in basic_type_convert:
|
|
262
|
+
return basic_type_convert[dtype]
|
|
200
263
|
if dtype in native_type_convert:
|
|
201
264
|
return native_type_convert[dtype]
|
|
202
265
|
raise TypeError(f"""Unsupported convert type {dtype} for args.""")
|
|
@@ -212,7 +275,7 @@ def tuple_input_to_cpp_type(dtype: str):
|
|
|
212
275
|
'tuple[int]': 'int64_t',
|
|
213
276
|
'tuple[float]': 'float',
|
|
214
277
|
'tuple[bool]': 'bool',
|
|
215
|
-
'tuple[str]': 'string',
|
|
278
|
+
'tuple[str]': 'std::string',
|
|
216
279
|
'tuple[tensor]': 'mindspore::tensor::TensorPtr',
|
|
217
280
|
'list[int]': 'int64_t',
|
|
218
281
|
'list[float]': 'float',
|
|
@@ -227,12 +290,44 @@ def number_input_to_cpp_type(dtype: str):
|
|
|
227
290
|
'int': 'int64_t',
|
|
228
291
|
'float': 'float',
|
|
229
292
|
'bool': 'bool',
|
|
230
|
-
'str': 'string'
|
|
293
|
+
'str': 'std::string'
|
|
231
294
|
}
|
|
232
295
|
return types_map.get(dtype)
|
|
233
296
|
|
|
234
297
|
|
|
235
|
-
def
|
|
298
|
+
def input_dtype_to_cpp_type(dtype: str, optional):
|
|
299
|
+
"""
|
|
300
|
+
Map input dtype to cpp dtype
|
|
301
|
+
"""
|
|
302
|
+
type_convert = {
|
|
303
|
+
'int': 'int64_t',
|
|
304
|
+
'float': 'float',
|
|
305
|
+
'bool': 'bool',
|
|
306
|
+
'number': 'mindspore::ScalarPtr',
|
|
307
|
+
'str': 'std::string',
|
|
308
|
+
'tensor': 'mindspore::tensor::TensorPtr',
|
|
309
|
+
'tuple[int]': 'std::vector<int64_t>',
|
|
310
|
+
'tuple[float]': 'std::vector<float>',
|
|
311
|
+
'tuple[bool]': 'std::vector<bool>',
|
|
312
|
+
'tuple[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
|
|
313
|
+
'list[int]': 'std::vector<int64_t>',
|
|
314
|
+
'list[float]': 'std::vector<float>',
|
|
315
|
+
'list[bool]': 'std::vector<bool>',
|
|
316
|
+
'list[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
|
|
317
|
+
}
|
|
318
|
+
optional_tensor_type_convert = {
|
|
319
|
+
'tensor': 'std::optional<mindspore::tensor::TensorPtr>',
|
|
320
|
+
'tuple[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
|
|
321
|
+
'list[tensor]': 'std::vector<mindspore::tensor::TensorPtr>'
|
|
322
|
+
}
|
|
323
|
+
if optional and dtype in optional_tensor_type_convert:
|
|
324
|
+
return optional_tensor_type_convert[dtype]
|
|
325
|
+
if dtype in type_convert:
|
|
326
|
+
return type_convert[dtype]
|
|
327
|
+
raise TypeError(f"""Unsupported dtype {dtype} for args.""")
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def get_input_dtype(dtype: str, optional, use_basic_type=False):
|
|
236
331
|
"""
|
|
237
332
|
Convert type
|
|
238
333
|
"""
|
|
@@ -244,7 +339,7 @@ def get_input_dtype(dtype: str, optional):
|
|
|
244
339
|
'bool': 'mindspore::BoolImmPtr',
|
|
245
340
|
'number': 'mindspore::ScalarPtr',
|
|
246
341
|
'str': 'mindspore::StringImmPtr',
|
|
247
|
-
'tensor': 'mindspore::tensor::
|
|
342
|
+
'tensor': 'mindspore::tensor::TensorPtr',
|
|
248
343
|
'tuple[int]': value_tuple,
|
|
249
344
|
'tuple[float]': value_tuple,
|
|
250
345
|
'tuple[bool]': value_tuple,
|
|
@@ -261,16 +356,30 @@ def get_input_dtype(dtype: str, optional):
|
|
|
261
356
|
'bool': 'std::optional<mindspore::BoolImmPtr>',
|
|
262
357
|
'number': 'std::optional<mindspore::ScalarPtr>',
|
|
263
358
|
'str': 'std::optional<mindspore::StringImmPtr>',
|
|
264
|
-
'tensor': 'std::optional<mindspore::tensor::
|
|
359
|
+
'tensor': 'std::optional<mindspore::tensor::TensorPtr>',
|
|
265
360
|
'tuple[int]': value_tuple_optional,
|
|
266
361
|
'tuple[float]': value_tuple_optional,
|
|
267
362
|
'tuple[bool]': value_tuple_optional,
|
|
268
363
|
'tuple[tensor]': value_tuple_optional,
|
|
269
364
|
}
|
|
365
|
+
basic_optional_type_convert = {
|
|
366
|
+
'tuple[int]': "std::optional<std::vector<int64_t>>",
|
|
367
|
+
'list[int]': "std::optional<std::vector<int64_t>>",
|
|
368
|
+
'int': "std::optional<int64_t>",
|
|
369
|
+
}
|
|
370
|
+
basic_type_convert = {
|
|
371
|
+
'tuple[int]': "std::vector<int64_t>",
|
|
372
|
+
'list[int]': "std::vector<int64_t>",
|
|
373
|
+
'int': "int64_t",
|
|
374
|
+
}
|
|
270
375
|
if optional:
|
|
376
|
+
if use_basic_type and dtype in basic_optional_type_convert:
|
|
377
|
+
return basic_optional_type_convert[dtype]
|
|
271
378
|
if dtype in optional_type_convert:
|
|
272
379
|
return optional_type_convert[dtype]
|
|
273
380
|
raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
|
|
381
|
+
if use_basic_type and dtype in basic_type_convert:
|
|
382
|
+
return basic_type_convert[dtype]
|
|
274
383
|
if dtype in type_convert:
|
|
275
384
|
return type_convert[dtype]
|
|
276
385
|
raise TypeError(f"""Unsupported convert type {dtype} for args.""")
|
|
@@ -343,7 +452,7 @@ def get_tuple_input_convert(arg_name, arg_type):
|
|
|
343
452
|
"""
|
|
344
453
|
cpp_type = tuple_input_to_cpp_type(arg_type)
|
|
345
454
|
if cpp_type == "mindspore::tensor::TensorPtr":
|
|
346
|
-
cpp_type = "mindspore::tensor::
|
|
455
|
+
cpp_type = "mindspore::tensor::TensorPtr"
|
|
347
456
|
return f"std::vector<{cpp_type}> {arg_name}_vector = ConvertValueTupleToVector<{cpp_type}>({arg_name});\n"
|
|
348
457
|
|
|
349
458
|
|
|
@@ -37,15 +37,6 @@ class TensorPyCppGenerator(BaseGenerator):
|
|
|
37
37
|
'{"${snake_api_name}"'
|
|
38
38
|
', (PyCFunction)TensorMethod${pascal_api_name}_CPyWrapper, METH_VARARGS | METH_KEYWORDS},'
|
|
39
39
|
)
|
|
40
|
-
self.stubtensor_api_def_template = Template(
|
|
41
|
-
'py::cpp_function TensorMethod${snake_api_name}_wrapper(\n'
|
|
42
|
-
' [](const py::object& self, const py::args& args, const py::kwargs& kwargs) {\n'
|
|
43
|
-
' return TensorMethod${pascal_api_name}(self, args, kwargs);\n'
|
|
44
|
-
' },\n'
|
|
45
|
-
' py::is_method(stubTensorClass)\n'
|
|
46
|
-
');\n'
|
|
47
|
-
'stubTensorClass.attr("${snake_api_name}") = TensorMethod${snake_api_name}_wrapper;'
|
|
48
|
-
)
|
|
49
40
|
|
|
50
41
|
def generate(self, work_path, tensor_method_protos, alias_func_mapping):
|
|
51
42
|
"""
|
|
@@ -61,7 +52,6 @@ class TensorPyCppGenerator(BaseGenerator):
|
|
|
61
52
|
"""
|
|
62
53
|
wrapper_defs = []
|
|
63
54
|
tensor_api_defs = []
|
|
64
|
-
stubtensor_api_defs = []
|
|
65
55
|
for api_name, _ in tensor_method_protos.items():
|
|
66
56
|
pascal_api_name = pyboost_utils.format_func_api_name(api_name)
|
|
67
57
|
snake_api_name = api_name
|
|
@@ -72,12 +62,6 @@ class TensorPyCppGenerator(BaseGenerator):
|
|
|
72
62
|
pascal_api_name=pascal_api_name
|
|
73
63
|
)
|
|
74
64
|
)
|
|
75
|
-
stubtensor_api_defs.append(
|
|
76
|
-
self.stubtensor_api_def_template.replace(
|
|
77
|
-
snake_api_name=snake_api_name,
|
|
78
|
-
pascal_api_name=pascal_api_name
|
|
79
|
-
)
|
|
80
|
-
)
|
|
81
65
|
if api_name in alias_func_mapping:
|
|
82
66
|
alias_api_names = alias_func_mapping[api_name]
|
|
83
67
|
for alias_api_name in alias_api_names:
|
|
@@ -88,19 +72,12 @@ class TensorPyCppGenerator(BaseGenerator):
|
|
|
88
72
|
pascal_api_name=pascal_api_name
|
|
89
73
|
)
|
|
90
74
|
)
|
|
91
|
-
stubtensor_api_defs.append(
|
|
92
|
-
self.stubtensor_api_def_template.replace(
|
|
93
|
-
snake_api_name=snake_api_name,
|
|
94
|
-
pascal_api_name=pascal_api_name
|
|
95
|
-
)
|
|
96
|
-
)
|
|
97
75
|
|
|
98
76
|
# delete the ' \' for the last wrapper macro definition
|
|
99
77
|
wrapper_defs[-1] = wrapper_defs[-1][:-2]
|
|
100
78
|
|
|
101
79
|
file_str = self.TENSOR_PY_CC_TEMPLATE.replace(
|
|
102
|
-
tensor_api_defs=tensor_api_defs
|
|
103
|
-
stubtensor_api_defs=stubtensor_api_defs
|
|
80
|
+
tensor_api_defs=tensor_api_defs
|
|
104
81
|
)
|
|
105
82
|
save_file(
|
|
106
83
|
os.path.join(work_path, K.TENSOR_PY_CC_PATH),
|
|
@@ -81,6 +81,7 @@ class _PipelineScheduler:
|
|
|
81
81
|
PIPELINE_SEQPIPE = "seqpipe"
|
|
82
82
|
PIPELINE_SEQVPP = "seqvpp"
|
|
83
83
|
PIPELINE_SEQSMARTVPP = "seqsmartvpp"
|
|
84
|
+
PIPELINE_ZBV = "zero_bubble_v"
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
class _AutoParallelContext:
|
|
@@ -434,13 +435,6 @@ class _AutoParallelContext:
|
|
|
434
435
|
"""
|
|
435
436
|
self.check_context_handle()
|
|
436
437
|
run_mode = context.get_context("mode")
|
|
437
|
-
if run_mode == context.PYNATIVE_MODE and parallel_mode not in (
|
|
438
|
-
context.ParallelMode.DATA_PARALLEL, context.ParallelMode.STAND_ALONE,
|
|
439
|
-
context.ParallelMode.AUTO_PARALLEL):
|
|
440
|
-
raise ValueError(f"Pynative only supports STAND_ALONE, DATA_PARALLEL and AUTO_PARALLEL using"
|
|
441
|
-
f" sharding_propagation under shard function"
|
|
442
|
-
f" for ParallelMode, "
|
|
443
|
-
f"but got {parallel_mode.upper()}.")
|
|
444
438
|
ret = self._context_handle.set_parallel_mode(parallel_mode)
|
|
445
439
|
if ret is False:
|
|
446
440
|
raise ValueError("The context configuration parameter 'parallel_mode' only support 'stand_alone', "
|
|
@@ -604,9 +598,6 @@ class _AutoParallelContext:
|
|
|
604
598
|
if not isinstance(dim, int):
|
|
605
599
|
raise TypeError("For 'set_auto_parallel_context', the element of argument "
|
|
606
600
|
"'dataset_strategy' must be int type, but got the type : {} .".format(type(dim)))
|
|
607
|
-
if context.get_context('mode') == context.PYNATIVE_MODE:
|
|
608
|
-
raise ValueError("In PyNative mode, the setting value of 'dataset_strategy' must be either 'full_batch' "
|
|
609
|
-
f"or 'data_parallel', but got {dataset_strategy}.")
|
|
610
601
|
self._dataset_strategy_using_str = False
|
|
611
602
|
self._context_handle.set_dataset_strategy(dataset_strategy)
|
|
612
603
|
|
|
@@ -646,9 +637,6 @@ class _AutoParallelContext:
|
|
|
646
637
|
return "full_batch"
|
|
647
638
|
return "data_parallel"
|
|
648
639
|
dataset_strategy = self._context_handle.get_dataset_strategy()
|
|
649
|
-
if context.get_context('mode') == context.PYNATIVE_MODE:
|
|
650
|
-
raise ValueError("In PyNative mode, the value of 'dataset_strategy' must be either 'full_batch' "
|
|
651
|
-
f"or 'data_parallel', but got the setting value is {dataset_strategy}.")
|
|
652
640
|
return dataset_strategy
|
|
653
641
|
|
|
654
642
|
def set_grad_accumulation_step(self, grad_accumulation_step):
|
|
@@ -662,7 +650,7 @@ class _AutoParallelContext:
|
|
|
662
650
|
raise ValueError("The interface is deprecated. To use gradient accumulation, "
|
|
663
651
|
"please use GradAccumulationCell in mindspore.nn.wrap.cell_wrapper.")
|
|
664
652
|
self.check_context_handle()
|
|
665
|
-
Validator.check_positive_int(grad_accumulation_step)
|
|
653
|
+
Validator.check_positive_int(grad_accumulation_step, prim_name='grad_accumulation_step')
|
|
666
654
|
self._context_handle.set_grad_accumulation_step(grad_accumulation_step)
|
|
667
655
|
|
|
668
656
|
def get_grad_accumulation_step(self):
|
|
@@ -998,9 +986,13 @@ class _AutoParallelContext:
|
|
|
998
986
|
_PipelineScheduler.PIPELINE_GPIPE,
|
|
999
987
|
_PipelineScheduler.PIPELINE_SEQPIPE,
|
|
1000
988
|
_PipelineScheduler.PIPELINE_SEQVPP,
|
|
989
|
+
_PipelineScheduler.PIPELINE_SEQSMARTVPP,
|
|
990
|
+
_PipelineScheduler.PIPELINE_ZBV,
|
|
1001
991
|
_PipelineScheduler.PIPELINE_SEQSMARTVPP])
|
|
1002
|
-
|
|
1003
|
-
|
|
992
|
+
scheduler_val = pipeline_config[pp_scheduler]
|
|
993
|
+
if not pipeline_config[pp_interleave] and scheduler_val != _PipelineScheduler.PIPELINE_1F1B:
|
|
994
|
+
raise TypeError(f"When pipeline_interleave is False, {scheduler_val!r} is not supported, "
|
|
995
|
+
"only '1f1b' is allowed.")
|
|
1004
996
|
|
|
1005
997
|
self._context_handle.set_pipeline_scheduler(pipeline_config[pp_scheduler])
|
|
1006
998
|
|
|
@@ -1038,10 +1030,10 @@ class _AutoParallelContext:
|
|
|
1038
1030
|
shape[n] \* size(dtype). Non-negative. Unit: KB. Default: 64.
|
|
1039
1031
|
- optimizer_weight_shard_size(int): Set the optimizer weight shard group size if you want to specific the
|
|
1040
1032
|
maximum group size across devices when the parallel optimizer is
|
|
1041
|
-
enabled. The numerical range can be (0, device_num].
|
|
1042
|
-
is
|
|
1043
|
-
|
|
1044
|
-
|
|
1033
|
+
enabled. The numerical range can be (0, device_num] or -1. If pipeline
|
|
1034
|
+
parallelism is enabled, the numerical range is (0, device_num/stage]
|
|
1035
|
+
or -1. Default value is -1, which means the optimizer weight shard
|
|
1036
|
+
group size will be equal to the data parallel group of each parameter.
|
|
1045
1037
|
"""
|
|
1046
1038
|
self.check_context_handle()
|
|
1047
1039
|
grad_shard_name = _ParallelOptimizerConfig.GRADIENT_ACCUMULATION_SHARD
|
|
@@ -1070,14 +1062,15 @@ class _AutoParallelContext:
|
|
|
1070
1062
|
|
|
1071
1063
|
if threshold_name in parallel_optimizer_config:
|
|
1072
1064
|
Validator.check_non_negative_int(
|
|
1073
|
-
parallel_optimizer_config[threshold_name])
|
|
1065
|
+
parallel_optimizer_config[threshold_name], prim_name=threshold_name)
|
|
1074
1066
|
self._context_handle.set_parallel_optimizer_threshold(
|
|
1075
1067
|
parallel_optimizer_config[threshold_name])
|
|
1076
1068
|
|
|
1077
1069
|
if optimizer_weight_shard_size_name in parallel_optimizer_config:
|
|
1078
1070
|
value = parallel_optimizer_config[optimizer_weight_shard_size_name]
|
|
1079
|
-
|
|
1080
|
-
|
|
1071
|
+
if value != -1:
|
|
1072
|
+
Validator.check_positive_int(value, prim_name="optimizer_weight_shard_size")
|
|
1073
|
+
self.set_optimizer_weight_shard_size(value)
|
|
1081
1074
|
|
|
1082
1075
|
if optimizer_level_name in parallel_optimizer_config:
|
|
1083
1076
|
optimizer_level = parallel_optimizer_config[optimizer_level_name]
|
|
@@ -26,7 +26,7 @@ from mindspore.ops.operations.comm_ops import AllGather
|
|
|
26
26
|
from mindspore.communication import GlobalComm, get_rank
|
|
27
27
|
from mindspore.common import jit
|
|
28
28
|
from mindspore.communication import create_group, destroy_group, get_group_size
|
|
29
|
-
from mindspore.communication._comm_helper import _get_group_map
|
|
29
|
+
from mindspore.communication._comm_helper import _get_group_map, _remove_group_info
|
|
30
30
|
from mindspore.train._utils import get_parameter_redundancy, remove_param_redundancy
|
|
31
31
|
from mindspore.parallel.shard import Layout
|
|
32
32
|
|
|
@@ -119,20 +119,18 @@ def destroy_allgather_cell():
|
|
|
119
119
|
|
|
120
120
|
def _chang_parallel_context(origin_dataset_strategy):
|
|
121
121
|
"""Change the original parallel state."""
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
context.set_auto_parallel_context(dataset_strategy="data_parallel")
|
|
122
|
+
context.set_auto_parallel_context(parallel_mode="hybrid_parallel")
|
|
123
|
+
if origin_dataset_strategy != "data_parallel":
|
|
124
|
+
context.set_auto_parallel_context(dataset_strategy="data_parallel")
|
|
126
125
|
|
|
127
126
|
|
|
128
127
|
def _restore_parallel_context(origin_parallel_mode, origin_dataset_strategy):
|
|
129
128
|
"""Restore the original parallel state."""
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if origin_dataset_strategy
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
context.set_auto_parallel_context(dataset_strategy=origin_dataset_strategy)
|
|
129
|
+
context.set_auto_parallel_context(parallel_mode=origin_parallel_mode)
|
|
130
|
+
if origin_dataset_strategy != "data_parallel":
|
|
131
|
+
if origin_dataset_strategy is not None and isinstance(origin_dataset_strategy, list):
|
|
132
|
+
origin_dataset_strategy = tuple(tuple(ds_item) for ds_item in origin_dataset_strategy)
|
|
133
|
+
context.set_auto_parallel_context(dataset_strategy=origin_dataset_strategy)
|
|
136
134
|
|
|
137
135
|
|
|
138
136
|
def _get_group_name(group_map, group):
|
|
@@ -166,11 +164,92 @@ def _remove_param_not_load(param_name, param_not_load):
|
|
|
166
164
|
param_not_load.remove(param_name)
|
|
167
165
|
|
|
168
166
|
|
|
169
|
-
def
|
|
167
|
+
def _get_param_index_in_group(total_param_loaded, group, param):
|
|
168
|
+
"""Get param_index in group."""
|
|
169
|
+
param_rank_index = []
|
|
170
|
+
for rank_id in group:
|
|
171
|
+
if rank_id < len(total_param_loaded):
|
|
172
|
+
if param in total_param_loaded[rank_id]:
|
|
173
|
+
param_rank_index.append(rank_id)
|
|
174
|
+
else:
|
|
175
|
+
raise ValueError("rank_id should be smaller than total rank num")
|
|
176
|
+
return param_rank_index
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _communicate_allreduce(allreduce_input, group_map, group):
|
|
180
|
+
"""Communicate allreduce input."""
|
|
181
|
+
if not allreduce_input:
|
|
182
|
+
return
|
|
183
|
+
from mindspore import Tensor
|
|
184
|
+
group_name, is_manual_communication_group = _get_group_name(group_map, group)
|
|
185
|
+
if is_manual_communication_group:
|
|
186
|
+
create_group(group_name, list(group))
|
|
187
|
+
communicator = SingleCommunicator(group_name)
|
|
188
|
+
for real_param in allreduce_input:
|
|
189
|
+
real_param.set_data(communicator(Tensor(real_param)), real_param.sliced)
|
|
190
|
+
if is_manual_communication_group:
|
|
191
|
+
destroy_group(group_name)
|
|
192
|
+
_remove_group_info(group_name)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def _create_allreduce_input(params, group, net_param_dict, total_param_loaded, param_not_load, cur_rank):
|
|
196
|
+
"""Creates allreduce input."""
|
|
197
|
+
from mindspore import Tensor
|
|
198
|
+
allreduce_input = []
|
|
199
|
+
for param in params:
|
|
200
|
+
if param not in net_param_dict:
|
|
201
|
+
continue
|
|
202
|
+
if param.startswith("accu_grads") or param.endswith("expert_load"):
|
|
203
|
+
continue
|
|
204
|
+
param_rank_index = _get_param_index_in_group(total_param_loaded, group, param)
|
|
205
|
+
if not param_rank_index:
|
|
206
|
+
continue
|
|
207
|
+
elif len(param_rank_index) == 1:
|
|
208
|
+
real_param = net_param_dict[param]
|
|
209
|
+
_remove_param_not_load(real_param.name, param_not_load)
|
|
210
|
+
if cur_rank != param_rank_index[0]:
|
|
211
|
+
real_param.set_data(Tensor(np.zeros(real_param.shape), dtype=real_param.dtype), real_param.sliced)
|
|
212
|
+
allreduce_input.append(real_param)
|
|
213
|
+
elif len(param_rank_index) > 1:
|
|
214
|
+
raise ValueError(f"For param {param} in group {group} should be in one rank, but in {param_rank_index}.")
|
|
215
|
+
return allreduce_input
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def _get_sorted_group_map():
|
|
219
|
+
"""Get the world group map."""
|
|
220
|
+
group_map = _get_group_map()
|
|
221
|
+
if group_map:
|
|
222
|
+
group_map = {key: group_map[key] for key in sorted(group_map.keys())}
|
|
223
|
+
return group_map
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _check_total_param_loaded(total_param_loaded):
|
|
227
|
+
"""Check total_param_loaded."""
|
|
228
|
+
flag = True
|
|
229
|
+
for rank_id, param_loaded in enumerate(total_param_loaded):
|
|
230
|
+
if rank_id not in param_loaded:
|
|
231
|
+
flag = False
|
|
232
|
+
logger.warning("The order of loaded parameters on each card obtained by all_gather_object is incorrect,"
|
|
233
|
+
"and the parameter broadcast will reorder them.")
|
|
234
|
+
break
|
|
235
|
+
if not flag:
|
|
236
|
+
new_total_param_loaded = [None] * len(total_param_loaded)
|
|
237
|
+
for _, param_loaded in enumerate(total_param_loaded):
|
|
238
|
+
for param in param_loaded:
|
|
239
|
+
if isinstance(param, int):
|
|
240
|
+
new_total_param_loaded[param] = param_loaded
|
|
241
|
+
break
|
|
242
|
+
return new_total_param_loaded
|
|
243
|
+
return total_param_loaded
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _single_parameter_broadcast(net, layout, param_not_load=None, param_loaded=None):
|
|
170
247
|
"""
|
|
171
248
|
Broadcast single parameter to other rank in data parallel dimension.
|
|
172
249
|
"""
|
|
173
|
-
|
|
250
|
+
logger.info("Start loading the parameter broadcast for removing redundant parameters.")
|
|
251
|
+
from mindspore.runtime import synchronize
|
|
252
|
+
from mindspore.mint.distributed import all_gather_object
|
|
174
253
|
origin_parallel_mode = context.get_auto_parallel_context("parallel_mode")
|
|
175
254
|
origin_dataset_strategy = context.get_auto_parallel_context("dataset_strategy")
|
|
176
255
|
cur_rank = get_rank()
|
|
@@ -188,33 +267,20 @@ def _single_parameter_broadcast(net, layout, param_not_load=None):
|
|
|
188
267
|
return
|
|
189
268
|
net_param_dict = net.parameters_dict()
|
|
190
269
|
_chang_parallel_context(origin_dataset_strategy)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
270
|
+
param_loaded.add(cur_rank)
|
|
271
|
+
total_num = get_group_size()
|
|
272
|
+
total_param_loaded = [None] * total_num
|
|
273
|
+
synchronize()
|
|
274
|
+
all_gather_object(total_param_loaded, param_loaded)
|
|
275
|
+
total_param_loaded = _check_total_param_loaded(total_param_loaded)
|
|
276
|
+
group_map = _get_sorted_group_map()
|
|
194
277
|
for group, params in param_redundancy_reversed.items():
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if param not in net_param_dict:
|
|
199
|
-
continue
|
|
200
|
-
if param.startswith("accu_grads") or param.endswith("expert_load"):
|
|
201
|
-
continue
|
|
202
|
-
real_param = net_param_dict[param]
|
|
203
|
-
_remove_param_not_load(real_param.name, param_not_load)
|
|
204
|
-
if param not in single_params[cur_rank]:
|
|
205
|
-
real_param.set_data(Tensor(np.zeros(real_param.shape), dtype=real_param.dtype), real_param.sliced)
|
|
206
|
-
allreduce_input.append(real_param)
|
|
207
|
-
if not allreduce_input:
|
|
208
|
-
continue
|
|
209
|
-
if is_manual_communication_group:
|
|
210
|
-
create_group(group_name, list(group))
|
|
211
|
-
allreduce_input.sort(key=lambda param: (str(param.shape), str(param.dtype)))
|
|
212
|
-
communicator = SingleCommunicator(group_name)
|
|
213
|
-
for real_param in allreduce_input:
|
|
214
|
-
real_param.set_data(communicator(Tensor(real_param)), real_param.sliced)
|
|
215
|
-
if is_manual_communication_group:
|
|
216
|
-
destroy_group(group_name)
|
|
278
|
+
allreduce_input = _create_allreduce_input(params, group, net_param_dict, total_param_loaded, param_not_load,
|
|
279
|
+
cur_rank)
|
|
280
|
+
_communicate_allreduce(allreduce_input, group_map, group)
|
|
217
281
|
_restore_parallel_context(origin_parallel_mode, origin_dataset_strategy)
|
|
282
|
+
synchronize()
|
|
283
|
+
logger.info("End loading the parameter broadcast for removing redundant parameters.")
|
|
218
284
|
|
|
219
285
|
|
|
220
286
|
def _insert_virtual_pp_dim(layout):
|
|
@@ -259,20 +325,22 @@ class CommTensorDataForPP(Cell):
|
|
|
259
325
|
self._current_rank_has_data = self._current_rank_id in src_dtensor_info.layout.to_dict()["rank_list"]
|
|
260
326
|
self._diff_rank_id = [
|
|
261
327
|
rank_id for rank_id in dst_dtensor_info.layout.to_dict()["rank_list"] if rank_id not in self._from_rank_id]
|
|
262
|
-
self.
|
|
328
|
+
self._group, self._root_idx = self._create_all_reduce_group()
|
|
263
329
|
|
|
264
330
|
def comm_data(self, comm_data):
|
|
265
331
|
"""communicate data"""
|
|
266
|
-
|
|
267
|
-
|
|
332
|
+
from mindspore import mint
|
|
333
|
+
comm_handle = mint.distributed.broadcast(comm_data, self._root_idx, self._group, async_op=False)
|
|
334
|
+
return comm_handle
|
|
268
335
|
|
|
269
336
|
def _create_all_reduce_group(self):
|
|
270
337
|
"""create all reduce group"""
|
|
271
338
|
global ALLREDUCE_GROUP_LIST
|
|
272
339
|
current_rank_stage_id = self._current_rank_id // self._from_dev_num_in_stage
|
|
273
340
|
end_stage = self._from_dev_num_in_stage * (current_rank_stage_id + 1)
|
|
274
|
-
|
|
275
|
-
|
|
341
|
+
start_stage = self._from_dev_num_in_stage * current_rank_stage_id
|
|
342
|
+
rank_pos_in_stage = list(range(start_stage, end_stage)).index(self._current_rank_id)
|
|
343
|
+
root_idx = self._from_rank_id[rank_pos_in_stage]
|
|
276
344
|
all_reduce_rank_list = [self._from_rank_id[rank_pos_in_stage]]
|
|
277
345
|
while rank_pos_in_stage < len(self._diff_rank_id):
|
|
278
346
|
all_reduce_rank_list.append(self._diff_rank_id[rank_pos_in_stage])
|
|
@@ -281,11 +349,11 @@ class CommTensorDataForPP(Cell):
|
|
|
281
349
|
str_rank_list = '-'.join([str(rank) for rank in all_reduce_rank_list])
|
|
282
350
|
all_reduce_group = f"pp_allreduce_group-{str_rank_list}"
|
|
283
351
|
if all_reduce_group in ALLREDUCE_GROUP_LIST:
|
|
284
|
-
return all_reduce_group
|
|
352
|
+
return all_reduce_group, root_idx
|
|
285
353
|
ALLREDUCE_GROUP_LIST.append(all_reduce_group)
|
|
286
354
|
create_group(all_reduce_group, all_reduce_rank_list)
|
|
287
355
|
logger.debug(f"Create group {all_reduce_group} for tensor data communication.")
|
|
288
|
-
return all_reduce_group
|
|
356
|
+
return all_reduce_group, root_idx
|
|
289
357
|
|
|
290
358
|
|
|
291
359
|
class RedistributionCell(Cell):
|
|
@@ -144,8 +144,7 @@ def _build_protobuf_strategy(strategy_filename):
|
|
|
144
144
|
parallel_strategy_map = _load_protobuf_strategy(strategy_filename)
|
|
145
145
|
layout_items = parallel_strategy_map.parallel_layout_item
|
|
146
146
|
if not layout_items:
|
|
147
|
-
|
|
148
|
-
f"parameter, please check whether the 'strategy_filename' is correct.")
|
|
147
|
+
return {}
|
|
149
148
|
|
|
150
149
|
strategy = {}
|
|
151
150
|
for layout_item in layout_items:
|
|
@@ -159,6 +158,8 @@ def _build_json_strategy(strategy_filename):
|
|
|
159
158
|
"""build strategy from json file"""
|
|
160
159
|
with open(strategy_filename, 'r') as f:
|
|
161
160
|
json_content = json.load(f)
|
|
161
|
+
if "parallel_layout_item" not in json_content:
|
|
162
|
+
return {}
|
|
162
163
|
layout_items = json_content.get("parallel_layout_item")
|
|
163
164
|
strategy = {}
|
|
164
165
|
for parameter_name, layout_item in layout_items.items():
|
|
@@ -278,7 +279,7 @@ def _extract_pipeline_stage_num(strategy_file):
|
|
|
278
279
|
pipeline_stage_set.update(layout[6])
|
|
279
280
|
pipeline_stage_num = len(pipeline_stage_set)
|
|
280
281
|
if list(pipeline_stage_set) != list(range(pipeline_stage_num)):
|
|
281
|
-
raise ValueError("The strategy file for pipeline parallel
|
|
282
|
+
raise ValueError("The strategy file for pipeline parallel does not contains all stages.")
|
|
282
283
|
return pipeline_stage_num
|
|
283
284
|
|
|
284
285
|
|