mindspore 2.3.0rc1__cp37-none-any.whl → 2.3.0rc2__cp37-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/__init__.py +1 -1
- mindspore/_akg/akg/utils/tbe_codegen_utils.py +13 -3
- mindspore/_c_dataengine.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/_c_expression.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/_checkparam.py +20 -0
- mindspore/_extends/parse/parser.py +1 -1
- mindspore/_extends/parse/standard_method.py +6 -5
- mindspore/_mindspore_offline_debug.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/amp.py +5 -5
- mindspore/bin/cache_admin +0 -0
- mindspore/bin/cache_server +0 -0
- mindspore/boost/boost_cell_wrapper.py +1 -1
- mindspore/boost/group_loss_scale_manager.py +1 -1
- mindspore/common/__init__.py +4 -2
- mindspore/common/_register_for_recompute.py +48 -0
- mindspore/common/_stub_tensor.py +1 -0
- mindspore/common/api.py +56 -4
- mindspore/common/dtype.py +5 -3
- mindspore/common/dump.py +2 -2
- mindspore/common/hook_handle.py +51 -4
- mindspore/common/initializer.py +1 -1
- mindspore/common/jit_config.py +17 -6
- mindspore/common/parameter.py +7 -2
- mindspore/common/recompute.py +247 -0
- mindspore/common/sparse_tensor.py +2 -2
- mindspore/common/symbol.py +1 -1
- mindspore/common/tensor.py +74 -36
- mindspore/communication/__init__.py +3 -3
- mindspore/communication/management.py +30 -30
- mindspore/context.py +28 -15
- mindspore/dataset/__init__.py +5 -5
- mindspore/dataset/audio/__init__.py +2 -2
- mindspore/dataset/audio/transforms.py +51 -51
- mindspore/dataset/callback/ds_callback.py +2 -2
- mindspore/dataset/engine/cache_client.py +1 -1
- mindspore/dataset/engine/datasets.py +3 -3
- mindspore/dataset/engine/datasets_audio.py +14 -14
- mindspore/dataset/engine/datasets_standard_format.py +3 -3
- mindspore/dataset/engine/datasets_text.py +38 -38
- mindspore/dataset/engine/datasets_user_defined.py +3 -3
- mindspore/dataset/engine/datasets_vision.py +68 -68
- mindspore/dataset/text/__init__.py +3 -3
- mindspore/dataset/text/transforms.py +26 -26
- mindspore/dataset/transforms/__init__.py +1 -1
- mindspore/dataset/vision/__init__.py +3 -3
- mindspore/dataset/vision/transforms.py +92 -92
- mindspore/dataset/vision/utils.py +1 -1
- mindspore/experimental/optim/adadelta.py +2 -2
- mindspore/experimental/optim/adagrad.py +2 -2
- mindspore/experimental/optim/adam.py +2 -2
- mindspore/experimental/optim/adamax.py +2 -2
- mindspore/experimental/optim/adamw.py +2 -2
- mindspore/experimental/optim/asgd.py +2 -2
- mindspore/experimental/optim/lr_scheduler.py +24 -20
- mindspore/experimental/optim/nadam.py +2 -2
- mindspore/experimental/optim/optimizer.py +1 -1
- mindspore/experimental/optim/radam.py +2 -2
- mindspore/experimental/optim/rmsprop.py +2 -2
- mindspore/experimental/optim/rprop.py +2 -2
- mindspore/experimental/optim/sgd.py +2 -2
- mindspore/hal/stream.py +2 -0
- mindspore/include/mindapi/base/types.h +5 -0
- 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_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/libopencv_core.so.4.5 +0 -0
- 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 +6 -6
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
- mindspore/lib/plugin/ascend/libdvpp_utils.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 +101787 -98559
- 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/include/asdops/base/op_register.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/mix.h +8 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/norm.h +5 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/reduce.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/backend/backend.h +3 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/backend/rtbackend.h +3 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/base/types.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/module/module.h +3 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/svector/svector.h +3 -2
- 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/tiling/add_tiling.h +9 -9
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +2 -6
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_base.h +460 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_bf16.h +217 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp16.h +116 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_tiling.h +16 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_value.h +27 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -4
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/FlashAttentionScore_impl.h → flash_attention_score/flash_attention_score_impl.h} +2 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/bs_attention_tiling.h → flash_attention_score/flash_attention_score_tiling.h} +15 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/gelu/tiling/gelu_tiling.h +7 -9
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/lccl/lccl_wrapper.h +58 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +19 -8
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/pp_matmul_common_tiling.h +18 -8
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/pp_matmul_info.h +7 -4
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/tiling_data.h +44 -6
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_utils.h +65 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +10 -6
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +4 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +41 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/PagedAttention_impl.h → paged_attention/paged_attention_impl.h} +1 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +63 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/add_param.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention_param.h → param/attention_param.h} +11 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +37 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +45 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/reshape_and_cache/reshape_and_cache_tiling.h +1 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm.h +23 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_base.h +175 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_normal.h +276 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_split_d.h +280 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/tiling_data.h +35 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +45 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/kernel/sub_kernel.h +20 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +47 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_tiling.h +25 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +323 -23
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/types.h +15 -4
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +8 -0
- 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/include/lcal.h +22 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal_comm.h +70 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal_types.h +103 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lccl.h +47 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lccl_wrapper.h +58 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcoc.h +154 -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/log.py +2 -2
- mindspore/mint/__init__.py +457 -0
- mindspore/mint/nn/__init__.py +430 -0
- mindspore/mint/nn/functional.py +424 -0
- mindspore/mint/optim/__init__.py +24 -0
- mindspore/mint/optim/adamw.py +186 -0
- mindspore/multiprocessing/__init__.py +4 -0
- mindspore/nn/__init__.py +3 -0
- mindspore/nn/cell.py +51 -47
- mindspore/nn/extend/__init__.py +29 -0
- mindspore/nn/extend/basic.py +140 -0
- mindspore/nn/extend/embedding.py +143 -0
- mindspore/nn/extend/layer/__init__.py +27 -0
- mindspore/nn/extend/layer/normalization.py +107 -0
- mindspore/nn/extend/pooling.py +117 -0
- mindspore/nn/generator.py +297 -0
- mindspore/nn/layer/basic.py +109 -1
- mindspore/nn/layer/container.py +2 -2
- mindspore/nn/layer/conv.py +6 -6
- mindspore/nn/layer/embedding.py +1 -1
- mindspore/nn/layer/normalization.py +21 -43
- mindspore/nn/layer/padding.py +4 -0
- mindspore/nn/optim/ada_grad.py +2 -2
- mindspore/nn/optim/adadelta.py +1 -1
- mindspore/nn/optim/adafactor.py +1 -1
- mindspore/nn/optim/adam.py +7 -7
- mindspore/nn/optim/adamax.py +2 -2
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/asgd.py +2 -2
- mindspore/nn/optim/ftrl.py +1 -1
- mindspore/nn/optim/lamb.py +3 -3
- mindspore/nn/optim/lars.py +1 -1
- mindspore/nn/optim/lazyadam.py +2 -2
- mindspore/nn/optim/momentum.py +2 -2
- mindspore/nn/optim/optimizer.py +2 -2
- mindspore/nn/optim/proximal_ada_grad.py +2 -2
- mindspore/nn/optim/rmsprop.py +2 -2
- mindspore/nn/optim/rprop.py +2 -2
- mindspore/nn/optim/sgd.py +2 -2
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/wrap/cell_wrapper.py +9 -9
- mindspore/nn/wrap/grad_reducer.py +5 -5
- mindspore/ops/_grad_experimental/grad_comm_ops.py +4 -2
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +41 -2
- mindspore/ops/_vmap/vmap_math_ops.py +27 -8
- mindspore/ops/_vmap/vmap_nn_ops.py +66 -8
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +73 -1
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +12 -3
- mindspore/ops/auto_generate/gen_arg_handler.py +24 -0
- mindspore/ops/auto_generate/gen_extend_func.py +274 -0
- mindspore/ops/auto_generate/gen_ops_def.py +889 -22
- mindspore/ops/auto_generate/gen_ops_prim.py +3541 -253
- mindspore/ops/auto_generate/pyboost_inner_prim.py +282 -0
- mindspore/ops/composite/multitype_ops/_compile_utils.py +2 -1
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +9 -0
- mindspore/ops/extend/__init__.py +9 -1
- mindspore/ops/extend/array_func.py +134 -27
- mindspore/ops/extend/math_func.py +3 -3
- mindspore/ops/extend/nn_func.py +363 -2
- mindspore/ops/function/__init__.py +19 -2
- mindspore/ops/function/array_func.py +463 -439
- mindspore/ops/function/clip_func.py +7 -18
- mindspore/ops/function/grad/grad_func.py +5 -5
- mindspore/ops/function/linalg_func.py +4 -4
- mindspore/ops/function/math_func.py +260 -243
- mindspore/ops/function/nn_func.py +825 -62
- mindspore/ops/function/random_func.py +73 -4
- mindspore/ops/function/sparse_unary_func.py +1 -1
- mindspore/ops/function/vmap_func.py +1 -1
- mindspore/ops/functional.py +2 -2
- mindspore/ops/op_info_register.py +1 -31
- mindspore/ops/operations/__init__.py +2 -3
- mindspore/ops/operations/_grad_ops.py +2 -107
- mindspore/ops/operations/_inner_ops.py +5 -5
- mindspore/ops/operations/_sequence_ops.py +2 -2
- mindspore/ops/operations/array_ops.py +11 -233
- mindspore/ops/operations/comm_ops.py +32 -32
- mindspore/ops/operations/custom_ops.py +7 -89
- mindspore/ops/operations/manually_defined/ops_def.py +329 -4
- mindspore/ops/operations/math_ops.py +13 -163
- mindspore/ops/operations/nn_ops.py +9 -316
- mindspore/ops/operations/random_ops.py +1 -1
- mindspore/ops/operations/sparse_ops.py +3 -3
- mindspore/ops/primitive.py +2 -2
- mindspore/ops_generate/arg_dtype_cast.py +12 -3
- mindspore/ops_generate/arg_handler.py +24 -0
- mindspore/ops_generate/gen_ops_inner_prim.py +2 -0
- mindspore/ops_generate/gen_pyboost_func.py +13 -6
- mindspore/ops_generate/pyboost_utils.py +2 -17
- mindspore/parallel/__init__.py +3 -2
- mindspore/parallel/_auto_parallel_context.py +106 -1
- mindspore/parallel/_parallel_serialization.py +34 -2
- mindspore/parallel/_utils.py +16 -0
- mindspore/parallel/algo_parameter_config.py +4 -4
- mindspore/parallel/checkpoint_transform.py +249 -77
- mindspore/parallel/cluster/process_entity/_api.py +1 -1
- mindspore/parallel/parameter_broadcast.py +1 -1
- mindspore/parallel/shard.py +1 -1
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +1 -0
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +17 -5
- mindspore/profiler/parser/ascend_msprof_exporter.py +3 -3
- mindspore/profiler/parser/ascend_msprof_generator.py +10 -3
- mindspore/profiler/parser/ascend_op_generator.py +26 -9
- mindspore/profiler/parser/ascend_timeline_generator.py +7 -4
- mindspore/profiler/parser/profiler_info.py +11 -1
- mindspore/profiler/profiling.py +13 -5
- mindspore/rewrite/api/node.py +12 -12
- mindspore/rewrite/api/symbol_tree.py +11 -11
- mindspore/run_check/_check_version.py +1 -1
- mindspore/safeguard/rewrite_obfuscation.py +2 -2
- mindspore/train/amp.py +4 -4
- mindspore/train/anf_ir_pb2.py +8 -2
- mindspore/train/callback/_backup_and_restore.py +2 -2
- mindspore/train/callback/_callback.py +4 -4
- mindspore/train/callback/_checkpoint.py +2 -2
- mindspore/train/callback/_early_stop.py +2 -2
- mindspore/train/callback/_landscape.py +4 -4
- mindspore/train/callback/_loss_monitor.py +2 -2
- mindspore/train/callback/_on_request_exit.py +2 -2
- mindspore/train/callback/_reduce_lr_on_plateau.py +2 -2
- mindspore/train/callback/_summary_collector.py +2 -2
- mindspore/train/callback/_time_monitor.py +2 -2
- mindspore/train/dataset_helper.py +8 -3
- mindspore/train/loss_scale_manager.py +2 -2
- mindspore/train/metrics/metric.py +3 -3
- mindspore/train/mind_ir_pb2.py +22 -17
- mindspore/train/model.py +15 -15
- mindspore/train/serialization.py +18 -18
- mindspore/train/summary/summary_record.py +7 -7
- mindspore/train/train_thor/convert_utils.py +3 -3
- mindspore/version.py +1 -1
- {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +1 -1
- {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +307 -260
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/tiling_data.h +0 -59
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_bf16_BNSD_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_bf16_BSH_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_fp16_BNSD_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_fp16_BSH_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_bf16_BNSD_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_bf16_BSH_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_fp16_BNSD_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_fp16_BSH_mix.o +0 -0
- /mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/bs_attention_mix_hwsync.h → flash_attention_score/kernel/flash_attention_score_mix_hwsync.h} +0 -0
- {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
- {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
- {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,276 @@
|
|
|
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
|
+
|
|
17
|
+
/*!
|
|
18
|
+
* \file rms_norm.h
|
|
19
|
+
* \brief
|
|
20
|
+
*/
|
|
21
|
+
#ifndef _RMS_NORM_NORMAL_H_
|
|
22
|
+
#define _RMS_NORM_NORMAL_H_
|
|
23
|
+
#include "rms_norm_base.h"
|
|
24
|
+
|
|
25
|
+
using namespace AscendC;
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class KernelRmsNorm {
|
|
29
|
+
public:
|
|
30
|
+
__aicore__ inline KernelRmsNorm() {}
|
|
31
|
+
__aicore__ inline void Init(GM_ADDR x, GM_ADDR gamma, GM_ADDR y, GM_ADDR rstd, uint32_t num_row_, uint32_t num_col_,
|
|
32
|
+
uint32_t block_factor_, uint32_t row_factor_, uint32_t ub_factor_, float epsilon_,
|
|
33
|
+
float avg_factor_) {
|
|
34
|
+
ASSERT(GetBlockNum() != 0 && "block dim can not be zero!");
|
|
35
|
+
this->num_row = num_row_;
|
|
36
|
+
this->num_col = num_col_;
|
|
37
|
+
this->block_factor = block_factor_;
|
|
38
|
+
this->row_factor = row_factor_;
|
|
39
|
+
this->ub_factor = ub_factor_;
|
|
40
|
+
this->epsilon = epsilon_;
|
|
41
|
+
this->avg_factor = (float)1.0 / num_col;
|
|
42
|
+
|
|
43
|
+
if (GetBlockIdx() < GetBlockNum() - 1) {
|
|
44
|
+
this->row_work = block_factor;
|
|
45
|
+
} else if (GetBlockIdx() == GetBlockNum() - 1) {
|
|
46
|
+
this->row_work = num_row - (GetBlockNum() - 1) * block_factor;
|
|
47
|
+
} else {
|
|
48
|
+
}
|
|
49
|
+
// get start index for current core, core parallel
|
|
50
|
+
xGm.SetGlobalBuffer((__gm__ T *)x + GetBlockIdx() * block_factor * num_col, row_work * num_col);
|
|
51
|
+
gammaGm.SetGlobalBuffer((__gm__ T *)gamma, num_col);
|
|
52
|
+
yGm.SetGlobalBuffer((__gm__ T *)y + GetBlockIdx() * block_factor * num_col, row_work * num_col);
|
|
53
|
+
rstdGm.SetGlobalBuffer((__gm__ float *)rstd + GetBlockIdx() * block_factor, block_factor);
|
|
54
|
+
|
|
55
|
+
// pipe alloc memory to queue, the unit is Bytes
|
|
56
|
+
pipe.InitBuffer(inQueueX, BUFFER_NUM, ub_factor * sizeof(T));
|
|
57
|
+
pipe.InitBuffer(inQueueGamma, BUFFER_NUM, ub_factor * sizeof(T));
|
|
58
|
+
pipe.InitBuffer(outQueueY, BUFFER_NUM, ub_factor * sizeof(T));
|
|
59
|
+
pipe.InitBuffer(outQueueRstd, BUFFER_NUM, row_factor * sizeof(float));
|
|
60
|
+
|
|
61
|
+
if constexpr (is_same<T, half>::value || is_same<T, bfloat16_t>::value) {
|
|
62
|
+
pipe.InitBuffer(x_fp32_buf, ub_factor * sizeof(float));
|
|
63
|
+
}
|
|
64
|
+
pipe.InitBuffer(sqx_buf, ub_factor * sizeof(float));
|
|
65
|
+
pipe.InitBuffer(reduce_fp32_buf, NUM_PER_REP_FP32 * sizeof(float));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
__aicore__ inline void Process() {
|
|
69
|
+
CopyInGamma();
|
|
70
|
+
LocalTensor<T> gammaLocal = inQueueGamma.DeQue<T>();
|
|
71
|
+
|
|
72
|
+
uint32_t i_o_max = CeilDiv(row_work, row_factor);
|
|
73
|
+
uint32_t row_tail = row_work - (i_o_max - 1) * row_factor;
|
|
74
|
+
|
|
75
|
+
for (uint32_t i_o = 0; i_o < i_o_max - 1; i_o++) {
|
|
76
|
+
SubProcess(i_o, row_factor, gammaLocal);
|
|
77
|
+
}
|
|
78
|
+
SubProcess(i_o_max - 1, row_tail, gammaLocal);
|
|
79
|
+
inQueueGamma.FreeTensor(gammaLocal);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
__aicore__ inline void SubProcess(uint32_t i_o, uint32_t calc_row_num, LocalTensor<T> &gammaLocal) {
|
|
83
|
+
LocalTensor<float> rstdLocal = outQueueRstd.AllocTensor<float>();
|
|
84
|
+
for (uint32_t i_i = 0; i_i < calc_row_num; i_i++) {
|
|
85
|
+
uint32_t gm_bias = (i_o * row_factor + i_i) * num_col;
|
|
86
|
+
CopyIn(gm_bias);
|
|
87
|
+
Compute(i_i, gammaLocal, rstdLocal);
|
|
88
|
+
CopyOutY(gm_bias);
|
|
89
|
+
}
|
|
90
|
+
outQueueRstd.EnQue<float>(rstdLocal);
|
|
91
|
+
CopyOutRstd(i_o, calc_row_num);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private:
|
|
95
|
+
__aicore__ inline void CopyIn(uint32_t gm_bias) {
|
|
96
|
+
LocalTensor<T> xLocal = inQueueX.AllocTensor<T>();
|
|
97
|
+
DataCopyCustom<T>(xLocal, xGm[gm_bias], num_col);
|
|
98
|
+
inQueueX.EnQue(xLocal);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
__aicore__ inline void CopyInGamma() {
|
|
102
|
+
LocalTensor<T> gammaLocal = inQueueGamma.AllocTensor<T>();
|
|
103
|
+
DataCopyCustom<T>(gammaLocal, gammaGm, num_col);
|
|
104
|
+
inQueueGamma.EnQue(gammaLocal);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
__aicore__ inline void Compute(uint32_t inner_progress, LocalTensor<half> gammaLocal, LocalTensor<float> rstdLocal) {
|
|
108
|
+
LocalTensor<half> xLocal = inQueueX.DeQue<half>();
|
|
109
|
+
LocalTensor<float> x_fp32 = x_fp32_buf.Get<float>();
|
|
110
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
111
|
+
LocalTensor<float> reduce_buf_local = reduce_fp32_buf.Get<float>();
|
|
112
|
+
|
|
113
|
+
Cast(x_fp32, xLocal, RoundMode::CAST_NONE, num_col);
|
|
114
|
+
inQueueX.FreeTensor(xLocal);
|
|
115
|
+
pipe_barrier(PIPE_V);
|
|
116
|
+
|
|
117
|
+
Mul(sqx, x_fp32, x_fp32, num_col);
|
|
118
|
+
pipe_barrier(PIPE_V);
|
|
119
|
+
|
|
120
|
+
Muls(sqx, sqx, avg_factor, num_col);
|
|
121
|
+
pipe_barrier(PIPE_V);
|
|
122
|
+
|
|
123
|
+
ReduceSumCustom(sqx, sqx, reduce_buf_local, num_col);
|
|
124
|
+
pipe_barrier(PIPE_V);
|
|
125
|
+
|
|
126
|
+
Adds(sqx, sqx, epsilon, 1);
|
|
127
|
+
pipe_barrier(PIPE_V);
|
|
128
|
+
|
|
129
|
+
Sqrt(sqx, sqx, 1);
|
|
130
|
+
Duplicate(reduce_buf_local, ONE, 1);
|
|
131
|
+
pipe_barrier(PIPE_V);
|
|
132
|
+
Div(sqx, reduce_buf_local, sqx, 1);
|
|
133
|
+
pipe_barrier(PIPE_V);
|
|
134
|
+
set_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
135
|
+
wait_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
136
|
+
float rstd_value = sqx.GetValue(0);
|
|
137
|
+
set_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
138
|
+
wait_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
139
|
+
rstdLocal.SetValue(inner_progress, rstd_value);
|
|
140
|
+
pipe_barrier(PIPE_V);
|
|
141
|
+
Muls(x_fp32, x_fp32, rstd_value, num_col);
|
|
142
|
+
pipe_barrier(PIPE_V);
|
|
143
|
+
LocalTensor<half> yLocal = outQueueY.AllocTensor<half>();
|
|
144
|
+
Cast(yLocal, x_fp32, RoundMode::CAST_NONE, num_col);
|
|
145
|
+
pipe_barrier(PIPE_V);
|
|
146
|
+
Mul(yLocal, gammaLocal, yLocal, num_col);
|
|
147
|
+
pipe_barrier(PIPE_V);
|
|
148
|
+
outQueueY.EnQue<half>(yLocal);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
__aicore__ inline void Compute(uint32_t inner_progress, LocalTensor<float> gammaLocal, LocalTensor<float> rstdLocal) {
|
|
152
|
+
LocalTensor<float> xLocal = inQueueX.DeQue<float>();
|
|
153
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
154
|
+
LocalTensor<float> reduce_buf_local = reduce_fp32_buf.Get<float>();
|
|
155
|
+
Mul(sqx, xLocal, xLocal, num_col);
|
|
156
|
+
pipe_barrier(PIPE_V);
|
|
157
|
+
|
|
158
|
+
Muls(sqx, sqx, avg_factor, num_col);
|
|
159
|
+
pipe_barrier(PIPE_V);
|
|
160
|
+
|
|
161
|
+
ReduceSumCustom(sqx, sqx, reduce_buf_local, num_col);
|
|
162
|
+
pipe_barrier(PIPE_V);
|
|
163
|
+
Adds(sqx, sqx, epsilon, 1);
|
|
164
|
+
pipe_barrier(PIPE_V);
|
|
165
|
+
|
|
166
|
+
Sqrt(sqx, sqx, 1);
|
|
167
|
+
Duplicate(reduce_buf_local, ONE, 1);
|
|
168
|
+
pipe_barrier(PIPE_V);
|
|
169
|
+
Div(sqx, reduce_buf_local, sqx, 1);
|
|
170
|
+
pipe_barrier(PIPE_V);
|
|
171
|
+
set_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
172
|
+
wait_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
173
|
+
float rstd_value = sqx.GetValue(0);
|
|
174
|
+
set_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
175
|
+
wait_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
176
|
+
rstdLocal.SetValue(inner_progress, rstd_value);
|
|
177
|
+
pipe_barrier(PIPE_V);
|
|
178
|
+
LocalTensor<float> yLocal = outQueueY.AllocTensor<float>();
|
|
179
|
+
Muls(yLocal, xLocal, rstd_value, num_col);
|
|
180
|
+
inQueueX.FreeTensor(xLocal);
|
|
181
|
+
pipe_barrier(PIPE_V);
|
|
182
|
+
Mul(yLocal, gammaLocal, yLocal, num_col);
|
|
183
|
+
pipe_barrier(PIPE_V);
|
|
184
|
+
outQueueY.EnQue<float>(yLocal);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
__aicore__ inline void Compute(uint32_t inner_progress, LocalTensor<bfloat16_t> gammaLocal,
|
|
188
|
+
LocalTensor<float> rstdLocal) {
|
|
189
|
+
LocalTensor<bfloat16_t> xLocal = inQueueX.DeQue<bfloat16_t>();
|
|
190
|
+
LocalTensor<float> x_fp32 = x_fp32_buf.Get<float>();
|
|
191
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
192
|
+
LocalTensor<float> reduce_buf_local = reduce_fp32_buf.Get<float>();
|
|
193
|
+
|
|
194
|
+
Cast(x_fp32, xLocal, RoundMode::CAST_NONE, num_col);
|
|
195
|
+
inQueueX.FreeTensor(xLocal);
|
|
196
|
+
pipe_barrier(PIPE_V);
|
|
197
|
+
|
|
198
|
+
Mul(sqx, x_fp32, x_fp32, num_col);
|
|
199
|
+
pipe_barrier(PIPE_V);
|
|
200
|
+
|
|
201
|
+
Muls(sqx, sqx, avg_factor, num_col);
|
|
202
|
+
pipe_barrier(PIPE_V);
|
|
203
|
+
ReduceSumCustom(sqx, sqx, reduce_buf_local, num_col);
|
|
204
|
+
pipe_barrier(PIPE_V);
|
|
205
|
+
|
|
206
|
+
Adds(sqx, sqx, epsilon, 1);
|
|
207
|
+
pipe_barrier(PIPE_V);
|
|
208
|
+
|
|
209
|
+
Sqrt(sqx, sqx, 1);
|
|
210
|
+
Duplicate(reduce_buf_local, ONE, 1);
|
|
211
|
+
pipe_barrier(PIPE_V);
|
|
212
|
+
Div(sqx, reduce_buf_local, sqx, 1);
|
|
213
|
+
pipe_barrier(PIPE_V);
|
|
214
|
+
set_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
215
|
+
wait_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
216
|
+
float rstd_value = sqx.GetValue(0);
|
|
217
|
+
set_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
218
|
+
wait_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
219
|
+
rstdLocal.SetValue(inner_progress, rstd_value);
|
|
220
|
+
pipe_barrier(PIPE_V);
|
|
221
|
+
Muls(x_fp32, x_fp32, rstd_value, num_col);
|
|
222
|
+
pipe_barrier(PIPE_V);
|
|
223
|
+
LocalTensor<bfloat16_t> yLocal = outQueueY.AllocTensor<bfloat16_t>();
|
|
224
|
+
Cast(yLocal, x_fp32, RoundMode::CAST_RINT, num_col);
|
|
225
|
+
pipe_barrier(PIPE_V);
|
|
226
|
+
Cast(x_fp32, yLocal, RoundMode::CAST_NONE, num_col);
|
|
227
|
+
pipe_barrier(PIPE_V);
|
|
228
|
+
Cast(sqx, gammaLocal, RoundMode::CAST_NONE, num_col); // gamma_fp32 reuse sqx
|
|
229
|
+
pipe_barrier(PIPE_V);
|
|
230
|
+
Mul(x_fp32, x_fp32, sqx, num_col);
|
|
231
|
+
pipe_barrier(PIPE_V);
|
|
232
|
+
Cast(yLocal, x_fp32, RoundMode::CAST_RINT, num_col);
|
|
233
|
+
pipe_barrier(PIPE_V);
|
|
234
|
+
outQueueY.EnQue<bfloat16_t>(yLocal);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
__aicore__ inline void CopyOutY(uint32_t progress) {
|
|
238
|
+
LocalTensor<T> yLocal = outQueueY.DeQue<T>();
|
|
239
|
+
DataCopyCustom<T>(yGm[progress], yLocal, num_col);
|
|
240
|
+
outQueueY.FreeTensor(yLocal);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
__aicore__ inline void CopyOutRstd(uint32_t outer_progress, uint32_t num) {
|
|
244
|
+
LocalTensor<float> rstdLocal = outQueueRstd.DeQue<float>();
|
|
245
|
+
#if __CCE_AICORE__ == 220
|
|
246
|
+
DataCopyCustom<float>(rstdGm[outer_progress * row_factor], rstdLocal, num);
|
|
247
|
+
#endif
|
|
248
|
+
outQueueRstd.FreeTensor(rstdLocal);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
private:
|
|
252
|
+
TPipe pipe;
|
|
253
|
+
// create queues for input, in this case depth is equal to buffer num
|
|
254
|
+
TQue<QuePosition::VECIN, BUFFER_NUM> inQueueX, inQueueGamma;
|
|
255
|
+
// create queues for output, in this case depth is equal to buffer num
|
|
256
|
+
TQue<QuePosition::VECOUT, BUFFER_NUM> outQueueY, outQueueRstd;
|
|
257
|
+
|
|
258
|
+
TBuf<TPosition::VECCALC> x_fp32_buf;
|
|
259
|
+
TBuf<TPosition::VECCALC> sqx_buf;
|
|
260
|
+
TBuf<TPosition::VECCALC> reduce_fp32_buf;
|
|
261
|
+
GlobalTensor<T> xGm;
|
|
262
|
+
GlobalTensor<T> gammaGm;
|
|
263
|
+
GlobalTensor<T> yGm;
|
|
264
|
+
GlobalTensor<float> rstdGm;
|
|
265
|
+
|
|
266
|
+
uint32_t num_row;
|
|
267
|
+
uint32_t num_col;
|
|
268
|
+
uint32_t block_factor; // number of calculations rows on each core
|
|
269
|
+
uint32_t row_factor;
|
|
270
|
+
uint32_t ub_factor;
|
|
271
|
+
float epsilon;
|
|
272
|
+
float avg_factor;
|
|
273
|
+
|
|
274
|
+
uint32_t row_work = 1;
|
|
275
|
+
};
|
|
276
|
+
#endif // RMS_NORM_H_
|
|
@@ -0,0 +1,280 @@
|
|
|
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
|
+
|
|
17
|
+
/*!
|
|
18
|
+
* \file rms_norm_split_d.h
|
|
19
|
+
* \brief
|
|
20
|
+
*/
|
|
21
|
+
#ifndef _RMS_NORM_SPLIT_D_H_
|
|
22
|
+
#define _RMS_NORM_SPLIT_D_H_
|
|
23
|
+
#include "rms_norm_base.h"
|
|
24
|
+
|
|
25
|
+
using namespace AscendC;
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class KernelRmsNormSplitD {
|
|
29
|
+
public:
|
|
30
|
+
__aicore__ inline KernelRmsNormSplitD() {}
|
|
31
|
+
__aicore__ inline void Init(GM_ADDR x, GM_ADDR gamma, GM_ADDR y, GM_ADDR rstd, uint32_t num_row_, uint32_t num_col_,
|
|
32
|
+
uint32_t block_factor_, uint32_t row_factor_, uint32_t ub_factor_, float epsilon_,
|
|
33
|
+
float avg_factor_) {
|
|
34
|
+
ASSERT(GetBlockNum() != 0 && "block dim can not be zero!");
|
|
35
|
+
this->num_row = num_row_;
|
|
36
|
+
this->num_col = num_col_;
|
|
37
|
+
this->block_factor = block_factor_;
|
|
38
|
+
this->row_factor = row_factor_;
|
|
39
|
+
this->ub_factor = ub_factor_;
|
|
40
|
+
this->epsilon = epsilon_;
|
|
41
|
+
this->avg_factor = (float)1.0 / num_col;
|
|
42
|
+
|
|
43
|
+
if (GetBlockIdx() < GetBlockNum() - 1) {
|
|
44
|
+
this->row_work = block_factor;
|
|
45
|
+
} else if (GetBlockIdx() == GetBlockNum() - 1) {
|
|
46
|
+
this->row_work = num_row - (GetBlockNum() - 1) * block_factor;
|
|
47
|
+
} else {
|
|
48
|
+
}
|
|
49
|
+
// get start index for current core, core parallel
|
|
50
|
+
xGm.SetGlobalBuffer((__gm__ T *)x + GetBlockIdx() * block_factor * num_col, row_work * num_col);
|
|
51
|
+
gammaGm.SetGlobalBuffer((__gm__ T *)gamma, num_col);
|
|
52
|
+
yGm.SetGlobalBuffer((__gm__ T *)y + GetBlockIdx() * block_factor * num_col, row_work * num_col);
|
|
53
|
+
rstdGm.SetGlobalBuffer((__gm__ float *)rstd + GetBlockIdx() * block_factor, block_factor);
|
|
54
|
+
|
|
55
|
+
// pipe alloc memory to queue, the unit is Bytes
|
|
56
|
+
pipe.InitBuffer(inQueueX, BUFFER_NUM, ub_factor * sizeof(T));
|
|
57
|
+
pipe.InitBuffer(inQueueGamma, BUFFER_NUM, ub_factor * sizeof(T));
|
|
58
|
+
pipe.InitBuffer(outQueueY, BUFFER_NUM, ub_factor * sizeof(T));
|
|
59
|
+
pipe.InitBuffer(outQueueRstd, BUFFER_NUM, row_factor * sizeof(float));
|
|
60
|
+
|
|
61
|
+
if constexpr (is_same<T, half>::value || is_same<T, bfloat16_t>::value) {
|
|
62
|
+
pipe.InitBuffer(x_fp32_buf, ub_factor * sizeof(float));
|
|
63
|
+
}
|
|
64
|
+
pipe.InitBuffer(sqx_buf, ub_factor * sizeof(float));
|
|
65
|
+
pipe.InitBuffer(sum_buf, row_factor * NUM_PER_BLK_FP32 * sizeof(float));
|
|
66
|
+
pipe.InitBuffer(reduce_fp32_buf, NUM_PER_REP_FP32 * sizeof(float));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
__aicore__ inline void Process() {
|
|
70
|
+
uint32_t i_o_max = CeilDiv(row_work, row_factor);
|
|
71
|
+
uint32_t row_tail = row_work - (i_o_max - 1) * row_factor;
|
|
72
|
+
uint32_t j_max = CeilDiv(num_col, ub_factor);
|
|
73
|
+
uint32_t col_tail = num_col - (j_max - 1) * ub_factor;
|
|
74
|
+
for (uint32_t i_o = 0; i_o < i_o_max - 1; i_o++) {
|
|
75
|
+
SubProcess(i_o, row_factor, j_max, col_tail);
|
|
76
|
+
}
|
|
77
|
+
SubProcess(i_o_max - 1, row_tail, j_max, col_tail);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
__aicore__ inline void SubProcess(uint32_t i_o, uint32_t calc_row_num, uint32_t j_max, uint32_t col_tail) {
|
|
81
|
+
LocalTensor<float> sumLocal = sum_buf.Get<float>();
|
|
82
|
+
|
|
83
|
+
LocalTensor<float> rstdLocal = outQueueRstd.AllocTensor<float>();
|
|
84
|
+
Duplicate(rstdLocal, (float)0.0, calc_row_num);
|
|
85
|
+
pipe_barrier(PIPE_V);
|
|
86
|
+
for (uint32_t j = 0; j < j_max - 1; j++) {
|
|
87
|
+
ComputeFormer(i_o, calc_row_num, j, rstdLocal, sumLocal, ub_factor);
|
|
88
|
+
}
|
|
89
|
+
// do tail
|
|
90
|
+
ComputeFormer(i_o, calc_row_num, j_max - 1, rstdLocal, sumLocal, col_tail);
|
|
91
|
+
ComputeRstd(rstdLocal, calc_row_num);
|
|
92
|
+
|
|
93
|
+
for (uint32_t j = 0; j < j_max - 1; j++) {
|
|
94
|
+
ComputeLatter(i_o, calc_row_num, j, rstdLocal, ub_factor);
|
|
95
|
+
}
|
|
96
|
+
ComputeLatter(i_o, calc_row_num, j_max - 1, rstdLocal, col_tail);
|
|
97
|
+
outQueueRstd.EnQue<float>(rstdLocal);
|
|
98
|
+
CopyOutRstd(i_o, calc_row_num);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private:
|
|
102
|
+
__aicore__ inline void CopyIn(uint32_t i_idx, uint32_t j_idx, uint32_t num) {
|
|
103
|
+
LocalTensor<T> xLocal = inQueueX.AllocTensor<T>();
|
|
104
|
+
DataCopyCustom<T>(xLocal, xGm[i_idx * num_col + j_idx * ub_factor], num);
|
|
105
|
+
inQueueX.EnQue(xLocal);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
__aicore__ inline void ComputeFormer(uint32_t i_o_idx, uint32_t calc_row_num, uint32_t j_idx,
|
|
109
|
+
LocalTensor<float> &rstdLocal, LocalTensor<float> &sumLocal, uint32_t num) {
|
|
110
|
+
for (uint32_t i_i = 0; i_i < calc_row_num; i_i++) {
|
|
111
|
+
CopyIn(i_o_idx * row_factor + i_i, j_idx, num);
|
|
112
|
+
ComputeSum(i_i, sumLocal, num);
|
|
113
|
+
}
|
|
114
|
+
BlockReduceSumFP32(sumLocal, sumLocal, calc_row_num * NUM_PER_BLK_FP32);
|
|
115
|
+
Add(rstdLocal, rstdLocal, sumLocal, calc_row_num);
|
|
116
|
+
pipe_barrier(PIPE_V);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
__aicore__ inline void ComputeSum(uint32_t i_i_idx, LocalTensor<float> &sumLocal, uint32_t num) {
|
|
120
|
+
LocalTensor<T> xLocal = inQueueX.DeQue<T>();
|
|
121
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
122
|
+
LocalTensor<float> reduce_buf_local = reduce_fp32_buf.Get<float>();
|
|
123
|
+
if constexpr (is_same<T, half>::value || is_same<T, bfloat16_t>::value) {
|
|
124
|
+
LocalTensor<float> x_fp32 = x_fp32_buf.Get<float>();
|
|
125
|
+
Cast(x_fp32, xLocal, RoundMode::CAST_NONE, num);
|
|
126
|
+
inQueueX.FreeTensor(xLocal);
|
|
127
|
+
pipe_barrier(PIPE_V);
|
|
128
|
+
Mul(sqx, x_fp32, x_fp32, num);
|
|
129
|
+
} else {
|
|
130
|
+
Mul(sqx, xLocal, xLocal, num);
|
|
131
|
+
inQueueX.FreeTensor(xLocal);
|
|
132
|
+
}
|
|
133
|
+
pipe_barrier(PIPE_V);
|
|
134
|
+
Muls(sqx, sqx, avg_factor, num);
|
|
135
|
+
pipe_barrier(PIPE_V);
|
|
136
|
+
ReduceSumFP32ToBlock(sumLocal[i_i_idx * 8], sqx, reduce_buf_local, num);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
__aicore__ inline void ComputeRstd(LocalTensor<float> rstdLocal, uint32_t num) {
|
|
140
|
+
LocalTensor<float> reduce_buf_local = reduce_fp32_buf.Get<float>();
|
|
141
|
+
Adds(rstdLocal, rstdLocal, epsilon, num);
|
|
142
|
+
pipe_barrier(PIPE_V);
|
|
143
|
+
Sqrt(rstdLocal, rstdLocal, num);
|
|
144
|
+
Duplicate(reduce_buf_local, ONE, num);
|
|
145
|
+
pipe_barrier(PIPE_V);
|
|
146
|
+
Div(rstdLocal, reduce_buf_local, rstdLocal, num);
|
|
147
|
+
pipe_barrier(PIPE_V);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
__aicore__ inline void ComputeLatter(uint32_t i_o_idx, uint32_t calc_row_num, uint32_t j_idx,
|
|
151
|
+
LocalTensor<float> &rstdLocal, uint32_t num) {
|
|
152
|
+
CopyInGamma(j_idx, num);
|
|
153
|
+
LocalTensor<T> gammaLocal = inQueueGamma.DeQue<T>();
|
|
154
|
+
for (uint32_t i_i = 0; i_i < calc_row_num; i_i++) {
|
|
155
|
+
CopyIn(i_o_idx * row_factor + i_i, j_idx, num);
|
|
156
|
+
ComputeY(i_i, gammaLocal, rstdLocal, num);
|
|
157
|
+
CopyOutY(i_o_idx * row_factor + i_i, j_idx, num);
|
|
158
|
+
}
|
|
159
|
+
inQueueGamma.FreeTensor(gammaLocal);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
__aicore__ inline void CopyInGamma(uint32_t j_idx, uint32_t num) {
|
|
163
|
+
LocalTensor<T> gammaLocal = inQueueGamma.AllocTensor<T>();
|
|
164
|
+
DataCopyCustom<T>(gammaLocal, gammaGm[j_idx * ub_factor], num);
|
|
165
|
+
inQueueGamma.EnQue(gammaLocal);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
__aicore__ inline void ComputeY(uint32_t i_i_idx, LocalTensor<half> &gammaLocal, LocalTensor<float> &rstdLocal,
|
|
169
|
+
uint32_t num) {
|
|
170
|
+
LocalTensor<half> xLocal = inQueueX.DeQue<half>();
|
|
171
|
+
LocalTensor<float> x_fp32 = x_fp32_buf.Get<float>();
|
|
172
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
173
|
+
set_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
174
|
+
wait_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
175
|
+
float rstd_value = rstdLocal.GetValue(i_i_idx);
|
|
176
|
+
set_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
177
|
+
wait_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
178
|
+
Cast(x_fp32, xLocal, RoundMode::CAST_NONE, num);
|
|
179
|
+
inQueueX.FreeTensor(xLocal);
|
|
180
|
+
pipe_barrier(PIPE_V);
|
|
181
|
+
Muls(x_fp32, x_fp32, rstd_value, num);
|
|
182
|
+
pipe_barrier(PIPE_V);
|
|
183
|
+
LocalTensor<half> yLocal = outQueueY.AllocTensor<half>();
|
|
184
|
+
Cast(yLocal, x_fp32, RoundMode::CAST_NONE, num);
|
|
185
|
+
pipe_barrier(PIPE_V);
|
|
186
|
+
Mul(yLocal, gammaLocal, yLocal, num);
|
|
187
|
+
pipe_barrier(PIPE_V);
|
|
188
|
+
outQueueY.EnQue<half>(yLocal);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
__aicore__ inline void ComputeY(uint32_t i_i_idx, LocalTensor<float> &gammaLocal, LocalTensor<float> &rstdLocal,
|
|
192
|
+
uint32_t num) {
|
|
193
|
+
LocalTensor<float> xLocal = inQueueX.DeQue<float>();
|
|
194
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
195
|
+
set_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
196
|
+
wait_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
197
|
+
float rstd_value = rstdLocal.GetValue(i_i_idx);
|
|
198
|
+
set_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
199
|
+
wait_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
200
|
+
LocalTensor<float> yLocal = outQueueY.AllocTensor<float>();
|
|
201
|
+
Muls(yLocal, xLocal, rstd_value, num);
|
|
202
|
+
inQueueX.FreeTensor(xLocal);
|
|
203
|
+
pipe_barrier(PIPE_V);
|
|
204
|
+
Mul(yLocal, gammaLocal, yLocal, num);
|
|
205
|
+
pipe_barrier(PIPE_V);
|
|
206
|
+
outQueueY.EnQue<float>(yLocal);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
__aicore__ inline void ComputeY(uint32_t i_i_idx, LocalTensor<bfloat16_t> &gammaLocal, LocalTensor<float> &rstdLocal,
|
|
210
|
+
uint32_t num) {
|
|
211
|
+
LocalTensor<bfloat16_t> xLocal = inQueueX.DeQue<bfloat16_t>();
|
|
212
|
+
LocalTensor<float> x_fp32 = x_fp32_buf.Get<float>();
|
|
213
|
+
LocalTensor<float> sqx = sqx_buf.Get<float>();
|
|
214
|
+
set_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
215
|
+
wait_flag(PIPE_V, PIPE_S, EVENT_ID0);
|
|
216
|
+
float rstd_value = rstdLocal.GetValue(i_i_idx);
|
|
217
|
+
set_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
218
|
+
wait_flag(PIPE_S, PIPE_V, EVENT_ID0);
|
|
219
|
+
Cast(x_fp32, xLocal, RoundMode::CAST_NONE, num);
|
|
220
|
+
inQueueX.FreeTensor(xLocal);
|
|
221
|
+
pipe_barrier(PIPE_V);
|
|
222
|
+
Muls(x_fp32, x_fp32, rstd_value, num);
|
|
223
|
+
pipe_barrier(PIPE_V);
|
|
224
|
+
LocalTensor<bfloat16_t> yLocal = outQueueY.AllocTensor<bfloat16_t>();
|
|
225
|
+
Cast(yLocal, x_fp32, RoundMode::CAST_RINT, num);
|
|
226
|
+
pipe_barrier(PIPE_V);
|
|
227
|
+
Cast(x_fp32, yLocal, RoundMode::CAST_NONE, num);
|
|
228
|
+
pipe_barrier(PIPE_V);
|
|
229
|
+
Cast(sqx, gammaLocal, RoundMode::CAST_NONE, num);
|
|
230
|
+
pipe_barrier(PIPE_V);
|
|
231
|
+
Mul(x_fp32, x_fp32, sqx, num);
|
|
232
|
+
pipe_barrier(PIPE_V);
|
|
233
|
+
Cast(yLocal, x_fp32, RoundMode::CAST_RINT, num);
|
|
234
|
+
pipe_barrier(PIPE_V);
|
|
235
|
+
outQueueY.EnQue<bfloat16_t>(yLocal);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
__aicore__ inline void CopyOutY(uint32_t i_idx, uint32_t j_idx, uint32_t num) {
|
|
239
|
+
LocalTensor<T> yLocal = outQueueY.DeQue<T>();
|
|
240
|
+
DataCopyCustom<T>(yGm[i_idx * num_col + j_idx * ub_factor], yLocal, num);
|
|
241
|
+
outQueueY.FreeTensor(yLocal);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
__aicore__ inline void CopyOutRstd(uint32_t i_o_idx, uint32_t num) {
|
|
245
|
+
LocalTensor<float> rstdLocal = outQueueRstd.DeQue<float>();
|
|
246
|
+
#if __CCE_AICORE__ == 220
|
|
247
|
+
DataCopyCustom<float>(rstdGm[i_o_idx * row_factor], rstdLocal, num);
|
|
248
|
+
#endif
|
|
249
|
+
outQueueRstd.FreeTensor(rstdLocal);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private:
|
|
253
|
+
TPipe pipe;
|
|
254
|
+
// create queues for input, in this case depth is equal to buffer num
|
|
255
|
+
TQue<QuePosition::VECIN, BUFFER_NUM> inQueueX, inQueueGamma;
|
|
256
|
+
// create queues for output, in this case depth is equal to buffer num
|
|
257
|
+
TQue<QuePosition::VECOUT, BUFFER_NUM> outQueueY, outQueueRstd;
|
|
258
|
+
TBuf<TPosition::VECCALC> x_fp32_buf;
|
|
259
|
+
TBuf<TPosition::VECCALC> sqx_buf;
|
|
260
|
+
TBuf<TPosition::VECCALC> sum_buf;
|
|
261
|
+
TBuf<TPosition::VECCALC> reduce_fp32_buf;
|
|
262
|
+
|
|
263
|
+
GlobalTensor<T> xGm;
|
|
264
|
+
GlobalTensor<T> gammaGm;
|
|
265
|
+
GlobalTensor<T> yGm;
|
|
266
|
+
GlobalTensor<float> rstdGm;
|
|
267
|
+
|
|
268
|
+
uint32_t num_row;
|
|
269
|
+
uint32_t num_col;
|
|
270
|
+
uint32_t block_factor; // number of calculations rows on each core
|
|
271
|
+
uint32_t row_factor;
|
|
272
|
+
uint32_t ub_factor;
|
|
273
|
+
float epsilon;
|
|
274
|
+
float avg_factor;
|
|
275
|
+
|
|
276
|
+
uint32_t row_work = 1;
|
|
277
|
+
|
|
278
|
+
int tempbuf_num;
|
|
279
|
+
};
|
|
280
|
+
#endif // _RMS_NORM_SPLIT_D_H_
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
|
|
17
|
+
#ifndef MS_KERNELS_INTERNAL_KERNEL_ASCENDC_RMSNORM_TILING_DATA_H_
|
|
18
|
+
#define MS_KERNELS_INTERNAL_KERNEL_ASCENDC_RMSNORM_TILING_DATA_H_
|
|
19
|
+
|
|
20
|
+
#pragma pack(1)
|
|
21
|
+
|
|
22
|
+
struct RmsNormTilingData {
|
|
23
|
+
uint32_t num_row = 0;
|
|
24
|
+
uint32_t num_col = 0;
|
|
25
|
+
uint32_t block_factor = 0;
|
|
26
|
+
uint32_t row_factor = 0;
|
|
27
|
+
uint32_t ub_factor = 0;
|
|
28
|
+
float epsilon = 0;
|
|
29
|
+
float avg_factor = 0;
|
|
30
|
+
uint32_t tiling_key = 0;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
#pragma pack()
|
|
34
|
+
|
|
35
|
+
#endif
|
mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
#ifndef MS_KERNELS_INTERNAL_KERNEL_RMS_NORM_H_
|
|
17
|
+
#define MS_KERNELS_INTERNAL_KERNEL_RMS_NORM_H_
|
|
18
|
+
|
|
19
|
+
#include "include/internal_kernel.h"
|
|
20
|
+
#include <vector>
|
|
21
|
+
|
|
22
|
+
namespace mindspore {
|
|
23
|
+
namespace internal {
|
|
24
|
+
class RmsNormImpl : public InternelKernelImpl {
|
|
25
|
+
public:
|
|
26
|
+
RmsNormImpl(const OpParamPtr ¶m) : InternelKernelImpl(param) {}
|
|
27
|
+
virtual ~RmsNormImpl() {}
|
|
28
|
+
bool Init(const ValidateInfo &info) override;
|
|
29
|
+
void SetWorkSpace(const std::vector<DeviceRawBuf> &workspace) override;
|
|
30
|
+
void SetDeviceTilingBuf(const DeviceRawBuf &tilingBuf) override;
|
|
31
|
+
int Launch() override;
|
|
32
|
+
uint64_t GetTilingBufSize() override;
|
|
33
|
+
int Tiling(HostRawBuf &tilingBuf) override;
|
|
34
|
+
std::vector<uint64_t> GetWorkSpaceSize() override;
|
|
35
|
+
int InferShape(const std::vector<DIMS> &input_shapes, std::vector<DIMS> &output_shapes) override;
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
std::vector<DeviceRawBuf> inputs_device_buf_;
|
|
39
|
+
std::vector<DeviceRawBuf> outputs_device_buf_;
|
|
40
|
+
void *workspace_addr = nullptr;
|
|
41
|
+
DeviceRawBuf tiling_buf_;
|
|
42
|
+
};
|
|
43
|
+
} // namespace internal
|
|
44
|
+
} // namespace mindspore
|
|
45
|
+
#endif
|
mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/kernel/sub_kernel.h
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
17
|
+
#ifndef MS_KERNELS_INTERNAL_KERNEL_ASCENDC_SUB_KERNEL_H_
|
|
18
|
+
#define MS_KERNELS_INTERNAL_KERNEL_ASCENDC_SUB_KERNEL_H_
|
|
19
|
+
void sub_op(uint32_t blockDim, void *l2ctrl, void *stream, uint8_t *in1, uint8_t *in2, uint8_t *out, uint8_t *tiling);
|
|
20
|
+
#endif // MS_KERNELS_INTERNAL_KERNEL_ASCENDC_SUB_KERNEL_H_
|