mindspore 2.3.0__cp39-none-any.whl → 2.3.0rc2__cp39-none-any.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/Third_Party_Open_Source_Software_Notice +0 -1512
- mindspore/__init__.py +1 -2
- mindspore/_c_dataengine.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_c_expression.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_c_mindrecord.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_checkparam.py +25 -5
- mindspore/_extends/graph_kernel/model/graph_parallel.py +1 -1
- mindspore/_extends/parse/__init__.py +2 -2
- mindspore/_extends/parse/compile_config.py +0 -29
- mindspore/_extends/parse/namespace.py +2 -2
- mindspore/_extends/parse/parser.py +5 -21
- mindspore/_extends/parse/resources.py +7 -5
- mindspore/_extends/parse/standard_method.py +59 -40
- mindspore/_mindspore_offline_debug.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/amp.py +5 -26
- mindspore/bin/cache_admin +0 -0
- mindspore/bin/cache_server +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/base.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +1 -1
- mindspore/boost/grad_freeze.py +2 -2
- mindspore/boost/less_batch_normalization.py +6 -9
- mindspore/common/__init__.py +1 -8
- mindspore/common/_register_for_tensor.py +9 -8
- mindspore/common/api.py +65 -275
- mindspore/common/dtype.py +4 -8
- mindspore/common/dump.py +5 -2
- mindspore/common/jit_config.py +1 -1
- mindspore/common/lazy_inline.py +2 -14
- mindspore/common/parameter.py +15 -14
- mindspore/common/recompute.py +5 -20
- mindspore/common/sparse_tensor.py +6 -21
- mindspore/common/tensor.py +52 -100
- mindspore/communication/__init__.py +11 -6
- mindspore/communication/management.py +94 -92
- mindspore/context.py +18 -180
- mindspore/dataset/engine/datasets.py +46 -69
- mindspore/dataset/engine/datasets_user_defined.py +53 -72
- mindspore/dataset/engine/datasets_vision.py +2 -2
- mindspore/dataset/engine/queue.py +38 -56
- mindspore/dataset/engine/validators.py +5 -11
- mindspore/dataset/vision/__init__.py +5 -5
- mindspore/dataset/vision/c_transforms.py +5 -5
- mindspore/dataset/vision/py_transforms_util.py +1 -1
- mindspore/dataset/vision/transforms.py +46 -591
- mindspore/dataset/vision/utils.py +1 -121
- mindspore/dataset/vision/validators.py +3 -9
- mindspore/hal/__init__.py +1 -7
- mindspore/hal/device.py +1 -1
- mindspore/include/api/model.h +0 -3
- mindspore/include/dataset/vision.h +2 -54
- mindspore/include/mindapi/base/types.h +0 -1
- mindspore/lib/libdnnl.so.2 +0 -0
- mindspore/lib/libmindspore.so +0 -0
- mindspore/lib/libmindspore_backend.so +0 -0
- mindspore/lib/libmindspore_common.so +0 -0
- mindspore/lib/libmindspore_core.so +0 -0
- mindspore/lib/libmindspore_glog.so.0 +0 -0
- mindspore/lib/libmindspore_gpr.so.15 +0 -0
- mindspore/lib/libmindspore_grpc++.so.1 +0 -0
- mindspore/lib/libmindspore_grpc.so.15 +0 -0
- mindspore/lib/libmindspore_shared_lib.so +0 -0
- mindspore/lib/libmpi_adapter.so +0 -0
- mindspore/lib/libmpi_collective.so +0 -0
- mindspore/lib/libnnacl.so +0 -0
- mindspore/lib/libopencv_core.so.4.5 +0 -0
- mindspore/lib/libps_cache.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +0 -35
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/vector_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +0 -72
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/{aclnn_all_finite.h → aclnn_add_custom.h} +11 -9
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_decoder_kv_cache.h +1 -1
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_prompt_kv_cache.h +1 -1
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/lib/libcust_opapi.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +12 -184
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json +15 -7
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json +15 -7
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.cpp +81 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.py +134 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/decoder_kv_cache.py +31 -77
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/prompt_kv_cache.py +31 -77
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64/libcust_opmaster_rt2.0.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/inc/op_proto.h +5 -4
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/lib/linux/aarch64/libcust_opsproto_rt2.0.so +0 -0
- mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
- mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
- mindspore/lib/plugin/ascend/libhccl_plugin.so +0 -0
- mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
- mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/DeviceBin +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/PkgInspect +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/op_man +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +286 -275
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_cann_host.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_host.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops_static.a +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/add_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/backend_param.h +0 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/cast/cast_tiling.h +45 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/compare_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_impl.h +4 -8
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_tiling.h +4 -11
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/kernel/flash_attention_score_mix_hwsync.h +0 -18
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_kernel.h +0 -6
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_rtbackend.h +75 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/kernel/matmul.h +5 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +3 -18
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_common_tiling.h +5 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_info.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_data.h +3 -36
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/kernel/matmul_stridedslice_fusion.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +4 -22
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +2 -16
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +3 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_impl.h +4 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +4 -9
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/attention_param.h +2 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_qkv_param.h +4 -10
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +12 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +1 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/backend.h +2 -10
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/elewise_utils.h +1 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +0 -17
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/math.h +7 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layernorm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_stridedslice_fusion_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libnot_equal_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblcal.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
- mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
- mindspore/mindrecord/filewriter.py +2 -2
- mindspore/mint/__init__.py +40 -720
- mindspore/mint/nn/__init__.py +7 -89
- mindspore/mint/nn/functional.py +16 -165
- mindspore/mint/optim/adamw.py +16 -15
- mindspore/nn/__init__.py +2 -0
- mindspore/nn/cell.py +98 -97
- mindspore/nn/extend/basic.py +2 -2
- mindspore/nn/extend/embedding.py +1 -1
- mindspore/nn/extend/layer/normalization.py +5 -7
- mindspore/nn/generator.py +297 -0
- mindspore/nn/layer/activation.py +3 -4
- mindspore/nn/layer/basic.py +16 -79
- mindspore/nn/layer/conv.py +8 -17
- mindspore/nn/layer/embedding.py +4 -1
- mindspore/nn/layer/math.py +1 -1
- mindspore/nn/layer/normalization.py +1 -1
- mindspore/nn/layer/pooling.py +0 -5
- mindspore/nn/layer/rnn_cells.py +2 -2
- mindspore/nn/loss/loss.py +19 -19
- mindspore/nn/optim/adasum.py +1 -1
- mindspore/nn/optim/sgd.py +2 -3
- mindspore/nn/probability/distribution/exponential.py +1 -1
- mindspore/nn/probability/distribution/geometric.py +1 -1
- mindspore/nn/probability/distribution/logistic.py +1 -1
- mindspore/nn/wrap/cell_wrapper.py +1 -25
- mindspore/nn/wrap/loss_scale.py +1 -24
- mindspore/numpy/array_ops.py +1 -5
- mindspore/numpy/dtypes.py +3 -3
- mindspore/numpy/math_ops.py +8 -8
- mindspore/ops/__init__.py +1 -1
- mindspore/ops/_grad_experimental/grad_comm_ops.py +16 -75
- mindspore/ops/_vmap/vmap_array_ops.py +0 -27
- mindspore/ops/_vmap/vmap_math_ops.py +1 -29
- mindspore/ops/_vmap/vmap_nn_ops.py +18 -19
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +8 -34
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +9 -2
- mindspore/ops/auto_generate/gen_arg_handler.py +0 -26
- mindspore/ops/auto_generate/gen_extend_func.py +27 -603
- mindspore/ops/auto_generate/gen_ops_def.py +203 -993
- mindspore/ops/auto_generate/gen_ops_prim.py +402 -1946
- mindspore/ops/auto_generate/pyboost_inner_prim.py +20 -90
- mindspore/ops/composite/base.py +6 -3
- mindspore/ops/composite/math_ops.py +1 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +17 -24
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/extend/__init__.py +3 -2
- mindspore/ops/extend/array_func.py +51 -10
- mindspore/ops/extend/nn_func.py +78 -2
- mindspore/ops/function/__init__.py +13 -8
- mindspore/ops/function/array_func.py +179 -455
- mindspore/ops/function/clip_func.py +1 -1
- mindspore/ops/function/grad/grad_func.py +3 -3
- mindspore/ops/function/math_func.py +103 -117
- mindspore/ops/function/nn_func.py +163 -275
- mindspore/ops/function/other_func.py +2 -2
- mindspore/ops/function/random_func.py +69 -202
- mindspore/ops/function/sparse_func.py +4 -4
- mindspore/ops/functional.py +327 -332
- mindspore/ops/operations/__init__.py +3 -13
- mindspore/ops/operations/_grad_ops.py +27 -3
- mindspore/ops/operations/_inner_ops.py +356 -53
- mindspore/ops/operations/_rl_inner_ops.py +2 -2
- mindspore/ops/operations/_tensor_array.py +8 -8
- mindspore/ops/operations/array_ops.py +65 -82
- mindspore/ops/operations/comm_ops.py +93 -784
- mindspore/ops/operations/custom_ops.py +28 -51
- mindspore/ops/operations/debug_ops.py +4 -4
- mindspore/ops/operations/inner_ops.py +2 -2
- mindspore/ops/operations/manually_defined/ops_def.py +4 -304
- mindspore/ops/operations/math_ops.py +50 -3
- mindspore/ops/operations/nn_ops.py +247 -14
- mindspore/ops/operations/other_ops.py +3 -3
- mindspore/ops/operations/random_ops.py +1 -1
- mindspore/ops/operations/sparse_ops.py +1 -1
- mindspore/ops/primitive.py +8 -9
- mindspore/ops/silent_check.py +5 -5
- mindspore/ops_generate/arg_dtype_cast.py +9 -2
- mindspore/ops_generate/arg_handler.py +0 -26
- mindspore/ops_generate/gen_aclnn_implement.py +4 -1
- mindspore/ops_generate/gen_ops.py +4 -26
- mindspore/ops_generate/gen_pyboost_func.py +12 -41
- mindspore/ops_generate/gen_utils.py +0 -21
- mindspore/ops_generate/pyboost_utils.py +2 -7
- mindspore/ops_generate/template.py +0 -1
- mindspore/parallel/_auto_parallel_context.py +1 -21
- mindspore/parallel/_tensor.py +5 -0
- mindspore/parallel/_transformer/transformer.py +1 -1
- mindspore/parallel/_utils.py +1 -15
- mindspore/parallel/algo_parameter_config.py +3 -1
- mindspore/parallel/checkpoint_transform.py +9 -12
- mindspore/parallel/cluster/process_entity/_api.py +29 -28
- mindspore/parallel/cluster/process_entity/_utils.py +3 -13
- mindspore/parallel/cluster/run.py +16 -13
- mindspore/parallel/parameter_broadcast.py +2 -2
- mindspore/parallel/shard.py +17 -31
- mindspore/profiler/__init__.py +2 -3
- mindspore/profiler/common/util.py +2 -107
- mindspore/profiler/envprofiling.py +1 -1
- mindspore/profiler/parser/ascend_analysis/constant.py +21 -8
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -82
- mindspore/profiler/parser/ascend_analysis/function_event.py +28 -43
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +27 -49
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +10 -15
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +20 -25
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +5 -5
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +1 -10
- mindspore/profiler/parser/ascend_hccl_generator.py +1 -4
- mindspore/profiler/parser/ascend_msprof_exporter.py +22 -43
- mindspore/profiler/parser/ascend_timeline_generator.py +5 -7
- mindspore/profiler/parser/minddata_parser.py +3 -72
- mindspore/profiler/profiling.py +59 -176
- mindspore/rewrite/api/node.py +1 -1
- mindspore/rewrite/common/namespace.py +5 -5
- mindspore/rewrite/parsers/assign_parser.py +0 -2
- mindspore/rewrite/parsers/class_def_parser.py +4 -8
- mindspore/run_check/_check_version.py +1 -1
- mindspore/scipy/fft.py +3 -1
- mindspore/scipy/linalg.py +3 -2
- mindspore/scipy/ops.py +3 -5
- mindspore/scipy/optimize/__init__.py +2 -2
- mindspore/train/__init__.py +4 -4
- mindspore/train/anf_ir_pb2.py +2 -8
- mindspore/train/callback/__init__.py +2 -5
- mindspore/train/callback/_backup_and_restore.py +2 -2
- mindspore/train/callback/_checkpoint.py +16 -104
- mindspore/train/callback/_landscape.py +1 -1
- mindspore/train/callback/_time_monitor.py +1 -1
- mindspore/train/data_sink.py +4 -5
- mindspore/train/dataset_helper.py +20 -45
- mindspore/train/model.py +38 -266
- mindspore/train/serialization.py +105 -256
- mindspore/train/summary/_summary_adapter.py +1 -1
- mindspore/version.py +1 -1
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +2 -2
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +303 -420
- mindspore/_extends/pijit/__init__.py +0 -23
- mindspore/_extends/pijit/pijit_func_white_list.py +0 -343
- mindspore/common/file_system.py +0 -48
- mindspore/common/generator.py +0 -260
- mindspore/common/no_inline.py +0 -54
- mindspore/common/np_dtype.py +0 -25
- mindspore/communication/comm_func.py +0 -1140
- mindspore/hal/memory.py +0 -326
- mindspore/lib/libavcodec.so.59 +0 -0
- mindspore/lib/libavdevice.so.59 +0 -0
- mindspore/lib/libavfilter.so.8 +0 -0
- mindspore/lib/libavformat.so.59 +0 -0
- mindspore/lib/libavutil.so.57 +0 -0
- mindspore/lib/libmindspore_np_dtype.so +0 -0
- mindspore/lib/libswresample.so.4 +0 -0
- mindspore/lib/libswscale.so.6 +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.cpp +0 -326
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.py +0 -180
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/all_finite.json +0 -109
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/binary_info_config.json +0 -38
- mindspore/lib/plugin/ascend/custom_compiler/OWNERS +0 -12
- mindspore/lib/plugin/ascend/custom_compiler/setup.py +0 -255
- mindspore/lib/plugin/ascend/custom_compiler/start.sh +0 -26
- mindspore/lib/plugin/ascend/custom_compiler/template.json +0 -40
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme_op.h +0 -69
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/base_type.h +0 -133
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_creator.h +0 -32
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_param.h +0 -35
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/tiling_info.h +0 -60
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/kernel_register.h +0 -37
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/platform_configs.h +0 -89
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/rt_funcs.h +0 -135
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_op.h +0 -34
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_backoff_base.h +0 -62
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_elewise_op.h +0 -33
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_ops.h +0 -88
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_pa_op.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/cast_op.h +0 -52
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/matmul_op.h +0 -95
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/asd_utils.h +0 -84
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/comm_utils.h +0 -61
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp32.h +0 -224
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/and_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/div_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_impl.h +0 -48
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_tiling.h +0 -25
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/and_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/div_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_base.h +0 -260
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_kernel.h +0 -35
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/max_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/min_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/mul_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/or_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/max_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/min_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/mul_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/or_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/abs_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_impl.h +0 -47
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_tiling.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/exp_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/abs_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_base.h +0 -148
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_kernel.h +0 -31
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/exp_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/ln_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/not_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/reciprocal_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/relu_kernel.h +0 -55
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/rsqrt_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/sqrt_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/ln_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/not_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/reciprocal_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/relu_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/rsqrt_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/sqrt_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_impl.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_tiling.h +0 -187
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul.h +0 -245
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_interface.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_utils.h +0 -111
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/tiling_data.h +0 -54
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/compare_param.h +0 -31
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/elewise_param.h +0 -41
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/grouped_matmul_param.h +0 -40
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/profiling_util.h +0 -364
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_utils.h +0 -69
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_creator.h +0 -39
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_registry.h +0 -114
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/utils.h +0 -98
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.json +0 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aic_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aiv_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.json +0 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aic_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aiv_0.o +0 -0
- mindspore/mint/linalg/__init__.py +0 -22
- mindspore/nn/layer/embedding_service.py +0 -531
- mindspore/nn/layer/embedding_service_layer.py +0 -393
- mindspore/ops/function/reshard_func.py +0 -102
- mindspore/ops/operations/_infer_ops.py +0 -19
- mindspore/ops/operations/reshard_ops.py +0 -53
- mindspore/profiler/common/process_pool.py +0 -41
- mindspore/profiler/common/singleton.py +0 -28
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/train/callback/_cluster_monitor.py +0 -201
- mindspore/train/callback/_flops_collector.py +0 -238
- mindspore/train/callback/_mindio_ttp.py +0 -443
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
mindspore/hal/memory.py
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
# Copyright 2024 Huawei Technologies Co., Ltd
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
# ============================================================================
|
|
15
|
-
|
|
16
|
-
"""Hardware memory interfaces."""
|
|
17
|
-
from mindspore._c_expression import _memory_stats, _reset_max_mem_reserved, _reset_max_mem_allocated
|
|
18
|
-
from mindspore import log as logger
|
|
19
|
-
from .device import _check_inputs_validation, is_initialized
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@_check_inputs_validation
|
|
23
|
-
def memory_stats(device_target=None):
|
|
24
|
-
"""
|
|
25
|
-
Returns status information queried from the memory pool.
|
|
26
|
-
|
|
27
|
-
Note:
|
|
28
|
-
- If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
29
|
-
- For the `CPU` backend, a dictionary with empty data is always returned.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
33
|
-
Default value: ``None``.
|
|
34
|
-
|
|
35
|
-
Returns:
|
|
36
|
-
dict, the queried memory information.
|
|
37
|
-
|
|
38
|
-
Examples:
|
|
39
|
-
>>> import mindspore as ms
|
|
40
|
-
>>> import numpy as np
|
|
41
|
-
>>> from mindspore import Tensor, ops
|
|
42
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
43
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
44
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
45
|
-
>>> print(ms.hal.memory_stats())
|
|
46
|
-
{'total_reserved_memory': 1073741824, 'total_allocated_memory': 1024, 'total_idle_memory': 1073740800,
|
|
47
|
-
'total_eager_free_memory': 0, 'max_reserved_memory': 1073741824, 'max_allocated_memory': 1536,
|
|
48
|
-
'common_mem_pool_stats': {'block_unit_size': 1073741824, 'block_counts': 1, 'blocks_info':
|
|
49
|
-
{<capsule object NULL at 0x7f7e8c27b030>: {'block_stream_id': 0, 'block_memory_size': 1073741824}}},
|
|
50
|
-
'persistent_mem_pool_stats': {'block_unit_size': 1073741824, 'block_counts': 0, 'blocks_info': {}}}
|
|
51
|
-
"""
|
|
52
|
-
if not is_initialized(device_target):
|
|
53
|
-
logger.warning(f"Backend {device_target} is not initialized yet. Return empty dict.")
|
|
54
|
-
return {}
|
|
55
|
-
return _memory_stats(device_target)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@_check_inputs_validation
|
|
59
|
-
def memory_reserved(device_target=None):
|
|
60
|
-
"""
|
|
61
|
-
Returns the total amount of memory currently managed by the memory pool.
|
|
62
|
-
|
|
63
|
-
Note:
|
|
64
|
-
- If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
65
|
-
- For the `CPU` backend, 0 is always returned.
|
|
66
|
-
|
|
67
|
-
Args:
|
|
68
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
69
|
-
Default value: ``None``.
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
int, in Byte.
|
|
73
|
-
|
|
74
|
-
Examples:
|
|
75
|
-
>>> import mindspore as ms
|
|
76
|
-
>>> import numpy as np
|
|
77
|
-
>>> from mindspore import Tensor, ops
|
|
78
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
79
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
80
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
81
|
-
>>> print(ms.hal.memory_reserved())
|
|
82
|
-
1073741824
|
|
83
|
-
"""
|
|
84
|
-
return _memory_stats(device_target).get("total_reserved_memory", 0)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@_check_inputs_validation
|
|
88
|
-
def max_memory_reserved(device_target=None):
|
|
89
|
-
"""
|
|
90
|
-
Returns the peak value of the total memory managed by the memory pool since the process was started.
|
|
91
|
-
|
|
92
|
-
Note:
|
|
93
|
-
- If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
94
|
-
- For the `CPU` backend, 0 is always returned.
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
98
|
-
Default value: ``None``.
|
|
99
|
-
|
|
100
|
-
Returns:
|
|
101
|
-
int, in Byte.
|
|
102
|
-
|
|
103
|
-
Examples:
|
|
104
|
-
>>> import mindspore as ms
|
|
105
|
-
>>> import numpy as np
|
|
106
|
-
>>> from mindspore import Tensor, ops
|
|
107
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
108
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
109
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
110
|
-
>>> print(ms.hal.max_memory_reserved())
|
|
111
|
-
1073741824
|
|
112
|
-
"""
|
|
113
|
-
return _memory_stats(device_target).get("max_reserved_memory", 0)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
@_check_inputs_validation
|
|
117
|
-
def empty_cache():
|
|
118
|
-
"""
|
|
119
|
-
Release all memory fragments in the memory pool, so that memory arrangement
|
|
120
|
-
will be optimized.
|
|
121
|
-
|
|
122
|
-
Note:
|
|
123
|
-
Currently, the MindSpore memory pool does not have the function of releasing memory fragments.
|
|
124
|
-
This interface is reserved but implemented as an empty method and prompted in log mode.
|
|
125
|
-
"""
|
|
126
|
-
logger.warning(f"The empty_cache operation is currently not supported.")
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
@_check_inputs_validation
|
|
130
|
-
def reset_peak_memory_stats(device_target=None):
|
|
131
|
-
"""
|
|
132
|
-
Reset the "peak" stats tracked by memory manager.
|
|
133
|
-
|
|
134
|
-
Note:
|
|
135
|
-
If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
136
|
-
|
|
137
|
-
Args:
|
|
138
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
139
|
-
Default value: ``None``.
|
|
140
|
-
|
|
141
|
-
Examples:
|
|
142
|
-
>>> import mindspore as ms
|
|
143
|
-
>>> import numpy as np
|
|
144
|
-
>>> from mindspore import Tensor, ops
|
|
145
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
146
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
147
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
148
|
-
>>> print(ms.hal.max_memory_reserved())
|
|
149
|
-
1073741824
|
|
150
|
-
>>> print(ms.hal.max_memory_allocated())
|
|
151
|
-
1536
|
|
152
|
-
>>> ms.hal.reset_peak_memory_stats()
|
|
153
|
-
>>> print(ms.hal.max_memory_reserved())
|
|
154
|
-
0
|
|
155
|
-
>>> print(ms.hal.max_memory_allocated())
|
|
156
|
-
0
|
|
157
|
-
"""
|
|
158
|
-
_reset_max_mem_reserved(device_target)
|
|
159
|
-
_reset_max_mem_allocated(device_target)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
@_check_inputs_validation
|
|
163
|
-
def memory_summary(device_target=None):
|
|
164
|
-
"""
|
|
165
|
-
Returns readable memory pool status information.
|
|
166
|
-
|
|
167
|
-
Note:
|
|
168
|
-
If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
169
|
-
|
|
170
|
-
Args:
|
|
171
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
172
|
-
Default value: ``None``.
|
|
173
|
-
|
|
174
|
-
Returns:
|
|
175
|
-
str, readable memory pool status information in tabular form.
|
|
176
|
-
"""
|
|
177
|
-
stats = _memory_stats(device_target)
|
|
178
|
-
|
|
179
|
-
def _format_size(sz, pref_sz):
|
|
180
|
-
prefixes = ["B ", "KB", "MB", "GB", "TB", "PB"]
|
|
181
|
-
prefix = prefixes[0]
|
|
182
|
-
for new_prefix in prefixes[1:]:
|
|
183
|
-
if pref_sz < 768 * 1024:
|
|
184
|
-
break
|
|
185
|
-
prefix = new_prefix
|
|
186
|
-
sz //= 1024
|
|
187
|
-
pref_sz /= 1024
|
|
188
|
-
return f"{sz:6d} {prefix}"
|
|
189
|
-
|
|
190
|
-
metrics_to_display = [
|
|
191
|
-
("total_reserved_memory", "Reserved memory", _format_size),
|
|
192
|
-
("total_allocatd_memory", "Allocated memory", _format_size),
|
|
193
|
-
("total_idle_memory", "Idle memory", _format_size),
|
|
194
|
-
("total_eager_free_memory", "Eager free memory", _format_size),
|
|
195
|
-
("max_reserved_memory", "Max reserved memory", _format_size),
|
|
196
|
-
("max_allocated_memory", "Max allocated memory", _format_size),
|
|
197
|
-
]
|
|
198
|
-
|
|
199
|
-
lines = []
|
|
200
|
-
lines.append("=" * 45)
|
|
201
|
-
lines.append(" {:^43} ".format('Memory summary'))
|
|
202
|
-
lines.append("=" * 45)
|
|
203
|
-
lines.append(" {:<20} | {:<20} ".format('Metric', 'Data'))
|
|
204
|
-
|
|
205
|
-
for metric_key, metric_name, formatter in metrics_to_display:
|
|
206
|
-
lines.append("-" * 45)
|
|
207
|
-
data = stats[metric_key]
|
|
208
|
-
lines.append(" {:<20} | {:<20} ".format(metric_name, formatter(data, data)))
|
|
209
|
-
|
|
210
|
-
lines.append("=" * 45)
|
|
211
|
-
|
|
212
|
-
return "|" + "|\n|".join(lines) + "|\n"
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
@_check_inputs_validation
|
|
216
|
-
def memory_allocated(device_target=None):
|
|
217
|
-
"""
|
|
218
|
-
Returns the actual memory size currently occupied by Tensor.
|
|
219
|
-
|
|
220
|
-
Note:
|
|
221
|
-
- If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
222
|
-
- For the `CPU` backend, 0 is always returned.
|
|
223
|
-
|
|
224
|
-
Args:
|
|
225
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
226
|
-
Default value: ``None``.
|
|
227
|
-
|
|
228
|
-
Returns:
|
|
229
|
-
int, in Byte.
|
|
230
|
-
|
|
231
|
-
Examples:
|
|
232
|
-
>>> import mindspore as ms
|
|
233
|
-
>>> import numpy as np
|
|
234
|
-
>>> from mindspore import Tensor, ops
|
|
235
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
236
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
237
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
238
|
-
>>> print(ms.hal.memory_allocated())
|
|
239
|
-
1024
|
|
240
|
-
"""
|
|
241
|
-
return _memory_stats(device_target).get("total_allocatd_memory", 0)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
@_check_inputs_validation
|
|
245
|
-
def max_memory_allocated(device_target=None):
|
|
246
|
-
"""
|
|
247
|
-
Returns the peak memory size of the memory pool actually occupied by Tensor since the process was started.
|
|
248
|
-
|
|
249
|
-
Note:
|
|
250
|
-
- If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
251
|
-
- For the `CPU` backend, 0 is always returned.
|
|
252
|
-
|
|
253
|
-
Args:
|
|
254
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
255
|
-
Default value: ``None``.
|
|
256
|
-
|
|
257
|
-
Returns:
|
|
258
|
-
int, in Byte.
|
|
259
|
-
|
|
260
|
-
Examples:
|
|
261
|
-
>>> import mindspore as ms
|
|
262
|
-
>>> import numpy as np
|
|
263
|
-
>>> from mindspore import Tensor, ops
|
|
264
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
265
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
266
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
267
|
-
>>> print(ms.hal.max_memory_allocated())
|
|
268
|
-
1536
|
|
269
|
-
"""
|
|
270
|
-
return _memory_stats(device_target).get("max_allocated_memory", 0)
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
@_check_inputs_validation
|
|
274
|
-
def reset_max_memory_reserved(device_target=None):
|
|
275
|
-
"""
|
|
276
|
-
Reset the peak memory size managed by the memory pool.
|
|
277
|
-
|
|
278
|
-
Note:
|
|
279
|
-
If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
280
|
-
|
|
281
|
-
Args:
|
|
282
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
283
|
-
Default value: ``None``.
|
|
284
|
-
|
|
285
|
-
Examples:
|
|
286
|
-
>>> import mindspore as ms
|
|
287
|
-
>>> import numpy as np
|
|
288
|
-
>>> from mindspore import Tensor, ops
|
|
289
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
290
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
291
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
292
|
-
>>> print(ms.hal.max_memory_reserved())
|
|
293
|
-
1073741824
|
|
294
|
-
>>> ms.hal.reset_max_memory_reserved()
|
|
295
|
-
>>> print(ms.hal.max_memory_reserved())
|
|
296
|
-
0
|
|
297
|
-
"""
|
|
298
|
-
_reset_max_mem_reserved(device_target)
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
@_check_inputs_validation
|
|
302
|
-
def reset_max_memory_allocated(device_target=None):
|
|
303
|
-
"""
|
|
304
|
-
Reset the peak memory size of the memory pool actually occupied by Tensor.
|
|
305
|
-
|
|
306
|
-
Note:
|
|
307
|
-
If `device_target` is not specified, get the device capability of the current backend set by context.
|
|
308
|
-
|
|
309
|
-
Args:
|
|
310
|
-
device_target (str, optional): The device name of backend, should be one of "CPU", "GPU" and "Ascend".
|
|
311
|
-
Default value: ``None``.
|
|
312
|
-
|
|
313
|
-
Examples:
|
|
314
|
-
>>> import mindspore as ms
|
|
315
|
-
>>> import numpy as np
|
|
316
|
-
>>> from mindspore import Tensor, ops
|
|
317
|
-
>>> a = Tensor(np.ones([1, 2]), ms.float32)
|
|
318
|
-
>>> b = Tensor(np.ones([1, 2]), ms.float32)
|
|
319
|
-
>>> c = ops.add(a, b).asnumpy()
|
|
320
|
-
>>> print(ms.hal.max_memory_allocated())
|
|
321
|
-
1536
|
|
322
|
-
>>> ms.hal.reset_max_memory_allocated()
|
|
323
|
-
>>> print(ms.hal.max_memory_allocated())
|
|
324
|
-
0
|
|
325
|
-
"""
|
|
326
|
-
_reset_max_mem_allocated(device_target)
|
mindspore/lib/libavcodec.so.59
DELETED
|
Binary file
|
mindspore/lib/libavdevice.so.59
DELETED
|
Binary file
|
mindspore/lib/libavfilter.so.8
DELETED
|
Binary file
|
mindspore/lib/libavformat.so.59
DELETED
|
Binary file
|
mindspore/lib/libavutil.so.57
DELETED
|
Binary file
|
|
Binary file
|
mindspore/lib/libswresample.so.4
DELETED
|
Binary file
|
mindspore/lib/libswscale.so.6
DELETED
|
Binary file
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2024 Huawei Technologies Co., Ltd
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
#include "kernel_operator.h"
|
|
17
|
-
using namespace AscendC;
|
|
18
|
-
|
|
19
|
-
constexpr int32_t BUFFER_NUM = 1;
|
|
20
|
-
constexpr int32_t OUT_MIN_LEN = 16;
|
|
21
|
-
|
|
22
|
-
template <typename IN_TYPE>
|
|
23
|
-
class KernelAllFinite {
|
|
24
|
-
public:
|
|
25
|
-
__aicore__ explicit KernelAllFinite() {}
|
|
26
|
-
__aicore__ inline void setArgs(GM_ADDR in, GM_ADDR out) {
|
|
27
|
-
gm_x = reinterpret_cast<__gm__ IN_TYPE *>(in);
|
|
28
|
-
gm_y = reinterpret_cast<__gm__ half *>(out);
|
|
29
|
-
core_idx = get_block_idx();
|
|
30
|
-
core_num = get_block_num();
|
|
31
|
-
}
|
|
32
|
-
__aicore__ inline void setTiling(uint32_t avg_block_count_in, uint32_t avg_block_ub_num_in,
|
|
33
|
-
uint32_t avg_block_ub_tail_in, uint32_t avg_block_ub_loop_in,
|
|
34
|
-
uint32_t avg_block_ub_real_in, uint32_t avg_block_ub_pad_in,
|
|
35
|
-
uint32_t tail_block_count_in, uint32_t tail_block_ub_num_in,
|
|
36
|
-
uint32_t tail_block_ub_tail_in, uint32_t tail_block_ub_loop_in,
|
|
37
|
-
uint32_t tail_block_ub_real_in, uint32_t tail_block_ub_pad_in,
|
|
38
|
-
uint32_t buffer_num_in, uint32_t in_dtype_in) {
|
|
39
|
-
avg_block_count = avg_block_count_in;
|
|
40
|
-
avg_block_ub_num = avg_block_ub_num_in;
|
|
41
|
-
avg_block_ub_tail = avg_block_ub_tail_in;
|
|
42
|
-
avg_block_ub_loop = avg_block_ub_loop_in;
|
|
43
|
-
avg_block_ub_real = avg_block_ub_real_in;
|
|
44
|
-
avg_block_ub_pad = avg_block_ub_pad_in;
|
|
45
|
-
|
|
46
|
-
tail_block_count = tail_block_count_in;
|
|
47
|
-
tail_block_ub_num = tail_block_ub_num_in;
|
|
48
|
-
tail_block_ub_tail = tail_block_ub_tail_in;
|
|
49
|
-
tail_block_ub_loop = tail_block_ub_loop_in;
|
|
50
|
-
tail_block_ub_real = tail_block_ub_real_in;
|
|
51
|
-
tail_block_ub_pad = tail_block_ub_pad_in;
|
|
52
|
-
|
|
53
|
-
buffer_num = buffer_num_in;
|
|
54
|
-
in_dtype = in_dtype_in;
|
|
55
|
-
}
|
|
56
|
-
__aicore__ inline void setShift(uint32_t left, uint32_t right) {
|
|
57
|
-
left_shift = left;
|
|
58
|
-
right_shift = right;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
__aicore__ inline void Process() {
|
|
62
|
-
if (core_idx >= core_num) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
uint32_t ub_count = avg_block_ub_num;
|
|
67
|
-
uint32_t ub_loop = avg_block_ub_loop;
|
|
68
|
-
uint32_t ub_tail = avg_block_ub_tail;
|
|
69
|
-
uint32_t ub_real = avg_block_ub_real;
|
|
70
|
-
uint32_t ub_pad = avg_block_ub_pad;
|
|
71
|
-
|
|
72
|
-
if (core_idx == core_num - 1) {
|
|
73
|
-
ub_count = tail_block_ub_num;
|
|
74
|
-
ub_loop = tail_block_ub_loop;
|
|
75
|
-
ub_tail = tail_block_ub_tail;
|
|
76
|
-
ub_real = tail_block_ub_real;
|
|
77
|
-
ub_pad = tail_block_ub_pad;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
Init(ub_count);
|
|
81
|
-
if (in_dtype == 1 || in_dtype == 27) {
|
|
82
|
-
ProcessHalf(ub_count, ub_tail, ub_loop, ub_real, ub_pad);
|
|
83
|
-
} else if (in_dtype == 0) {
|
|
84
|
-
ProcessFp32(ub_count, ub_tail, ub_loop, ub_real, ub_pad);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private:
|
|
89
|
-
__aicore__ inline void ProcessHalf(uint32_t ub_count, uint32_t ub_tail, uint32_t ub_loop, uint32_t ub_real,
|
|
90
|
-
uint32_t ub_pad) {
|
|
91
|
-
AscendC::LocalTensor<uint8_t> comp_t = compQue.AllocTensor<uint8_t>();
|
|
92
|
-
AscendC::LocalTensor<uint16_t> tmp_t = tmpQue.AllocTensor<uint16_t>();
|
|
93
|
-
AscendC::LocalTensor<uint16_t> mask_t = maskQue.AllocTensor<uint16_t>();
|
|
94
|
-
if (right_shift == 11) { // half
|
|
95
|
-
Duplicate(mask_t, (uint16_t)0x001F, ub_count); // 0 00000 00000 11111
|
|
96
|
-
} else { // 8 bf16
|
|
97
|
-
Duplicate(mask_t, (uint16_t)0x00FF, ub_count); // 0 000 0000 1111 1111
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
uint32_t loop = 0;
|
|
101
|
-
for (; loop < ub_loop - 1; loop++) {
|
|
102
|
-
CopyIn(loop, ub_count, ub_count);
|
|
103
|
-
ComputeHalf(ub_count, tmp_t, mask_t, comp_t, &loop);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* for ub tail */
|
|
107
|
-
if (ub_tail == 0 || loop >= ub_loop) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
CopyInPad(loop, ub_count, ub_tail, ub_real, ub_pad);
|
|
111
|
-
ComputeHalf(ub_tail, tmp_t, mask_t, comp_t, &loop);
|
|
112
|
-
|
|
113
|
-
/* free tmp local tensor */
|
|
114
|
-
tmpQue.FreeTensor(tmp_t);
|
|
115
|
-
maskQue.FreeTensor(mask_t);
|
|
116
|
-
compQue.FreeTensor(comp_t);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
__aicore__ inline void ProcessFp32(uint32_t ub_count, uint32_t ub_tail, uint32_t ub_loop, uint32_t ub_real,
|
|
120
|
-
uint32_t ub_pad) {
|
|
121
|
-
AscendC::LocalTensor<uint8_t> comp_t = compQue.AllocTensor<uint8_t>();
|
|
122
|
-
AscendC::LocalTensor<uint32_t> tmp_t = tmpQue.AllocTensor<uint32_t>();
|
|
123
|
-
AscendC::LocalTensor<uint32_t> mask_t = maskQue.AllocTensor<uint32_t>();
|
|
124
|
-
Duplicate(mask_t, (uint32_t)0x00FF, ub_count); // 0 00000000 000 0000 0000 0000 1111 1111
|
|
125
|
-
|
|
126
|
-
uint32_t loop = 0;
|
|
127
|
-
for (; loop < ub_loop - 1; loop++) {
|
|
128
|
-
CopyIn(loop, ub_count, ub_count);
|
|
129
|
-
ComputeFp32(ub_count, tmp_t, mask_t, comp_t, &loop);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/* for ub tail */
|
|
133
|
-
if (ub_tail == 0 || loop >= ub_loop) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
CopyInPad(loop, ub_count, ub_tail, ub_real, ub_pad);
|
|
137
|
-
ComputeFp32(ub_tail, tmp_t, mask_t, comp_t, &loop);
|
|
138
|
-
|
|
139
|
-
/* free tmp local tensor */
|
|
140
|
-
tmpQue.FreeTensor(tmp_t);
|
|
141
|
-
maskQue.FreeTensor(mask_t);
|
|
142
|
-
compQue.FreeTensor(comp_t);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
__aicore__ inline void Init(uint32_t count) {
|
|
146
|
-
xGm.SetGlobalBuffer(gm_x + core_idx * avg_block_count);
|
|
147
|
-
yGm.SetGlobalBuffer(gm_y);
|
|
148
|
-
pipe.InitBuffer(xQue, buffer_num, count * sizeof(IN_TYPE));
|
|
149
|
-
pipe.InitBuffer(tmpQue, buffer_num, count * sizeof(IN_TYPE));
|
|
150
|
-
pipe.InitBuffer(maskQue, buffer_num, count * sizeof(IN_TYPE));
|
|
151
|
-
pipe.InitBuffer(compQue, buffer_num, count / 8 * sizeof(uint8_t));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
__aicore__ inline void CopyIn(uint32_t idx, uint32_t stride, uint32_t count) {
|
|
155
|
-
AscendC::LocalTensor<IN_TYPE> x = xQue.AllocTensor<IN_TYPE>();
|
|
156
|
-
DataCopy(x, xGm[idx * stride], count);
|
|
157
|
-
xQue.EnQue(x);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
__aicore__ inline void CopyInPad(uint32_t idx, uint32_t stride, uint32_t count, uint32_t real, uint32_t pad) {
|
|
161
|
-
uint32_t real_cp_size = real * sizeof(IN_TYPE);
|
|
162
|
-
AscendC::DataCopyExtParams copy_params{1, real_cp_size, 0, 0, 0};
|
|
163
|
-
uint8_t pad_ele_count = pad;
|
|
164
|
-
AscendC::DataCopyPadExtParams<IN_TYPE> pad_param{true, 0, pad_ele_count, 0};
|
|
165
|
-
AscendC::LocalTensor<IN_TYPE> x = xQue.AllocTensor<IN_TYPE>();
|
|
166
|
-
Duplicate(x, (IN_TYPE)0x0, count);
|
|
167
|
-
DataCopyPad(x, xGm[idx * stride], copy_params, pad_param);
|
|
168
|
-
xQue.EnQue(x);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
__aicore__ inline void CheckValidHalf(uint32_t count, AscendC::LocalTensor<uint16_t> shift_t,
|
|
172
|
-
AscendC::LocalTensor<uint16_t> mask_t, AscendC::LocalTensor<uint8_t> comp_t) {
|
|
173
|
-
AscendC::LocalTensor<uint16_t> in_t = xQue.DeQue<uint16_t>();
|
|
174
|
-
|
|
175
|
-
AscendC::ShiftLeft<uint16_t>(shift_t, in_t, left_shift, count);
|
|
176
|
-
pipe_barrier(PIPE_ALL);
|
|
177
|
-
AscendC::ShiftRight<uint16_t>(shift_t, shift_t, right_shift, count);
|
|
178
|
-
pipe_barrier(PIPE_ALL);
|
|
179
|
-
|
|
180
|
-
xQue.FreeTensor(in_t);
|
|
181
|
-
|
|
182
|
-
AscendC::LocalTensor<half> shift_half_t = shift_t.ReinterpretCast<half>();
|
|
183
|
-
AscendC::LocalTensor<half> mask_half_t = mask_t.ReinterpretCast<half>();
|
|
184
|
-
|
|
185
|
-
Compare(comp_t, shift_half_t, mask_half_t, AscendC::CMPMODE::EQ, count);
|
|
186
|
-
pipe_barrier(PIPE_ALL);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
__aicore__ inline void CheckValidFp32(uint32_t count, AscendC::LocalTensor<uint32_t> shift_t,
|
|
190
|
-
AscendC::LocalTensor<uint32_t> mask_t, AscendC::LocalTensor<uint8_t> comp_t) {
|
|
191
|
-
AscendC::LocalTensor<uint32_t> in_t = xQue.DeQue<uint32_t>();
|
|
192
|
-
|
|
193
|
-
AscendC::ShiftLeft<uint32_t>(shift_t, in_t, 1, count);
|
|
194
|
-
pipe_barrier(PIPE_ALL);
|
|
195
|
-
AscendC::ShiftRight<uint32_t>(shift_t, shift_t, 24, count);
|
|
196
|
-
pipe_barrier(PIPE_ALL);
|
|
197
|
-
|
|
198
|
-
xQue.FreeTensor(in_t);
|
|
199
|
-
|
|
200
|
-
AscendC::LocalTensor<float> shift_fp32_t = shift_t.ReinterpretCast<float>();
|
|
201
|
-
AscendC::LocalTensor<float> mask_fp32_t = mask_t.ReinterpretCast<float>();
|
|
202
|
-
|
|
203
|
-
Compare(comp_t, shift_fp32_t, mask_fp32_t, AscendC::CMPMODE::EQ, count);
|
|
204
|
-
pipe_barrier(PIPE_ALL);
|
|
205
|
-
}
|
|
206
|
-
__aicore__ inline void CombRes(uint32_t count, uint32_t *loop, AscendC::LocalTensor<uint8_t> comp_t,
|
|
207
|
-
AscendC::LocalTensor<uint16_t> ui16_t) {
|
|
208
|
-
const int mask = 128;
|
|
209
|
-
int total_count = count / 8;
|
|
210
|
-
int repeat = (total_count + 127) / mask;
|
|
211
|
-
|
|
212
|
-
AscendC::LocalTensor<half> half_comp_t = ui16_t.ReinterpretCast<half>();
|
|
213
|
-
Duplicate(half_comp_t, (half)0x0, count);
|
|
214
|
-
Cast(half_comp_t, comp_t, AscendC::RoundMode::CAST_NONE, total_count);
|
|
215
|
-
pipe_barrier(PIPE_ALL);
|
|
216
|
-
|
|
217
|
-
while (repeat > 1) {
|
|
218
|
-
WholeReduceSum(half_comp_t, half_comp_t, mask, repeat, 1, 1, 8);
|
|
219
|
-
repeat = (repeat + 127) / mask;
|
|
220
|
-
total_count = (total_count + 127) / mask;
|
|
221
|
-
pipe_barrier(PIPE_ALL);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
WholeReduceSum(half_comp_t, half_comp_t, total_count, 1, 1, 1, 8);
|
|
225
|
-
pipe_barrier(PIPE_ALL);
|
|
226
|
-
|
|
227
|
-
float result = half_comp_t.GetValue(0);
|
|
228
|
-
if (result != 0) {
|
|
229
|
-
ui16_t.SetValue(0, 1);
|
|
230
|
-
DataCopy(yGm[0], half_comp_t, OUT_MIN_LEN);
|
|
231
|
-
*loop = count;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
__aicore__ inline void ComputeHalf(uint32_t count, AscendC::LocalTensor<uint16_t> tmp_t,
|
|
236
|
-
AscendC::LocalTensor<uint16_t> mask_t, AscendC::LocalTensor<uint8_t> comp_t,
|
|
237
|
-
uint32_t *loop) {
|
|
238
|
-
CheckValidHalf(count, tmp_t, mask_t, comp_t);
|
|
239
|
-
CombRes(count, loop, comp_t, tmp_t);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
__aicore__ inline void ComputeFp32(uint32_t count, AscendC::LocalTensor<uint32_t> tmp_t,
|
|
243
|
-
AscendC::LocalTensor<uint32_t> mask_t, AscendC::LocalTensor<uint8_t> comp_t,
|
|
244
|
-
uint32_t *loop) {
|
|
245
|
-
CheckValidFp32(count, tmp_t, mask_t, comp_t);
|
|
246
|
-
CombRes(count, loop, comp_t, tmp_t.ReinterpretCast<uint16_t>());
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
AscendC::TPipe pipe;
|
|
250
|
-
|
|
251
|
-
AscendC::TQue<AscendC::QuePosition::VECIN, 1> xQue;
|
|
252
|
-
AscendC::TQue<AscendC::QuePosition::VECIN, 1> tmpQue, maskQue, compQue;
|
|
253
|
-
|
|
254
|
-
AscendC::GlobalTensor<IN_TYPE> xGm;
|
|
255
|
-
AscendC::GlobalTensor<half> yGm;
|
|
256
|
-
|
|
257
|
-
__gm__ IN_TYPE *__restrict__ gm_x{nullptr};
|
|
258
|
-
__gm__ half *__restrict__ gm_y{nullptr};
|
|
259
|
-
|
|
260
|
-
uint32_t left_shift{0};
|
|
261
|
-
uint32_t right_shift{0};
|
|
262
|
-
|
|
263
|
-
uint32_t core_idx{0};
|
|
264
|
-
uint32_t core_num{0};
|
|
265
|
-
|
|
266
|
-
uint32_t buffer_num{0};
|
|
267
|
-
uint32_t in_dtype{0};
|
|
268
|
-
|
|
269
|
-
uint32_t avg_block_count{0};
|
|
270
|
-
uint32_t avg_block_ub_num{0};
|
|
271
|
-
uint32_t avg_block_ub_tail{0};
|
|
272
|
-
uint32_t avg_block_ub_loop{0};
|
|
273
|
-
uint32_t avg_block_ub_real{0};
|
|
274
|
-
uint32_t avg_block_ub_pad{0};
|
|
275
|
-
|
|
276
|
-
uint32_t tail_block_count{0};
|
|
277
|
-
uint32_t tail_block_ub_num{0};
|
|
278
|
-
uint32_t tail_block_ub_tail{0};
|
|
279
|
-
uint32_t tail_block_ub_loop{0};
|
|
280
|
-
uint32_t tail_block_ub_real{0};
|
|
281
|
-
uint32_t tail_block_ub_pad{0};
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
extern "C" __global__ __aicore__ void all_finite(GM_ADDR x, GM_ADDR z, GM_ADDR workspace, GM_ADDR tiling) {
|
|
285
|
-
uint32_t avg_block_count = (uint32_t)(*((__gm__ uint32_t *)tiling + 0));
|
|
286
|
-
uint32_t avg_block_ub_num = (uint32_t)(*((__gm__ uint32_t *)tiling + 1));
|
|
287
|
-
uint32_t avg_block_ub_tail = (uint32_t)(*((__gm__ uint32_t *)tiling + 2));
|
|
288
|
-
uint32_t avg_block_ub_loop = (uint32_t)(*((__gm__ uint32_t *)tiling + 3));
|
|
289
|
-
uint32_t avg_block_ub_real = (uint32_t)(*((__gm__ uint32_t *)tiling + 4));
|
|
290
|
-
uint32_t avg_block_ub_pad = (uint32_t)(*((__gm__ uint32_t *)tiling + 5));
|
|
291
|
-
|
|
292
|
-
uint32_t tail_block_count = (uint32_t)(*((__gm__ uint32_t *)tiling + 6));
|
|
293
|
-
uint32_t tail_block_ub_num = (uint32_t)(*((__gm__ uint32_t *)tiling + 7));
|
|
294
|
-
uint32_t tail_block_ub_tail = (uint32_t)(*((__gm__ uint32_t *)tiling + 8));
|
|
295
|
-
uint32_t tail_block_ub_loop = (uint32_t)(*((__gm__ uint32_t *)tiling + 9));
|
|
296
|
-
uint32_t tail_block_ub_real = (uint32_t)(*((__gm__ uint32_t *)tiling + 10));
|
|
297
|
-
uint32_t tail_block_ub_pad = (uint32_t)(*((__gm__ uint32_t *)tiling + 11));
|
|
298
|
-
|
|
299
|
-
uint32_t buffer_num = (uint32_t)(*((__gm__ uint32_t *)tiling + 12));
|
|
300
|
-
uint32_t in_dtype = (uint32_t)(*((__gm__ uint32_t *)tiling + 13));
|
|
301
|
-
|
|
302
|
-
if (in_dtype == 0) {
|
|
303
|
-
KernelAllFinite<uint32_t> op;
|
|
304
|
-
op.setArgs(x, z);
|
|
305
|
-
op.setTiling(avg_block_count, avg_block_ub_num, avg_block_ub_tail, avg_block_ub_loop, avg_block_ub_real,
|
|
306
|
-
avg_block_ub_pad, tail_block_count, tail_block_ub_num, tail_block_ub_tail, tail_block_ub_loop,
|
|
307
|
-
tail_block_ub_real, tail_block_ub_pad, buffer_num, in_dtype);
|
|
308
|
-
op.Process();
|
|
309
|
-
} else if (in_dtype == 1) {
|
|
310
|
-
KernelAllFinite<uint16_t> op;
|
|
311
|
-
op.setArgs(x, z);
|
|
312
|
-
op.setShift(1, 11);
|
|
313
|
-
op.setTiling(avg_block_count, avg_block_ub_num, avg_block_ub_tail, avg_block_ub_loop, avg_block_ub_real,
|
|
314
|
-
avg_block_ub_pad, tail_block_count, tail_block_ub_num, tail_block_ub_tail, tail_block_ub_loop,
|
|
315
|
-
tail_block_ub_real, tail_block_ub_pad, buffer_num, in_dtype);
|
|
316
|
-
op.Process();
|
|
317
|
-
} else if (in_dtype == 27) {
|
|
318
|
-
KernelAllFinite<uint16_t> op; // bf16
|
|
319
|
-
op.setArgs(x, z);
|
|
320
|
-
op.setShift(1, 8);
|
|
321
|
-
op.setTiling(avg_block_count, avg_block_ub_num, avg_block_ub_tail, avg_block_ub_loop, avg_block_ub_real,
|
|
322
|
-
avg_block_ub_pad, tail_block_count, tail_block_ub_num, tail_block_ub_tail, tail_block_ub_loop,
|
|
323
|
-
tail_block_ub_real, tail_block_ub_pad, buffer_num, in_dtype);
|
|
324
|
-
op.Process();
|
|
325
|
-
}
|
|
326
|
-
}
|