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 5c9a8facdea3f8c8cdf94d5c734615d8a71a02e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AF=9B=E6=B5=B7=E5=B9=B3?= Date: Wed, 15 Oct 2025 18:31:43 +0800 Subject: [PATCH 2/2] refactor: type cast with static_cast --- impl/math/exp/exp_common_impl.h | 2 +- impl/normalization/deepnorm/deepnorm_common_impl.h | 2 +- impl/normalization/layernorm/layernorm_common_impl.h | 2 +- impl/normalization/layernorm/layernorm_tiling_impl.cpp | 2 +- impl/normalization/normalize/normalize_common_impl.h | 2 +- impl/pad/pad/pad_base_impl.h | 9 --------- impl/sort/topk/topk_tiling_impl.cpp | 4 ++-- .../confusion_transpose/confusion_transpose_base_0213.h | 7 ------- tests/common/k3_pvwrap.h | 2 +- 9 files changed, 8 insertions(+), 24 deletions(-) diff --git a/impl/math/exp/exp_common_impl.h b/impl/math/exp/exp_common_impl.h index 6b4b16f6..69d7a988 100644 --- a/impl/math/exp/exp_common_impl.h +++ b/impl/math/exp/exp_common_impl.h @@ -166,7 +166,7 @@ __aicore__ inline void ExpHighPrecisionExec(const ExpParams& params, uint PipeBarrier(); // FloorXPow: (x ^ (n+1)) / n! * [1 / (n+1)] -> (x ^ (n+1)) / (n+1)! - Muls(params.tempTensorFloorXPow, params.tempTensorFloorXPow, float(1.0) / float(i), + Muls(params.tempTensorFloorXPow, params.tempTensorFloorXPow, static_cast(1.0) / static_cast(i), MASK_PLACEHOLDER, 1, unaryParams); PipeBarrier(); diff --git a/impl/normalization/deepnorm/deepnorm_common_impl.h b/impl/normalization/deepnorm/deepnorm_common_impl.h index 33d3f8d8..48504b4c 100644 --- a/impl/normalization/deepnorm/deepnorm_common_impl.h +++ b/impl/normalization/deepnorm/deepnorm_common_impl.h @@ -372,7 +372,7 @@ __aicore__ inline void GetDeepNormOutputPre(const LocalTensor& xSubMean, PipeBarrier(); // all 1 tensor - Duplicate(params.tempTensorC, float(1.0), 1, 1, 1, 8); + Duplicate(params.tempTensorC, static_cast(1.0), 1, 1, 1, 8); PipeBarrier(); // SqrtX = sqrt(addX) diff --git a/impl/normalization/layernorm/layernorm_common_impl.h b/impl/normalization/layernorm/layernorm_common_impl.h index ae1aab74..ed775359 100644 --- a/impl/normalization/layernorm/layernorm_common_impl.h +++ b/impl/normalization/layernorm/layernorm_common_impl.h @@ -233,7 +233,7 @@ __aicore__ inline void ComputeMeanVariance(const LocalTensor& outputMean, eventId = GetTPipePtr()->FetchEventID(HardEvent::S_V); for (uint32_t j = 0; j < tiling.aCurLength; j++) { - float scalar = float(-1) * outputMean.GetValue(j); + float scalar = static_cast(-1) * outputMean.GetValue(j); SetFlag(eventId); WaitFlag(eventId); Adds(params.tempTensorA[j * para.rLengthWithPadding], params.tempTensorA[j * para.rLengthWithPadding], diff --git a/impl/normalization/layernorm/layernorm_tiling_impl.cpp b/impl/normalization/layernorm/layernorm_tiling_impl.cpp index 2ce74faa..628d560b 100644 --- a/impl/normalization/layernorm/layernorm_tiling_impl.cpp +++ b/impl/normalization/layernorm/layernorm_tiling_impl.cpp @@ -316,7 +316,7 @@ void GetLayerNormNDTilingInfo(const ge::Shape& srcShape, const uint32_t stackBuf const uint32_t arCurLength = inputRoundSize; const uint32_t aCurLength = meanVarRoundSize; - const float rValueBack = float(1) / static_cast(rLength); + const float rValueBack = static_cast(1) / static_cast(rLength); tiling.set_aLength(aLength); tiling.set_rLength(rLength); diff --git a/impl/normalization/normalize/normalize_common_impl.h b/impl/normalization/normalize/normalize_common_impl.h index 737da6c9..ce751300 100644 --- a/impl/normalization/normalize/normalize_common_impl.h +++ b/impl/normalization/normalize/normalize_common_impl.h @@ -90,7 +90,7 @@ __aicore__ inline void GetNormalizeOutputRstd(const LocalTensor& dstRstd, Adds(dstRstd, srcVar, epsilon, MASK_PLACEHOLDER, 1, unaryParams); PipeBarrier(); // 2. Rsqrt(AddsX) = 1 / Sqrt(AddsX) ==> dstRstd - Duplicate(tmpTensor.tempTensorA, float(1), 1, 1, DEFAULT_BLK_STRIDE, DEFAULT_REPEAT_STRIDE); + Duplicate(tmpTensor.tempTensorA, static_cast(1), 1, 1, DEFAULT_BLK_STRIDE, DEFAULT_REPEAT_STRIDE); PipeBarrier(); Sqrt(dstRstd, dstRstd, MASK_PLACEHOLDER, 1, unaryParams); PipeBarrier(); diff --git a/impl/pad/pad/pad_base_impl.h b/impl/pad/pad/pad_base_impl.h index 222ec653..a8745883 100644 --- a/impl/pad/pad/pad_base_impl.h +++ b/impl/pad/pad/pad_base_impl.h @@ -19,15 +19,6 @@ #include "kernel_pop_stack_buffer.h" #include "kernel_tiling/kernel_tiling.h" -#if __CCE_AICORE__ == 100 -#include "dav_c100/kernel_operator_vec_transpose_impl.h" -#elif __CCE_AICORE__ == 200 -#include "dav_m200/kernel_operator_vec_transpose_impl.h" -#elif __CCE_AICORE__ == 220 -#include "dav_c220/kernel_operator_vec_transpose_impl.h" -#include "dav_c220/kernel_operator_vec_gather_mask_impl.h" -#endif - namespace AscendC { template __aicore__ inline void DuplicateLastDimImpl(const LocalTensor &dstTensor, const LocalTensor &srcTensor, diff --git a/impl/sort/topk/topk_tiling_impl.cpp b/impl/sort/topk/topk_tiling_impl.cpp index 9f936a6d..459a97cc 100644 --- a/impl/sort/topk/topk_tiling_impl.cpp +++ b/impl/sort/topk/topk_tiling_impl.cpp @@ -378,9 +378,9 @@ void CheckTopKHostCommon(const char *apiName, const char *hostFuncName, "[%s][%s] The length of the outter axis must be greater than 0!", apiName, hostFuncName); uint64_t ubSize = 0; ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSize); - ASCENDC_HOST_ASSERT(uint64_t(inner * outter * dataTypeSize) <= ubSize, return, + ASCENDC_HOST_ASSERT(static_cast(inner * outter * dataTypeSize) <= ubSize, return, "[%s][%s] The size of srcShape is %luB, should be less than UB size.", apiName, hostFuncName, - uint64_t(inner * outter * dataTypeSize)); + static_cast(inner * outter * dataTypeSize)); ASCENDC_HOST_ASSERT(dataTypeSize == TOPK_HALF_SIZE || dataTypeSize == TOPK_FLOAT_SIZE, return, "[%s][%s] Type size %u is unsupported!", apiName, hostFuncName, dataTypeSize); return; diff --git a/impl/transpose/confusion_transpose/confusion_transpose_base_0213.h b/impl/transpose/confusion_transpose/confusion_transpose_base_0213.h index 9adb2316..9e0db9fa 100644 --- a/impl/transpose/confusion_transpose/confusion_transpose_base_0213.h +++ b/impl/transpose/confusion_transpose/confusion_transpose_base_0213.h @@ -18,13 +18,6 @@ #include "kernel_pop_stack_buffer.h" #include "kernel_tiling/kernel_tiling.h" -#if __CCE_AICORE__ == 100 -#include "dav_c100/kernel_operator_vec_transpose_impl.h" -#elif __CCE_AICORE__ == 200 -#include "dav_m200/kernel_operator_vec_transpose_impl.h" -#elif __CCE_AICORE__ == 220 -#include "dav_c220/kernel_operator_vec_transpose_impl.h" -#endif namespace AscendC { const uint32_t CUBE_HALF_SIZE = CUBE_MAX_SIZE / 2; diff --git a/tests/common/k3_pvwrap.h b/tests/common/k3_pvwrap.h index 4a34c8d9..69f61199 100644 --- a/tests/common/k3_pvwrap.h +++ b/tests/common/k3_pvwrap.h @@ -30,7 +30,7 @@ inline int svSize(svOpenArrayHandle buf, uint32_t size) // Constants const uint32_t PV_MAX_STEP = 1000000; const uint32_t PV_STEP_TIME_OUT = 1000; -const uint64_t PV_LAST_STEP = uint64_t(-1); +const uint64_t PV_LAST_STEP = static_cast(-1); // ------------------------------------------------------------------------------------------------- // APIs for SV, assume no multi-core, so no core_id arg needed -- Gitee