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
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
# Copyright 2025-2026 Huawei Technologies Co., Ltd
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ============================================================================
|
|
15
|
+
"""Dynamic Profile config context"""
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from mindspore import log as logger
|
|
19
|
+
from mindspore.profiler.common.constant import (
|
|
20
|
+
ProfilerActivity,
|
|
21
|
+
ProfilerLevel,
|
|
22
|
+
AicoreMetrics,
|
|
23
|
+
ExportType,
|
|
24
|
+
HostSystem
|
|
25
|
+
)
|
|
26
|
+
from mindspore.profiler.dynamic_profile.dynamic_profiler_utils import DynamicProfilerUtils
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DynamicProfilerConfigContext:
|
|
30
|
+
"""
|
|
31
|
+
Data class for dynamic profile config context.
|
|
32
|
+
"""
|
|
33
|
+
BOOL_MAP = {'true': True, 'false': False}
|
|
34
|
+
|
|
35
|
+
def __init__(self, json_data):
|
|
36
|
+
self._start_step = -1
|
|
37
|
+
self._stop_step = -1
|
|
38
|
+
self._aic_metrics = "AiCoreNone"
|
|
39
|
+
self._profiler_level = "Level0"
|
|
40
|
+
self._analyse_mode = -1
|
|
41
|
+
self._activities = ["CPU", "NPU"]
|
|
42
|
+
self._export_type = ["text"]
|
|
43
|
+
self._profile_memory = False
|
|
44
|
+
self._mstx = False
|
|
45
|
+
self._parallel_strategy = False
|
|
46
|
+
self._with_stack = False
|
|
47
|
+
self._data_simplification = True
|
|
48
|
+
self._l2_cache = False
|
|
49
|
+
self._analyse = True
|
|
50
|
+
self._is_valid = False
|
|
51
|
+
self._record_shapes = False
|
|
52
|
+
self._prof_path = "./"
|
|
53
|
+
self._mstx_domain_include = []
|
|
54
|
+
self._mstx_domain_exclude = []
|
|
55
|
+
self._host_sys = []
|
|
56
|
+
self._sys_io = False
|
|
57
|
+
self._sys_interconnection = False
|
|
58
|
+
self._is_dyno = DynamicProfilerUtils.is_dyno_mode()
|
|
59
|
+
self._parse(json_data)
|
|
60
|
+
self._check_params_type()
|
|
61
|
+
self._json_dict = self.to_dict()
|
|
62
|
+
|
|
63
|
+
def _parse(self, json_data):
|
|
64
|
+
""" Parse the given JSON data and initialize the attributes of the class based on its content."""
|
|
65
|
+
self._parse_start_step(json_data)
|
|
66
|
+
self._parse_stop_step(json_data)
|
|
67
|
+
self._parse_profiler_level(json_data)
|
|
68
|
+
self._parse_activities(json_data)
|
|
69
|
+
self._parse_export_type(json_data)
|
|
70
|
+
self._parse_profiler_memory(json_data)
|
|
71
|
+
self._parse_mstx(json_data)
|
|
72
|
+
self._parse_with_stack(json_data)
|
|
73
|
+
self._parse_data_simplification(json_data)
|
|
74
|
+
self._parse_l2_cache(json_data)
|
|
75
|
+
self._parse_analyse(json_data)
|
|
76
|
+
self._parse_record_shapes(json_data)
|
|
77
|
+
self._parse_prof_path(json_data)
|
|
78
|
+
self._aic_metrics = json_data.get("aic_metrics", "AiCoreNone")
|
|
79
|
+
self._analyse_mode = json_data.get("analyse_mode", -1)
|
|
80
|
+
self._parse_mstx_domain_include(json_data)
|
|
81
|
+
self._parse_mstx_domain_exclude(json_data)
|
|
82
|
+
self._parse_host_sys(json_data)
|
|
83
|
+
self._parse_sys_io(json_data)
|
|
84
|
+
self._parse_sys_interconnection(json_data)
|
|
85
|
+
self._parallel_strategy = json_data.get("parallel_strategy", False)
|
|
86
|
+
self._is_valid = json_data.get("is_valid", False)
|
|
87
|
+
|
|
88
|
+
def _parse_start_step(self, json_data):
|
|
89
|
+
""" Parse the start_step from JSON data."""
|
|
90
|
+
if self._is_dyno:
|
|
91
|
+
try:
|
|
92
|
+
start_step = int(json_data.get("start_step", 0))
|
|
93
|
+
except ValueError:
|
|
94
|
+
start_step = 0
|
|
95
|
+
logger.warning("dyno config 'start-step' should be an integer, will be reset to default value: '0'.")
|
|
96
|
+
self._start_step = start_step
|
|
97
|
+
else:
|
|
98
|
+
self._start_step = json_data.get("start_step", -1)
|
|
99
|
+
|
|
100
|
+
def _parse_stop_step(self, json_data):
|
|
101
|
+
""" Parse the stop_step from JSON data."""
|
|
102
|
+
if self._is_dyno:
|
|
103
|
+
try:
|
|
104
|
+
start_step = int(json_data.get("start_step", 0))
|
|
105
|
+
except ValueError:
|
|
106
|
+
start_step = 0
|
|
107
|
+
logger.warning("dyno config 'start-step' should be an integer, will be reset to default value: '0'.")
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
iterations = int(json_data.get("iterations", 0))
|
|
111
|
+
except ValueError:
|
|
112
|
+
iterations = 0
|
|
113
|
+
logger.warning("dyno config 'iterations' should be an integer, will be reset to default value: '0'.")
|
|
114
|
+
|
|
115
|
+
self._stop_step = start_step + iterations - 1
|
|
116
|
+
else:
|
|
117
|
+
self._stop_step = json_data.get("stop_step", -1)
|
|
118
|
+
|
|
119
|
+
def _parse_profiler_level(self, json_data):
|
|
120
|
+
""" Parse the profiler_level from JSON data."""
|
|
121
|
+
if self._is_dyno:
|
|
122
|
+
profiler_level = json_data.get("profiler_level", "Level0")
|
|
123
|
+
if profiler_level == "Level_none":
|
|
124
|
+
profiler_level = "LevelNone"
|
|
125
|
+
self._profiler_level = profiler_level
|
|
126
|
+
else:
|
|
127
|
+
self._profiler_level = json_data.get("profiler_level", "Level0")
|
|
128
|
+
|
|
129
|
+
def _parse_activities(self, json_data):
|
|
130
|
+
""" Parse the activities from JSON data."""
|
|
131
|
+
if self._is_dyno:
|
|
132
|
+
activities = json_data.get("activities", "CPU, NPU")
|
|
133
|
+
activity_map = {
|
|
134
|
+
"CPU, NPU": ["CPU", "NPU"],
|
|
135
|
+
"NPU, CPU": ["CPU", "NPU"],
|
|
136
|
+
"CPU": ["CPU"],
|
|
137
|
+
"NPU": ["NPU"]
|
|
138
|
+
}
|
|
139
|
+
self._activities = activity_map.get(activities, ["CPU", "NPU"])
|
|
140
|
+
else:
|
|
141
|
+
self._activities = json_data.get("activities", ["CPU", "NPU"])
|
|
142
|
+
|
|
143
|
+
def _parse_export_type(self, json_data):
|
|
144
|
+
""" Parse the export_type from JSON data."""
|
|
145
|
+
if self._is_dyno:
|
|
146
|
+
export_type = json_data.get("export_type", "Text")
|
|
147
|
+
export_types_map = {
|
|
148
|
+
"Text": ["text"],
|
|
149
|
+
"Db": ["db"],
|
|
150
|
+
}
|
|
151
|
+
self._export_type = export_types_map.get(export_type, ["text"])
|
|
152
|
+
else:
|
|
153
|
+
self._export_type = json_data.get("export_type", ["text"])
|
|
154
|
+
|
|
155
|
+
def _parse_profiler_memory(self, json_data):
|
|
156
|
+
""" Parse the profiler_memory from JSON data."""
|
|
157
|
+
if self._is_dyno:
|
|
158
|
+
profile_memory = json_data.get("profile_memory", "")
|
|
159
|
+
self._profile_memory = self.BOOL_MAP.get(profile_memory.lower(), False)
|
|
160
|
+
else:
|
|
161
|
+
self._profile_memory = json_data.get("profile_memory", False)
|
|
162
|
+
|
|
163
|
+
def _parse_mstx(self, json_data):
|
|
164
|
+
""" Parse the mstx from JSON data."""
|
|
165
|
+
if self._is_dyno:
|
|
166
|
+
mstx = json_data.get("msprof_tx", "")
|
|
167
|
+
self._mstx = self.BOOL_MAP.get(mstx.lower(), False)
|
|
168
|
+
else:
|
|
169
|
+
self._mstx = json_data.get("mstx", False)
|
|
170
|
+
|
|
171
|
+
def _parse_with_stack(self, json_data):
|
|
172
|
+
""" Parse the with_stack from JSON data."""
|
|
173
|
+
if self._is_dyno:
|
|
174
|
+
with_stack = json_data.get("with_stack", "")
|
|
175
|
+
self._with_stack = self.BOOL_MAP.get(with_stack.lower(), False)
|
|
176
|
+
else:
|
|
177
|
+
self._with_stack = json_data.get("with_stack", False)
|
|
178
|
+
|
|
179
|
+
def _parse_data_simplification(self, json_data):
|
|
180
|
+
""" Parse the data_simplification from JSON data."""
|
|
181
|
+
if self._is_dyno:
|
|
182
|
+
data_simplification = json_data.get("data_simplification", "")
|
|
183
|
+
self._data_simplification = self.BOOL_MAP.get(data_simplification.lower(), False)
|
|
184
|
+
else:
|
|
185
|
+
self._data_simplification = json_data.get("data_simplification", True)
|
|
186
|
+
|
|
187
|
+
def _parse_l2_cache(self, json_data):
|
|
188
|
+
""" Parse the l2_cach from JSON data."""
|
|
189
|
+
if self._is_dyno:
|
|
190
|
+
l2_cache = json_data.get("l2_cache", "")
|
|
191
|
+
self._l2_cache = self.BOOL_MAP.get(l2_cache.lower(), False)
|
|
192
|
+
else:
|
|
193
|
+
self._l2_cache = json_data.get("l2_cache", False)
|
|
194
|
+
|
|
195
|
+
def _parse_analyse(self, json_data):
|
|
196
|
+
""" Parse the data_simplification from JSON data."""
|
|
197
|
+
if self._is_dyno:
|
|
198
|
+
analyse = json_data.get("analyse", "")
|
|
199
|
+
self._analyse = self.BOOL_MAP.get(analyse.lower(), False)
|
|
200
|
+
else:
|
|
201
|
+
self._analyse = json_data.get("analyse", False)
|
|
202
|
+
|
|
203
|
+
def _parse_record_shapes(self, json_data):
|
|
204
|
+
""" Parse the record_shapes from JSON data."""
|
|
205
|
+
if self._is_dyno:
|
|
206
|
+
record_shapes = json_data.get("record_shapes", "")
|
|
207
|
+
self._record_shapes = self.BOOL_MAP.get(record_shapes.lower(), False)
|
|
208
|
+
else:
|
|
209
|
+
self._record_shapes = json_data.get("record_shapes", False)
|
|
210
|
+
|
|
211
|
+
def _parse_prof_path(self, json_data):
|
|
212
|
+
""" Parse the prof_path from JSON data."""
|
|
213
|
+
if self._is_dyno:
|
|
214
|
+
prof_path = json_data.get("log_file", "./")
|
|
215
|
+
if not isinstance(prof_path, str):
|
|
216
|
+
logger.warning("The 'log-file' must be a string, "
|
|
217
|
+
"will be set to default: './'.")
|
|
218
|
+
prof_path = "./"
|
|
219
|
+
self._prof_path = prof_path
|
|
220
|
+
else:
|
|
221
|
+
self._prof_path = json_data.get("prof_path", "./")
|
|
222
|
+
|
|
223
|
+
def _parse_host_sys(self, json_data):
|
|
224
|
+
""" Parse the host_sys from JSON data."""
|
|
225
|
+
if self._is_dyno:
|
|
226
|
+
host_sys = json_data.get("host_sys", None)
|
|
227
|
+
self._host_sys = [] if host_sys is None or host_sys == "None" else \
|
|
228
|
+
[item.strip() for item in host_sys.split(',')]
|
|
229
|
+
else:
|
|
230
|
+
self._host_sys = json_data.get("host_sys", [])
|
|
231
|
+
|
|
232
|
+
def _parse_sys_io(self, json_data):
|
|
233
|
+
""" Parse the sys_io from JSON data."""
|
|
234
|
+
if self._is_dyno:
|
|
235
|
+
sys_io = json_data.get("sys_io", False)
|
|
236
|
+
if isinstance(sys_io, str):
|
|
237
|
+
self._sys_io = self.BOOL_MAP.get(sys_io.lower(), False)
|
|
238
|
+
else:
|
|
239
|
+
self._sys_io = False
|
|
240
|
+
else:
|
|
241
|
+
self._sys_io = json_data.get("sys_io", False)
|
|
242
|
+
|
|
243
|
+
def _parse_sys_interconnection(self, json_data):
|
|
244
|
+
""" Parse the sys_interconnection from JSON data."""
|
|
245
|
+
if self._is_dyno:
|
|
246
|
+
sys_interconnection = json_data.get("sys_interconnection", False)
|
|
247
|
+
if isinstance(sys_interconnection, str):
|
|
248
|
+
self._sys_interconnection = self.BOOL_MAP.get(sys_interconnection.lower(), False)
|
|
249
|
+
else:
|
|
250
|
+
self._sys_interconnection = False
|
|
251
|
+
else:
|
|
252
|
+
self._sys_interconnection = json_data.get("sys_interconnection", False)
|
|
253
|
+
|
|
254
|
+
def _parse_mstx_domain_include(self, json_data):
|
|
255
|
+
""" Parse the mstx_domain_include from JSON data."""
|
|
256
|
+
if self._is_dyno:
|
|
257
|
+
mstx_domain_include = json_data.get("mstx_domain_include", None)
|
|
258
|
+
self._mstx_domain_include = [] if mstx_domain_include is None or mstx_domain_include == "None" else \
|
|
259
|
+
[item.strip() for item in mstx_domain_include.split(',')]
|
|
260
|
+
else:
|
|
261
|
+
self._mstx_domain_include = json_data.get("mstx_domain_include", [])
|
|
262
|
+
|
|
263
|
+
def _parse_mstx_domain_exclude(self, json_data):
|
|
264
|
+
""" Parse the mstx_domain_exclude from JSON data."""
|
|
265
|
+
if self._is_dyno:
|
|
266
|
+
mstx_domain_exclude = json_data.get("mstx_domain_exclude", None)
|
|
267
|
+
self._mstx_domain_exclude = [] if mstx_domain_exclude is None or mstx_domain_exclude == "None" else \
|
|
268
|
+
[item.strip() for item in mstx_domain_exclude.split(',')]
|
|
269
|
+
else:
|
|
270
|
+
self._mstx_domain_exclude = json_data.get("mstx_domain_exclude", [])
|
|
271
|
+
|
|
272
|
+
def _check_params_type(self):
|
|
273
|
+
""" Check and enforce parameter types with lower complexity."""
|
|
274
|
+
# Check non-special parameters. {Parameter name: (expected type, default value)}
|
|
275
|
+
self._check_non_special_params()
|
|
276
|
+
# Check special parameters
|
|
277
|
+
self._check_special_params()
|
|
278
|
+
|
|
279
|
+
def _check_non_special_params(self):
|
|
280
|
+
""" Check non-special parameters."""
|
|
281
|
+
param_rules = {
|
|
282
|
+
'_start_step': (int, -1),
|
|
283
|
+
'_stop_step': (int, -1),
|
|
284
|
+
'_analyse_mode': (int, -1),
|
|
285
|
+
'_profile_memory': (bool, False),
|
|
286
|
+
'_mstx': (bool, False),
|
|
287
|
+
'_l2_cache': (bool, False),
|
|
288
|
+
'_analyse': (bool, False),
|
|
289
|
+
'_parallel_strategy': (bool, False),
|
|
290
|
+
'_with_stack': (bool, False),
|
|
291
|
+
'_data_simplification': (bool, True),
|
|
292
|
+
'_record_shapes': (bool, False),
|
|
293
|
+
'_mstx_domain_include': (list, []),
|
|
294
|
+
'_mstx_domain_exclude': (list, []),
|
|
295
|
+
'_host_sys': (list, []),
|
|
296
|
+
'_sys_io': (bool, False),
|
|
297
|
+
'_sys_interconnection': (bool, False)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
def _is_valid_type(value, expected_type):
|
|
301
|
+
""" Helper method for type checking."""
|
|
302
|
+
if expected_type is int and isinstance(value, bool):
|
|
303
|
+
return False
|
|
304
|
+
return isinstance(value, expected_type)
|
|
305
|
+
|
|
306
|
+
for param, (expected_type, default) in param_rules.items():
|
|
307
|
+
value = getattr(self, param)
|
|
308
|
+
if not _is_valid_type(value, expected_type):
|
|
309
|
+
logger.warning(
|
|
310
|
+
f"'{param[1:]}' should be {expected_type.__name__}, "
|
|
311
|
+
f"but got {type(value).__name__}. "
|
|
312
|
+
f"will be reset to default value: '{default}'."
|
|
313
|
+
)
|
|
314
|
+
setattr(self, param, default)
|
|
315
|
+
|
|
316
|
+
def _check_special_params(self):
|
|
317
|
+
""" Check special parameters."""
|
|
318
|
+
self._check_aic_metrics()
|
|
319
|
+
self._check_profiler_level()
|
|
320
|
+
self._check_activities()
|
|
321
|
+
self._check_export_type()
|
|
322
|
+
self._check_prof_path()
|
|
323
|
+
|
|
324
|
+
def _check_aic_metrics(self):
|
|
325
|
+
""" Check aic_metrics."""
|
|
326
|
+
if not (isinstance(self._aic_metrics, str) or (
|
|
327
|
+
isinstance(self._aic_metrics, int) and not isinstance(self._aic_metrics, bool))):
|
|
328
|
+
logger.warning(
|
|
329
|
+
f"'aic_metrics' should be a string or a non-bool integer, "
|
|
330
|
+
f"but got {type(self._aic_metrics).__name__}. "
|
|
331
|
+
f"Will be reset to default value: 'AiCoreNone'."
|
|
332
|
+
)
|
|
333
|
+
self._aic_metrics = AicoreMetrics.AiCoreNone.value
|
|
334
|
+
|
|
335
|
+
def _check_profiler_level(self):
|
|
336
|
+
""" Check profiler_level."""
|
|
337
|
+
if not (isinstance(self._profiler_level, str) or (
|
|
338
|
+
isinstance(self._profiler_level, int) and not isinstance(self._profiler_level, bool))):
|
|
339
|
+
logger.warning(
|
|
340
|
+
f"'profiler_level' should be a string or a non-bool integer, "
|
|
341
|
+
f"but got {type(self._profiler_level).__name__}. "
|
|
342
|
+
f"Will be reset to default value: 'Level0'."
|
|
343
|
+
)
|
|
344
|
+
self._profiler_level = ProfilerLevel.Level0.value
|
|
345
|
+
|
|
346
|
+
def _check_activities(self):
|
|
347
|
+
""" Check activities."""
|
|
348
|
+
if not (isinstance(self._activities, list) or (
|
|
349
|
+
isinstance(self._activities, int) and not isinstance(self._activities, bool))):
|
|
350
|
+
logger.warning(
|
|
351
|
+
f"'activities' should be a list or a non-bool integer, "
|
|
352
|
+
f"but got {type(self._activities).__name__}. "
|
|
353
|
+
f"Will be reset to default value: '[ProfilerActivity.CPU, ProfilerActivity.NPU]'."
|
|
354
|
+
)
|
|
355
|
+
self._activities = [ProfilerActivity.CPU.value, ProfilerActivity.NPU.value]
|
|
356
|
+
|
|
357
|
+
def _check_export_type(self):
|
|
358
|
+
""" Check export_type."""
|
|
359
|
+
if not (isinstance(self._export_type, list) or (
|
|
360
|
+
isinstance(self._export_type, int) and not isinstance(self._export_type, bool))):
|
|
361
|
+
logger.warning(
|
|
362
|
+
f"'export_type' should be a list or a non-bool integer, "
|
|
363
|
+
f"but got {type(self._export_type).__name__}. "
|
|
364
|
+
f"Will be reset to default value: '[ExportType.Text]'."
|
|
365
|
+
)
|
|
366
|
+
self._export_type = [ExportType.Text.value]
|
|
367
|
+
|
|
368
|
+
def _check_prof_path(self):
|
|
369
|
+
""" Check prof_path."""
|
|
370
|
+
if not isinstance(self._prof_path, str):
|
|
371
|
+
logger.warning(f"'prof_path' should be str, but got {type(self._prof_path).__name__}. ")
|
|
372
|
+
self._prof_path = "./"
|
|
373
|
+
|
|
374
|
+
@property
|
|
375
|
+
def start_step(self):
|
|
376
|
+
""" Get start step value."""
|
|
377
|
+
return self._start_step
|
|
378
|
+
|
|
379
|
+
@property
|
|
380
|
+
def stop_step(self):
|
|
381
|
+
""" Get stop step value."""
|
|
382
|
+
return self._stop_step
|
|
383
|
+
|
|
384
|
+
@property
|
|
385
|
+
def is_valid(self):
|
|
386
|
+
""" Get json valid value."""
|
|
387
|
+
return self._is_valid
|
|
388
|
+
|
|
389
|
+
@is_valid.setter
|
|
390
|
+
def is_valid(self, value):
|
|
391
|
+
""" Set json valid value."""
|
|
392
|
+
self._is_valid = value
|
|
393
|
+
|
|
394
|
+
@property
|
|
395
|
+
def analyse_mode(self):
|
|
396
|
+
""" Get analyse mode value."""
|
|
397
|
+
return self._convert_analyse_mode(self._analyse_mode)
|
|
398
|
+
|
|
399
|
+
@property
|
|
400
|
+
def prof_path(self):
|
|
401
|
+
""" Get analyse mode value."""
|
|
402
|
+
return self._prof_path
|
|
403
|
+
|
|
404
|
+
@property
|
|
405
|
+
def analyse(self):
|
|
406
|
+
""" Get analyse mode value."""
|
|
407
|
+
return self._analyse
|
|
408
|
+
|
|
409
|
+
@property
|
|
410
|
+
def vars(self):
|
|
411
|
+
""" Get all values in DynamicProfilerConfigContext."""
|
|
412
|
+
not_supported_args = ['_is_valid']
|
|
413
|
+
res = {}
|
|
414
|
+
for key, value in self.__dict__.items():
|
|
415
|
+
if key in ['_json_dict', '_is_dyno']:
|
|
416
|
+
continue
|
|
417
|
+
if key not in not_supported_args:
|
|
418
|
+
res[key.replace('_', '', 1)] = value
|
|
419
|
+
return res
|
|
420
|
+
|
|
421
|
+
@property
|
|
422
|
+
def args(self):
|
|
423
|
+
""" Get all args in DynamicProfilerConfigContext."""
|
|
424
|
+
self._profiler_level = self._convert_profiler_level(self._profiler_level)
|
|
425
|
+
self._activities = self._convert_activities(self._activities)
|
|
426
|
+
self._aic_metrics = self._convert_aic_metrics(self._aic_metrics)
|
|
427
|
+
self._export_type = self._convert_export_type(self._export_type)
|
|
428
|
+
self._host_sys = self._convert_host_sys(self._host_sys)
|
|
429
|
+
not_supported_args = ['_start_step', '_stop_step', '_analyse_mode', '_is_valid']
|
|
430
|
+
res = {}
|
|
431
|
+
for key, value in self.__dict__.items():
|
|
432
|
+
if key not in not_supported_args:
|
|
433
|
+
res[key.replace('_', '', 1)] = value
|
|
434
|
+
return res
|
|
435
|
+
|
|
436
|
+
def to_dict(self):
|
|
437
|
+
"""Convert the instance attributes to a dictionary."""
|
|
438
|
+
return {
|
|
439
|
+
"start_step": self._start_step,
|
|
440
|
+
"stop_step": self._stop_step,
|
|
441
|
+
"aic_metrics": self._aic_metrics,
|
|
442
|
+
"profiler_level": self._profiler_level,
|
|
443
|
+
"analyse_mode": self._analyse_mode,
|
|
444
|
+
"activities": self._activities,
|
|
445
|
+
"export_type": self._export_type,
|
|
446
|
+
"profile_memory": self._profile_memory,
|
|
447
|
+
"mstx": self._mstx,
|
|
448
|
+
"parallel_strategy": self._parallel_strategy,
|
|
449
|
+
"with_stack": self._with_stack,
|
|
450
|
+
"data_simplification": self._data_simplification,
|
|
451
|
+
"l2_cache": self._l2_cache,
|
|
452
|
+
"analyse": self._analyse,
|
|
453
|
+
"record_shapes": self._record_shapes,
|
|
454
|
+
"prof_path": self._prof_path,
|
|
455
|
+
"mstx_domain_include": self._mstx_domain_include,
|
|
456
|
+
"mstx_domain_exclude": self._mstx_domain_exclude,
|
|
457
|
+
"sys_io": self._sys_io,
|
|
458
|
+
"sys_interconnection": self._sys_interconnection,
|
|
459
|
+
"host_sys": self._host_sys,
|
|
460
|
+
"is_valid": self._is_valid
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
def to_bytes(self) -> bytes:
|
|
464
|
+
""" Convert dynamic profiler config context to a byte sequence."""
|
|
465
|
+
return self.json_to_bytes(self._json_dict)
|
|
466
|
+
|
|
467
|
+
@staticmethod
|
|
468
|
+
def json_to_bytes(json_data):
|
|
469
|
+
""" Convert a json to a byte sequence."""
|
|
470
|
+
cfg_json_str = json.dumps(json_data)
|
|
471
|
+
# Encode the JSON string as a byte sequence (using UTF-8 encoding)
|
|
472
|
+
return cfg_json_str.encode("utf-8")
|
|
473
|
+
|
|
474
|
+
@staticmethod
|
|
475
|
+
def bytes_to_json(bytes_shm):
|
|
476
|
+
""" Convert a byte sequence to a json."""
|
|
477
|
+
try:
|
|
478
|
+
json_string = bytes_shm.decode("utf-8")
|
|
479
|
+
json_data = json.loads(json_string)
|
|
480
|
+
except UnicodeDecodeError:
|
|
481
|
+
logger.error("Failed to parse dynamic profiler config JSON string.")
|
|
482
|
+
return {}
|
|
483
|
+
|
|
484
|
+
return json_data
|
|
485
|
+
|
|
486
|
+
@staticmethod
|
|
487
|
+
def _convert_analyse_mode(analyse_mode: int):
|
|
488
|
+
"""Convert analyse_mode to real args in Profiler."""
|
|
489
|
+
mode_map = {
|
|
490
|
+
0: 'sync',
|
|
491
|
+
1: 'async',
|
|
492
|
+
-1: None
|
|
493
|
+
}
|
|
494
|
+
if analyse_mode in mode_map:
|
|
495
|
+
return mode_map[analyse_mode]
|
|
496
|
+
logger.warning(f"'analyse_mode' needs to be set to one of '-1, 0, and 1', but got '{analyse_mode}', "
|
|
497
|
+
f"will be reset to default: 'None'.")
|
|
498
|
+
return None
|
|
499
|
+
|
|
500
|
+
def _convert_profiler_level(self, profiler_level):
|
|
501
|
+
""" Convert profiler_level to real args in Profiler."""
|
|
502
|
+
# Convert int profiler_level
|
|
503
|
+
if isinstance(profiler_level, int):
|
|
504
|
+
logger.warning(f"The parameter 'profiler_level={profiler_level}' does not support passing in the "
|
|
505
|
+
f"int type in future versions. Please use the str type instead.")
|
|
506
|
+
return self._convert_int_profiler_level(profiler_level)
|
|
507
|
+
|
|
508
|
+
try:
|
|
509
|
+
profiler_level = ProfilerLevel(profiler_level)
|
|
510
|
+
except ValueError:
|
|
511
|
+
logger.warning(
|
|
512
|
+
f"'{profiler_level}' is not a valid profiler_level, "
|
|
513
|
+
f"will be reset to will be reset to default: 'Level0'."
|
|
514
|
+
)
|
|
515
|
+
return ProfilerLevel.Level0
|
|
516
|
+
|
|
517
|
+
return profiler_level
|
|
518
|
+
|
|
519
|
+
@staticmethod
|
|
520
|
+
def _convert_int_profiler_level(profiler_level):
|
|
521
|
+
""" Convert int profiler_level to real args in Profiler."""
|
|
522
|
+
if profiler_level == -1:
|
|
523
|
+
return ProfilerLevel.LevelNone
|
|
524
|
+
if profiler_level == 0:
|
|
525
|
+
return ProfilerLevel.Level0
|
|
526
|
+
if profiler_level == 1:
|
|
527
|
+
return ProfilerLevel.Level1
|
|
528
|
+
if profiler_level == 2:
|
|
529
|
+
return ProfilerLevel.Level2
|
|
530
|
+
|
|
531
|
+
logger.warning(f"'profiler_level' needs to be set to one of '-1, 0, 1 and 2', but got '{profiler_level}',"
|
|
532
|
+
f"will be reset to default: '{ProfilerLevel.Level0}'.")
|
|
533
|
+
return ProfilerLevel.Level0
|
|
534
|
+
|
|
535
|
+
def _convert_activities(self, activities):
|
|
536
|
+
""" Convert activities to real args in Profiler."""
|
|
537
|
+
# Convert int activities
|
|
538
|
+
if isinstance(activities, int):
|
|
539
|
+
logger.warning(f"The parameter 'activities={activities}' does not support passing in the int type in "
|
|
540
|
+
f"future versions. Please use the list type instead.")
|
|
541
|
+
return self._convert_int_activities(activities)
|
|
542
|
+
|
|
543
|
+
converted_activities = []
|
|
544
|
+
|
|
545
|
+
for activity in activities:
|
|
546
|
+
try:
|
|
547
|
+
converted_activity = ProfilerActivity(activity)
|
|
548
|
+
converted_activities.append(converted_activity)
|
|
549
|
+
except ValueError:
|
|
550
|
+
logger.warning(f"'{activity}' is not a valid ProfilerActivity member. "
|
|
551
|
+
f"will be reset to default: '{[ProfilerActivity.CPU, ProfilerActivity.NPU]}'.")
|
|
552
|
+
return [ProfilerActivity.CPU, ProfilerActivity.NPU]
|
|
553
|
+
|
|
554
|
+
return converted_activities
|
|
555
|
+
|
|
556
|
+
@staticmethod
|
|
557
|
+
def _convert_int_activities(activities):
|
|
558
|
+
""" Convert int activities to real args in Profiler."""
|
|
559
|
+
if activities == 0:
|
|
560
|
+
return [ProfilerActivity.CPU, ProfilerActivity.NPU]
|
|
561
|
+
if activities == 1:
|
|
562
|
+
return [ProfilerActivity.CPU]
|
|
563
|
+
if activities == 2:
|
|
564
|
+
return [ProfilerActivity.NPU]
|
|
565
|
+
|
|
566
|
+
logger.warning(f"'activities' needs to be set to one of '0, 1 and 2', but got '{activities}',"
|
|
567
|
+
f"will be reset to default: '{[ProfilerActivity.CPU, ProfilerActivity.NPU]}'.")
|
|
568
|
+
return [ProfilerActivity.CPU, ProfilerActivity.NPU]
|
|
569
|
+
|
|
570
|
+
def _convert_aic_metrics(self, aic_metrics):
|
|
571
|
+
""" Convert aic_metrics to real args in Profiler."""
|
|
572
|
+
# Convert int aic_metrics
|
|
573
|
+
if isinstance(aic_metrics, int):
|
|
574
|
+
logger.warning(f"The parameter 'aic_metrics={aic_metrics}' does not support passing in the int type in "
|
|
575
|
+
f"future versions. Please use the str type instead.")
|
|
576
|
+
return self._convert_int_aic_metrics(aic_metrics)
|
|
577
|
+
|
|
578
|
+
# Special handling of the AiCoreNone scene
|
|
579
|
+
if aic_metrics == "AiCoreNone":
|
|
580
|
+
return AicoreMetrics.AiCoreNone
|
|
581
|
+
|
|
582
|
+
try:
|
|
583
|
+
aic_metrics = AicoreMetrics(aic_metrics)
|
|
584
|
+
except ValueError:
|
|
585
|
+
logger.warning(
|
|
586
|
+
f"'{aic_metrics}' is not a valid aic_metrics, "
|
|
587
|
+
f"will be reset to will be reset to default: 'AiCoreNone'."
|
|
588
|
+
)
|
|
589
|
+
return AicoreMetrics.AiCoreNone
|
|
590
|
+
|
|
591
|
+
return aic_metrics
|
|
592
|
+
|
|
593
|
+
@staticmethod
|
|
594
|
+
def _convert_int_aic_metrics(aic_metrics):
|
|
595
|
+
""" Convert int aic_metrics to real args in Profiler."""
|
|
596
|
+
if aic_metrics == 0:
|
|
597
|
+
return AicoreMetrics.PipeUtilization
|
|
598
|
+
if aic_metrics == 1:
|
|
599
|
+
return AicoreMetrics.ArithmeticUtilization
|
|
600
|
+
if aic_metrics == 2:
|
|
601
|
+
return AicoreMetrics.Memory
|
|
602
|
+
if aic_metrics == 3:
|
|
603
|
+
return AicoreMetrics.MemoryL0
|
|
604
|
+
if aic_metrics == 4:
|
|
605
|
+
return AicoreMetrics.MemoryUB
|
|
606
|
+
if aic_metrics == 5:
|
|
607
|
+
return AicoreMetrics.ResourceConflictRatio
|
|
608
|
+
if aic_metrics == 6:
|
|
609
|
+
return AicoreMetrics.L2Cache
|
|
610
|
+
if aic_metrics == 7:
|
|
611
|
+
return AicoreMetrics.MemoryAccess
|
|
612
|
+
|
|
613
|
+
logger.warning(f"'aic_metrics' needs to be set to one of '0, 1, 2, 3, 4, 5, 6, and 7',"
|
|
614
|
+
f"but got '{aic_metrics}', will be reset to default: '{AicoreMetrics.AiCoreNone}'.")
|
|
615
|
+
return AicoreMetrics.AiCoreNone
|
|
616
|
+
|
|
617
|
+
def _convert_export_type(self, export_types):
|
|
618
|
+
""" Convert export_type to real args in Profiler."""
|
|
619
|
+
# Convert int export_type
|
|
620
|
+
if isinstance(export_types, int):
|
|
621
|
+
logger.warning(f"The parameter 'export_type={export_types}' does not support passing in the int type "
|
|
622
|
+
f"in future versions. Please use the list type instead.")
|
|
623
|
+
return self._convert_int_export_type(export_types)
|
|
624
|
+
|
|
625
|
+
converted_export_types = []
|
|
626
|
+
|
|
627
|
+
for export_type in export_types:
|
|
628
|
+
try:
|
|
629
|
+
converted_export_type = ExportType(export_type)
|
|
630
|
+
converted_export_types.append(converted_export_type)
|
|
631
|
+
except ValueError:
|
|
632
|
+
logger.warning(f"'{export_type}' is not a valid ExportType member. "
|
|
633
|
+
f"will be reset to default: '{[ExportType.Text]}'.")
|
|
634
|
+
return [ExportType.Text]
|
|
635
|
+
|
|
636
|
+
return converted_export_types
|
|
637
|
+
|
|
638
|
+
@staticmethod
|
|
639
|
+
def _convert_int_export_type(export_types):
|
|
640
|
+
""" Convert int export_type to real args in Profiler."""
|
|
641
|
+
if export_types == 1:
|
|
642
|
+
return [ExportType.Db]
|
|
643
|
+
if export_types == 2:
|
|
644
|
+
return [ExportType.Text, ExportType.Db]
|
|
645
|
+
|
|
646
|
+
logger.warning(f"'export_types' needs to be set to one of '1 and 2', but got '{export_types}', "
|
|
647
|
+
f"will be reset to default: '{[ExportType.Text]}'.")
|
|
648
|
+
return [ExportType.Text]
|
|
649
|
+
|
|
650
|
+
@staticmethod
|
|
651
|
+
def _convert_host_sys(host_systems):
|
|
652
|
+
""" Convert host_sys to real args in Profiler."""
|
|
653
|
+
if not host_systems:
|
|
654
|
+
return None
|
|
655
|
+
|
|
656
|
+
converted_host_systems = []
|
|
657
|
+
for host_system in host_systems:
|
|
658
|
+
try:
|
|
659
|
+
converted_host_sys = HostSystem(host_system)
|
|
660
|
+
converted_host_systems.append(converted_host_sys)
|
|
661
|
+
except ValueError:
|
|
662
|
+
logger.warning(f"'{host_system}' is not a valid HostSystem member. "
|
|
663
|
+
f"will be reset to default: 'None'.")
|
|
664
|
+
return None
|
|
665
|
+
|
|
666
|
+
return converted_host_systems
|