From 39676f2a40213fb342f675e4cb2641be1a4c4882 Mon Sep 17 00:00:00 2001 From: Chen Ning Date: Wed, 15 Oct 2025 08:57:16 +0000 Subject: [PATCH 1/2] =?UTF-8?q?!690=20add=20new=20namespace=20to=20"Ascend?= =?UTF-8?q?C::tiling"=20to=20adv=20tiling=20api=20and=20ensure=20th?= =?UTF-8?q?=E2=80=A6=20Merge=20pull=20request=20!690=20from=20Chen=20Ning/?= =?UTF-8?q?master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/scripts/gen_kernel_tiling_data_def.py | 56 ++++++++++++++++++- .../gelu/test_operator_fast_gelu.cpp | 2 +- .../gelu/test_operator_fast_gelu_v2.cpp | 2 +- tests/activation/gelu/test_operator_gelu.cpp | 2 +- tests/activation/silu/test_operator_silu.cpp | 2 +- .../softmax/test_operator_softmax_v220.cpp | 2 +- .../softmax/test_operator_softmax_v300.cpp | 2 +- .../test_operator_softmaxflashv3_v220.cpp | 2 +- .../activation/swish/test_operator_swish.cpp | 2 +- .../filter/dropout/test_operator_dropout.cpp | 2 +- .../test_operator_arithprogression.cpp | 2 +- .../exp/test_operator_exphighprecision.cpp | 2 +- .../batchnorm/test_operator_batchnorm.cpp | 2 +- .../deepnorm/test_operator_deepnorm.cpp | 2 +- .../groupnorm/test_operator_groupnorm.cpp | 2 +- .../layernorm/test_operator_layernorm.cpp | 2 +- .../layernorm/test_operator_layernormgrad.cpp | 2 +- .../test_operator_layernormgradbeta.cpp | 2 +- .../layernormV2/test_operator_layernormV2.cpp | 2 +- .../normalize/test_operator_normalize.cpp | 2 +- .../rmsnorm/test_operator_rmsnorm.cpp | 2 +- .../test_operator_welfordfinalize.cpp | 2 +- .../test_operator_welfordupdate.cpp | 2 +- tests/pad/pad/test_operator_pad.cpp | 2 +- .../antiquant/test_ascend_antiquant.cpp | 2 +- .../test_ascend_antiquant_scalar.cpp | 2 +- .../test_ascend_antiquant_weight.cpp | 2 +- .../test_ascend_antiquant_weight_scalar.cpp | 2 +- tests/reduce/mean/test_operator_mean.cpp | 2 +- tests/reduce/sum/test_operator_sum.cpp | 2 +- tests/sort/topk/test_operator_topk.cpp | 2 +- .../test_operator_confusion_transpose.cpp | 2 +- 32 files changed, 84 insertions(+), 34 deletions(-) diff --git a/cmake/scripts/gen_kernel_tiling_data_def.py b/cmake/scripts/gen_kernel_tiling_data_def.py index 22394286..c8e08618 100644 --- a/cmake/scripts/gen_kernel_tiling_data_def.py +++ b/cmake/scripts/gen_kernel_tiling_data_def.py @@ -15,13 +15,52 @@ import os import re +_NAMESPACE = "AscendC::tiling" +_LEGACY_TILING_STRUCTS = [ + "LogSoftMaxTiling", + "SoftMaxTiling", + "TConv3DApiTiling", + "TConv3DBpFilterTiling", + "Conv3DBpFilterParams", + "TConv3DBpFilterBasicBlockTiling", + "Conv3DBackpropFilterTilingData", + "TConv3DBackpropInputTiling", + "Conv3DBackpropInputTilingData", + "Mc2ServerCfg", + "Mc2HcommCfg", + "Mc2InitTiling", + "Mc2CcTiling", + "TCubeTiling", + "BatchNormTiling", + "DeepNormTiling", + "GroupNormTiling", + "LayerNormGradBetaTiling", + "LayerNormGradTiling", + "LayerNormTiling", + "LayerNormSeparateTiling", + "RmsNormTiling", + "UnPadTiling", + "PadTiling", + "TopkTiling", + "ConfusionTransposeTiling" +] + + def gen_tiling(tiling_header_file): single_tiling_source = "" + single_legacy_tiling_export = "" if not os.path.exists(tiling_header_file): print("warning: no userdef tiling header file: ", tiling_header_file) return single_tiling_source print("generate tiling def header file: ", tiling_header_file) pattern = re.compile(r'[(](.*)[)]', re.S) + + def parse_legacy_tiling(struct_def): + # export legacy tiling structs with 'using namespace' to ensure compatibility + nonlocal single_legacy_tiling_export + if struct_def in _LEGACY_TILING_STRUCTS: + single_legacy_tiling_export += f"using {_NAMESPACE}::{struct_def};\n" + with open(tiling_header_file, 'r') as fd: lines = fd.readlines() for line in lines: @@ -29,8 +68,9 @@ def gen_tiling(tiling_header_file): if (line.startswith('BEGIN_TILING_DATA_DEF')): single_tiling_source += '#pragma pack(push, 8)\n' single_tiling_source += 'struct ' - struct_def = re.findall(pattern, line)[0] + struct_def = re.findall(pattern, line)[0] single_tiling_source += struct_def + ' {\n' + parse_legacy_tiling(struct_def) elif (line.startswith('TILING_DATA_FIELD_DEF_ARR')): field_params = re.findall(pattern, line)[0] fds = field_params.split(',') @@ -46,7 +86,7 @@ def gen_tiling(tiling_header_file): elif (line.startswith('END_TILING_DATA_DEF')): single_tiling_source += '};\n' single_tiling_source += '#pragma pack(pop)\n' - return single_tiling_source + return single_tiling_source, single_legacy_tiling_export @@ -62,6 +102,7 @@ if __name__ == '__main__': #endif """ + res += "namespace AscendC {\nnamespace tiling {\n" print("[LOG]: ", sys.argv[1], sys.argv[2], sys.argv[3]) src_tiling_data_path = sys.argv[1] file_list = [] @@ -79,8 +120,17 @@ if __name__ == '__main__': if file.endswith("tilingdata.h") and file not in file_set: file_list.append(os.path.join(root, file)) file_list.sort() + + tiling_source = "" + legacy_tiling_export = "" for file in file_list: - res += gen_tiling(file) + src, exp = gen_tiling(file) + tiling_source += src + legacy_tiling_export += exp + + res += tiling_source + "} // namespace tiling\n} // namespace AscendC\n\n" + res += legacy_tiling_export + res += '#endif\n' generate_file = sys.argv[3] diff --git a/tests/activation/gelu/test_operator_fast_gelu.cpp b/tests/activation/gelu/test_operator_fast_gelu.cpp index ec97dba5..d15dcfb2 100644 --- a/tests/activation/gelu/test_operator_fast_gelu.cpp +++ b/tests/activation/gelu/test_operator_fast_gelu.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/activation/gelu/test_operator_fast_gelu_v2.cpp b/tests/activation/gelu/test_operator_fast_gelu_v2.cpp index f4d98b55..6974cdd1 100644 --- a/tests/activation/gelu/test_operator_fast_gelu_v2.cpp +++ b/tests/activation/gelu/test_operator_fast_gelu_v2.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/activation/gelu/test_operator_gelu.cpp b/tests/activation/gelu/test_operator_gelu.cpp index 387727a0..c668d659 100644 --- a/tests/activation/gelu/test_operator_gelu.cpp +++ b/tests/activation/gelu/test_operator_gelu.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/activation/silu/test_operator_silu.cpp b/tests/activation/silu/test_operator_silu.cpp index a001b04e..ad7eeb15 100644 --- a/tests/activation/silu/test_operator_silu.cpp +++ b/tests/activation/silu/test_operator_silu.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/activation/softmax/test_operator_softmax_v220.cpp b/tests/activation/softmax/test_operator_softmax_v220.cpp index 1261bd04..c7eacc53 100644 --- a/tests/activation/softmax/test_operator_softmax_v220.cpp +++ b/tests/activation/softmax/test_operator_softmax_v220.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" #include diff --git a/tests/activation/softmax/test_operator_softmax_v300.cpp b/tests/activation/softmax/test_operator_softmax_v300.cpp index d154acdf..c8e2e781 100644 --- a/tests/activation/softmax/test_operator_softmax_v300.cpp +++ b/tests/activation/softmax/test_operator_softmax_v300.cpp @@ -3,7 +3,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" #include diff --git a/tests/activation/softmax/test_operator_softmaxflashv3_v220.cpp b/tests/activation/softmax/test_operator_softmaxflashv3_v220.cpp index c93705e4..84f0888f 100644 --- a/tests/activation/softmax/test_operator_softmaxflashv3_v220.cpp +++ b/tests/activation/softmax/test_operator_softmaxflashv3_v220.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" #include diff --git a/tests/activation/swish/test_operator_swish.cpp b/tests/activation/swish/test_operator_swish.cpp index 9e9103f3..e37a5b66 100644 --- a/tests/activation/swish/test_operator_swish.cpp +++ b/tests/activation/swish/test_operator_swish.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/filter/dropout/test_operator_dropout.cpp b/tests/filter/dropout/test_operator_dropout.cpp index 7e7b9f41..32dd61b4 100644 --- a/tests/filter/dropout/test_operator_dropout.cpp +++ b/tests/filter/dropout/test_operator_dropout.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/index/arithprogression/test_operator_arithprogression.cpp b/tests/index/arithprogression/test_operator_arithprogression.cpp index ca52d8a2..9ac8d53f 100644 --- a/tests/index/arithprogression/test_operator_arithprogression.cpp +++ b/tests/index/arithprogression/test_operator_arithprogression.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/math/exp/test_operator_exphighprecision.cpp b/tests/math/exp/test_operator_exphighprecision.cpp index 882199b2..e0bbe7a5 100644 --- a/tests/math/exp/test_operator_exphighprecision.cpp +++ b/tests/math/exp/test_operator_exphighprecision.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" diff --git a/tests/normalization/batchnorm/test_operator_batchnorm.cpp b/tests/normalization/batchnorm/test_operator_batchnorm.cpp index e255c926..facee7f5 100644 --- a/tests/normalization/batchnorm/test_operator_batchnorm.cpp +++ b/tests/normalization/batchnorm/test_operator_batchnorm.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/deepnorm/test_operator_deepnorm.cpp b/tests/normalization/deepnorm/test_operator_deepnorm.cpp index bbc72b7f..c6c1e943 100644 --- a/tests/normalization/deepnorm/test_operator_deepnorm.cpp +++ b/tests/normalization/deepnorm/test_operator_deepnorm.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" diff --git a/tests/normalization/groupnorm/test_operator_groupnorm.cpp b/tests/normalization/groupnorm/test_operator_groupnorm.cpp index 7dd522b9..71f98669 100644 --- a/tests/normalization/groupnorm/test_operator_groupnorm.cpp +++ b/tests/normalization/groupnorm/test_operator_groupnorm.cpp @@ -15,7 +15,7 @@ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/layernorm/test_operator_layernorm.cpp b/tests/normalization/layernorm/test_operator_layernorm.cpp index 5875945b..a3bc7836 100644 --- a/tests/normalization/layernorm/test_operator_layernorm.cpp +++ b/tests/normalization/layernorm/test_operator_layernorm.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/layernorm/test_operator_layernormgrad.cpp b/tests/normalization/layernorm/test_operator_layernormgrad.cpp index fab91ded..81765f38 100644 --- a/tests/normalization/layernorm/test_operator_layernormgrad.cpp +++ b/tests/normalization/layernorm/test_operator_layernormgrad.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/layernorm/test_operator_layernormgradbeta.cpp b/tests/normalization/layernorm/test_operator_layernormgradbeta.cpp index 21dd3578..30d827cb 100644 --- a/tests/normalization/layernorm/test_operator_layernormgradbeta.cpp +++ b/tests/normalization/layernorm/test_operator_layernormgradbeta.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/layernormV2/test_operator_layernormV2.cpp b/tests/normalization/layernormV2/test_operator_layernormV2.cpp index 0af89bd9..fe25a875 100644 --- a/tests/normalization/layernormV2/test_operator_layernormV2.cpp +++ b/tests/normalization/layernormV2/test_operator_layernormV2.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/normalize/test_operator_normalize.cpp b/tests/normalization/normalize/test_operator_normalize.cpp index fd975d90..17751b1d 100644 --- a/tests/normalization/normalize/test_operator_normalize.cpp +++ b/tests/normalization/normalize/test_operator_normalize.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/rmsnorm/test_operator_rmsnorm.cpp b/tests/normalization/rmsnorm/test_operator_rmsnorm.cpp index 42d7072f..6cf9fb73 100644 --- a/tests/normalization/rmsnorm/test_operator_rmsnorm.cpp +++ b/tests/normalization/rmsnorm/test_operator_rmsnorm.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" using namespace std; diff --git a/tests/normalization/welfordfinalize/test_operator_welfordfinalize.cpp b/tests/normalization/welfordfinalize/test_operator_welfordfinalize.cpp index c5b08ec1..1411599d 100644 --- a/tests/normalization/welfordfinalize/test_operator_welfordfinalize.cpp +++ b/tests/normalization/welfordfinalize/test_operator_welfordfinalize.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include using namespace std; diff --git a/tests/normalization/welfordupdate/test_operator_welfordupdate.cpp b/tests/normalization/welfordupdate/test_operator_welfordupdate.cpp index 654a40a6..8833226c 100644 --- a/tests/normalization/welfordupdate/test_operator_welfordupdate.cpp +++ b/tests/normalization/welfordupdate/test_operator_welfordupdate.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include using namespace std; diff --git a/tests/pad/pad/test_operator_pad.cpp b/tests/pad/pad/test_operator_pad.cpp index 8bed6873..f7e4e51c 100644 --- a/tests/pad/pad/test_operator_pad.cpp +++ b/tests/pad/pad/test_operator_pad.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" #include diff --git a/tests/quantization/antiquant/test_ascend_antiquant.cpp b/tests/quantization/antiquant/test_ascend_antiquant.cpp index 105d9151..af9b3a6c 100644 --- a/tests/quantization/antiquant/test_ascend_antiquant.cpp +++ b/tests/quantization/antiquant/test_ascend_antiquant.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" diff --git a/tests/quantization/antiquant/test_ascend_antiquant_scalar.cpp b/tests/quantization/antiquant/test_ascend_antiquant_scalar.cpp index f631cf0e..1128ed3d 100644 --- a/tests/quantization/antiquant/test_ascend_antiquant_scalar.cpp +++ b/tests/quantization/antiquant/test_ascend_antiquant_scalar.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" diff --git a/tests/quantization/antiquant/test_ascend_antiquant_weight.cpp b/tests/quantization/antiquant/test_ascend_antiquant_weight.cpp index d66a2373..1ebd4471 100644 --- a/tests/quantization/antiquant/test_ascend_antiquant_weight.cpp +++ b/tests/quantization/antiquant/test_ascend_antiquant_weight.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_operator_intf.h" #include "kernel_utils.h" diff --git a/tests/quantization/antiquant/test_ascend_antiquant_weight_scalar.cpp b/tests/quantization/antiquant/test_ascend_antiquant_weight_scalar.cpp index 571c86ed..d4641a89 100644 --- a/tests/quantization/antiquant/test_ascend_antiquant_weight_scalar.cpp +++ b/tests/quantization/antiquant/test_ascend_antiquant_weight_scalar.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" diff --git a/tests/reduce/mean/test_operator_mean.cpp b/tests/reduce/mean/test_operator_mean.cpp index eb96f184..cf457c2f 100644 --- a/tests/reduce/mean/test_operator_mean.cpp +++ b/tests/reduce/mean/test_operator_mean.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include diff --git a/tests/reduce/sum/test_operator_sum.cpp b/tests/reduce/sum/test_operator_sum.cpp index 015bcf70..6ca21916 100644 --- a/tests/reduce/sum/test_operator_sum.cpp +++ b/tests/reduce/sum/test_operator_sum.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" #include diff --git a/tests/sort/topk/test_operator_topk.cpp b/tests/sort/topk/test_operator_topk.cpp index a1f80967..ab8a14f6 100644 --- a/tests/sort/topk/test_operator_topk.cpp +++ b/tests/sort/topk/test_operator_topk.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include using namespace std; diff --git a/tests/transpose/confusion_transpose/test_operator_confusion_transpose.cpp b/tests/transpose/confusion_transpose/test_operator_confusion_transpose.cpp index c0624cc1..f3aa42cd 100644 --- a/tests/transpose/confusion_transpose/test_operator_confusion_transpose.cpp +++ b/tests/transpose/confusion_transpose/test_operator_confusion_transpose.cpp @@ -9,7 +9,7 @@ */ #include #define private public -#define protect public +#define protected public #include "kernel_operator.h" #include "kernel_utils.h" #include -- Gitee From 9ca28a716b2783f15d1ccdb395ef1216787070fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AF=9B=E6=B5=B7=E5=B9=B3?= Date: Thu, 16 Oct 2025 11:18:02 +0800 Subject: [PATCH 2/2] set mask & warning --- impl/kfc/kernel_kfc.h | 2 +- impl/normalization/deepnorm/deepnorm_common_impl.h | 4 ++-- impl/normalization/layernorm/layernorm_common_impl.h | 2 +- .../welfordfinalize/welfordfinalize_common_impl.h | 2 +- impl/sort/topk/topk_common_impl.h | 2 +- tests/activation/sigmoid/test_operator_vec_sigmoid.cpp | 4 ++-- tests/math/axpy/test_operator_axpy.cpp | 4 ++-- tests/math/tanh/test_operator_tanh.cpp | 4 ++-- tests/math/xor/test_operator_xor.cpp | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/impl/kfc/kernel_kfc.h b/impl/kfc/kernel_kfc.h index 147a9bf1..b11e3bbe 100644 --- a/impl/kfc/kernel_kfc.h +++ b/impl/kfc/kernel_kfc.h @@ -38,7 +38,7 @@ __aicore__ inline void clearWorkspace(__gm__ uint8_t *workspace) AscendC::ClearWorkspaceImpl(workspace); AscendC::NotifyEvent(WORKSPACE_SYNC_ID); } else { - AscendC::AscendCUtils::SetMask((uint64_t)-1, (uint64_t)-1); + SetVectorMask((uint64_t)-1, (uint64_t)-1); AscendC::SetMaskNorm(); } #endif diff --git a/impl/normalization/deepnorm/deepnorm_common_impl.h b/impl/normalization/deepnorm/deepnorm_common_impl.h index 48504b4c..a87b6623 100644 --- a/impl/normalization/deepnorm/deepnorm_common_impl.h +++ b/impl/normalization/deepnorm/deepnorm_common_impl.h @@ -38,8 +38,8 @@ __aicore__ inline bool IsDeepNormParamValid(DeepNormTiling& tiling) const bool bsDivBy8 = ((tiling.bLength * tiling.sLength) % BASIC_BLOCK_BSLENGTH == 0); if constexpr (isBasicBlock) { ASCENDC_ASSERT(hDivBy64 && bsDivBy8, - {KERNEL_LOG(KERNEL_ERROR, "In DeepNorm, when isBasicBlock is true, input must have hLength % 64 = 0, " \ - "originalHLegnth % 64 = 0 and (bLength * sLength) % 8 = 0 !");}); + {KERNEL_LOG(KERNEL_ERROR, "In DeepNorm, when isBasicBlock is true, input must have hLength %% 64 = 0, " \ + "originalHLegnth %% 64 = 0 and (bLength * sLength) % 8 = 0 !");}); } return true; diff --git a/impl/normalization/layernorm/layernorm_common_impl.h b/impl/normalization/layernorm/layernorm_common_impl.h index ed775359..43ff3841 100644 --- a/impl/normalization/layernorm/layernorm_common_impl.h +++ b/impl/normalization/layernorm/layernorm_common_impl.h @@ -466,7 +466,7 @@ __aicore__ inline void WelfordUpdateImpl(const LocalTensor& outputMean, const }); ASCENDC_ASSERT((para.abComputeLength > 0), { KERNEL_LOG(KERNEL_ERROR, - "Failed to check para.abComputeLength, para.abComputeLength should be greater than 0.", + "Failed to check para.abComputeLength, para.abComputeLength (%u) should be greater than 0.", para.abComputeLength, para.abLength); }); ASCENDC_ASSERT((para.rnLength == 1), { diff --git a/impl/normalization/welfordfinalize/welfordfinalize_common_impl.h b/impl/normalization/welfordfinalize/welfordfinalize_common_impl.h index 08d405a3..c23609b1 100644 --- a/impl/normalization/welfordfinalize/welfordfinalize_common_impl.h +++ b/impl/normalization/welfordfinalize/welfordfinalize_common_impl.h @@ -421,7 +421,7 @@ __aicore__ inline void GetWelfordFinalizeTensorInfo(const LocalTensor &st // 0x2 indicates reserving two buffers for the storage of mean and variance const uint32_t minTmpOutSize = B32_LEN * 0x2; ASCENDC_ASSERT((stackBuffer.GetSize() >= (minTmpSize + minTmpOutSize)), - { KERNEL_LOG(KERNEL_ERROR, "sharedTmpBuffer size must >= %d Bytes!", (minTmpSize + minTmpOutSize) * sizeof(float)); }); + { KERNEL_LOG(KERNEL_ERROR, "sharedTmpBuffer size must >= %ld Bytes!", (minTmpSize + minTmpOutSize) * sizeof(float)); }); const uint32_t expFactor = (stackBuffer.GetSize() - minTmpOutSize) / minTmpSize; tiling.computeLength = expFactor * B32_LEN; diff --git a/impl/sort/topk/topk_common_impl.h b/impl/sort/topk/topk_common_impl.h index b29b0870..45fda042 100644 --- a/impl/sort/topk/topk_common_impl.h +++ b/impl/sort/topk/topk_common_impl.h @@ -123,7 +123,7 @@ __aicore__ inline void TopKNSmall(const LocalTensor &dstValueLocal, const Loc LocalTensor stackTensor; PopStackBuffer(stackTensor); ASCENDC_ASSERT((stackTensor.GetSize() / sizeof(T) >= tilling.tmpLocalSize), {KERNEL_LOG(KERNEL_ERROR, "The stack " - "buffer is insufficient, TopK api need %d, but only %d exists.", tilling.tmpLocalSize, + "buffer is insufficient, TopK api need %d, but only %ld exists.", tilling.tmpLocalSize, stackTensor.GetSize() / sizeof(T));}); stackTensor.SetSize(tilling.tmpLocalSize * sizeof(T)); diff --git a/tests/activation/sigmoid/test_operator_vec_sigmoid.cpp b/tests/activation/sigmoid/test_operator_vec_sigmoid.cpp index 4d387301..7a65331f 100644 --- a/tests/activation/sigmoid/test_operator_vec_sigmoid.cpp +++ b/tests/activation/sigmoid/test_operator_vec_sigmoid.cpp @@ -30,14 +30,14 @@ void SigmoidKernel(__gm__ uint8_t* __restrict__ srcGm, __gm__ uint8_t* __restric tpipe.InitBuffer(tbuf2, dataSize * sizeof(T)); LocalTensor outputLocal = tbuf2.Get(); - AscendCUtils::SetMask(256); + SetVectorMask(256); DataCopy(inputLocal, inputGlobal, dataSize); event_t eventIdMTE2ToV = static_cast(GetTPipePtr()->FetchEventID(HardEvent::MTE2_V)); SetFlag(eventIdMTE2ToV); WaitFlag(eventIdMTE2ToV); - AscendCUtils::SetMask(128); + SetVectorMask(128); Sigmoid(outputLocal, inputLocal, dataSize); diff --git a/tests/math/axpy/test_operator_axpy.cpp b/tests/math/axpy/test_operator_axpy.cpp index 8a7126a1..ae348c64 100644 --- a/tests/math/axpy/test_operator_axpy.cpp +++ b/tests/math/axpy/test_operator_axpy.cpp @@ -35,11 +35,11 @@ void AxpyKernel(__gm__ uint8_t* __restrict__ srcGm, __gm__ uint8_t* __restrict__ LocalTensor outputLocal = vecOutQue.AllocTensor(); LocalTensor tmpLocal = vecTmpQue.AllocTensor(); - AscendCUtils::SetMask(256); + SetVectorMask(256); DataCopy(inputLocal, inputGlobal, dataSize); SetFlag(EVENT_ID0); - AscendCUtils::SetMask(128); + SetVectorMask(128); WaitFlag(EVENT_ID0); U scalar = 4; diff --git a/tests/math/tanh/test_operator_tanh.cpp b/tests/math/tanh/test_operator_tanh.cpp index 5a3abfd4..cba449a5 100644 --- a/tests/math/tanh/test_operator_tanh.cpp +++ b/tests/math/tanh/test_operator_tanh.cpp @@ -30,12 +30,12 @@ void TanhKernel(__gm__ uint8_t* __restrict__ srcGm, __gm__ uint8_t* __restrict__ tpipe.InitBuffer(tbuf2, dataSize * sizeof(T)); LocalTensor outputLocal = tbuf2.Get(); - AscendCUtils::SetMask(256); + SetVectorMask(256); DataCopy(inputLocal, inputGlobal, dataSize); SetFlag(EVENT_ID0); - AscendCUtils::SetMask(128); + SetVectorMask(128); WaitFlag(EVENT_ID0); Tanh(outputLocal, inputLocal, dataSize); diff --git a/tests/math/xor/test_operator_xor.cpp b/tests/math/xor/test_operator_xor.cpp index edba1b78..b3c3daa8 100644 --- a/tests/math/xor/test_operator_xor.cpp +++ b/tests/math/xor/test_operator_xor.cpp @@ -59,13 +59,13 @@ void main_vec_xor_level2_demo(__gm__ uint8_t* __restrict__ dstGm, input1_local.SetValue(i, 1); } - AscendCUtils::SetMask(256); + SetVectorMask(256); DataCopy(input0_local, input0Global, dataSize); DataCopy(input1_local, input1Global, dataSize); SetFlag(EVENT_ID0); - AscendCUtils::SetMask(128); + SetVectorMask(128); WaitFlag(EVENT_ID0); if (testMode == NORMAL_MODE) { -- Gitee