Merged
refactor(exp_segsum_grad): 将 arch22 tiling 与 host UT 隔离到 arch22 子目录 #4380
daiwei18Add on Aug 1
refactor(exp_segsum_grad): 将 arch22 tiling 与 host UT 隔离到 arch22 子目录 #4380
Merged
Merged fromdaiwei18/ops-math930-expintocann/ops-mathmaster
Total: 7 files changed+64-69
| @@ -10,10 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | add_modules_sources(OPTYPE exp_segsum_grad ACLNNTYPE aclnn_exclude) | 11 | add_modules_sources(OPTYPE exp_segsum_grad ACLNNTYPE aclnn_exclude) |
| 12 | 12 | ||
| 13 | -if("${ASCEND_COMPUTE_UNIT}" STREQUAL "ascend950" AND TARGET ${OPHOST_NAME}_tiling_obj) | 13 | +add_tiling_modules() |
| 14 | - target_sources(${OPHOST_NAME}_tiling_obj PRIVATE | 14 | +if("${ASCEND_COMPUTE_UNIT}" STREQUAL "ascend950") |
| 15 | + set(EXP_SEGSUM_GRAD_TILING_SRC | ||
| 15 | ${CMAKE_CURRENT_SOURCE_DIR}/arch35/exp_segsum_grad_tiling_arch35.cpp) | 16 | ${CMAKE_CURRENT_SOURCE_DIR}/arch35/exp_segsum_grad_tiling_arch35.cpp) |
| 16 | - get_target_property(EXP_SEGSUM_GRAD_TILING_SRCS ${OPHOST_NAME}_tiling_obj SOURCES) | 17 | +else() |
| 17 | - list(REMOVE_ITEM EXP_SEGSUM_GRAD_TILING_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/exp_segsum_grad_tiling.cpp") | 18 | + set(EXP_SEGSUM_GRAD_TILING_SRC |
| 18 | - set_property(TARGET ${OPHOST_NAME}_tiling_obj PROPERTY SOURCES ${EXP_SEGSUM_GRAD_TILING_SRCS}) | 19 | + ${CMAKE_CURRENT_SOURCE_DIR}/arch22/exp_segsum_grad_tiling.cpp) |
| 19 | endif() | 20 | endif() |
| 21 | +target_sources(${OPHOST_NAME}_tiling_obj PRIVATE ${EXP_SEGSUM_GRAD_TILING_SRC}) | ||
Rmath/exp_segsum_grad/op_host/exp_segsum_grad_tiling.cpp→math/exp_segsum_grad/op_host/arch22/exp_segsum_grad_tiling.cpp+16-18
| @@ -1,16 +1,16 @@ | |||
| 1 | /** | 1 | /** |
| 2 | - * This program is free software, you can redistribute it and/or modify it. | ||
| 3 | * Copyright (c) 2025 Huawei Technologies Co., Ltd. | 2 | * Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 4 | - * This file is a part of the CANN Open Software. | 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | - * Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | * Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | * Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | * See LICENSE in the root of the software repository for the full text of the License. | 8 | * See LICENSE in the root of the software repository for the full text of the License. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | /*! | 11 | /*! |
| 12 | * \file exp_segsum_grad_tiling.cpp | 12 | * \file exp_segsum_grad_tiling.cpp |
| 13 | - * \brief | 13 | + * \brief arch22 / Ascend910B tiling implementation for ExpSegsumGrad. |
| 14 | */ | 14 | */ |
| 15 | #include "register/tilingdata_base.h" | 15 | #include "register/tilingdata_base.h" |
| 16 | #include "log/log.h" | 16 | #include "log/log.h" |
| @@ -39,7 +39,7 @@ constexpr uint8_t SCHEDULE_MODE = 1; // batchmode模式,核间同步算子需 | |||
| 39 | 39 | ||
| 40 | class ExpSegsumGradTiling { | 40 | class ExpSegsumGradTiling { |
| 41 | public: | 41 | public: |
| 42 | - explicit ExpSegsumGradTiling(gert::TilingContext* context) : tilingContext(context){}; | 42 | + explicit ExpSegsumGradTiling(gert::TilingContext* context) : tilingContext(context) {}; |
| 43 | ge::graphStatus RunBigKernelTiling(); | 43 | ge::graphStatus RunBigKernelTiling(); |
| 44 | 44 | ||
| 45 | private: | 45 | private: |
| @@ -116,8 +116,8 @@ void ExpSegsumGradTiling::GetTilingKey(uint64_t ubSizePlatform) | |||
| 116 | auto shape = ge::Shape({rowNum, colNum}); | 116 | auto shape = ge::Shape({rowNum, colNum}); |
| 117 | uint32_t maxValue = 0; | 117 | uint32_t maxValue = 0; |
| 118 | uint32_t minValue = 0; | 118 | uint32_t minValue = 0; |
| 119 | - AscendC::GetReduceSumMaxMinTmpSize( | 119 | + AscendC::GetReduceSumMaxMinTmpSize(shape, ge::DataType::DT_FLOAT, AscendC::ReducePattern::AR, true, false, maxValue, |
| 120 | - shape, ge::DataType::DT_FLOAT, AscendC::ReducePattern::AR, true, false, maxValue, minValue); | 120 | + minValue); |
| 121 | if (minValue > REDUCE_SUM_SIZE) { | 121 | if (minValue > REDUCE_SUM_SIZE) { |
| 122 | int64_t size = CeilA2B(CeilA2B(minValue - REDUCE_SUM_SIZE, TENSOR_NUM), BLOCK) * BLOCK; | 122 | int64_t size = CeilA2B(CeilA2B(minValue - REDUCE_SUM_SIZE, TENSOR_NUM), BLOCK) * BLOCK; |
| 123 | maxSlideSize = maxSlideSize - size / GetDataTypeSize(); | 123 | maxSlideSize = maxSlideSize - size / GetDataTypeSize(); |
| @@ -181,8 +181,8 @@ void ExpSegsumGradTiling::FillTilingData() | |||
| 181 | tilingContext->SetScheduleMode(SCHEDULE_MODE); | 181 | tilingContext->SetScheduleMode(SCHEDULE_MODE); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | - tilingData.SaveToBuffer( | 184 | + tilingData.SaveToBuffer(tilingContext->GetRawTilingData()->GetData(), |
| 185 | - tilingContext->GetRawTilingData()->GetData(), tilingContext->GetRawTilingData()->GetCapacity()); | 185 | + tilingContext->GetRawTilingData()->GetCapacity()); |
| 186 | tilingContext->GetRawTilingData()->SetDataSize(tilingData.GetDataSize()); | 186 | tilingContext->GetRawTilingData()->SetDataSize(tilingData.GetDataSize()); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| @@ -203,15 +203,13 @@ static ge::graphStatus TilingPrepare4ExpSegsumGrad(gert::TilingParseContext* con | |||
| 203 | compileInfo->coreNum = ascendcPlatform.GetCoreNumAiv(); | 203 | compileInfo->coreNum = ascendcPlatform.GetCoreNumAiv(); |
| 204 | compileInfo->ubSize = ubSize; | 204 | compileInfo->ubSize = ubSize; |
| 205 | 205 | ||
| 206 | - OP_CHECK_IF( | 206 | + OP_CHECK_IF(compileInfo->coreNum <= 0, |
| 207 | - compileInfo->coreNum <= 0, | 207 | + OP_LOGE(context->GetNodeName(), "ExpSegsumGrad GetHardwareInfo Failed, vectorCoreNum: %u", |
| 208 | - OP_LOGE( | 208 | + compileInfo->coreNum), |
| 209 | - context->GetNodeName(), "ExpSegsumGrad GetHardwareInfo Failed, vectorCoreNum: %u", compileInfo->coreNum), | 209 | + return ge::GRAPH_FAILED); |
| 210 | - return ge::GRAPH_FAILED); | ||
| 211 | OP_CHECK_IF( | 210 | OP_CHECK_IF( |
| 212 | compileInfo->ubSize <= 0, | 211 | compileInfo->ubSize <= 0, |
| 213 | - OP_LOGE( | 212 | + OP_LOGE(context->GetNodeName(), "ExpSegsumGrad GetHardwareInfo Failed, ubSize: %lu", compileInfo->ubSize), |
| 214 | - context->GetNodeName(), "ExpSegsumGrad GetHardwareInfo Failed, ubSize: %lu", compileInfo->ubSize), | ||
| 215 | return ge::GRAPH_FAILED); | 213 | return ge::GRAPH_FAILED); |
| 216 | return ge::GRAPH_SUCCESS; | 214 | return ge::GRAPH_SUCCESS; |
| 217 | } | 215 | } |
| @@ -219,4 +217,4 @@ static ge::graphStatus TilingPrepare4ExpSegsumGrad(gert::TilingParseContext* con | |||
| 219 | IMPL_OP_OPTILING(ExpSegsumGrad) | 217 | IMPL_OP_OPTILING(ExpSegsumGrad) |
| 220 | .Tiling(Tiling4ExpSegsumGrad) | 218 | .Tiling(Tiling4ExpSegsumGrad) |
| 221 | .TilingParse<ExpSegsumGradCompileInfo>(TilingPrepare4ExpSegsumGrad); | 219 | .TilingParse<ExpSegsumGradCompileInfo>(TilingPrepare4ExpSegsumGrad); |
| 222 | -} // namespace optiling | 220 | +} // namespace optiling |
Rmath/exp_segsum_grad/op_host/exp_segsum_grad_tiling.h→math/exp_segsum_grad/op_host/arch22/exp_segsum_grad_tiling.h+7-8
| @@ -1,22 +1,21 @@ | |||
| 1 | /** | 1 | /** |
| 2 | - * This program is free software, you can redistribute it and/or modify it. | ||
| 3 | * Copyright (c) 2025 Huawei Technologies Co., Ltd. | 2 | * Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 4 | - * This file is a part of the CANN Open Software. | 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | - * Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | * Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | * Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | * See LICENSE in the root of the software repository for the full text of the License. | 8 | * See LICENSE in the root of the software repository for the full text of the License. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | /*! | 11 | /*! |
| 12 | * \file segsum_tiling.h | 12 | * \file segsum_tiling.h |
| 13 | - * \brief | 13 | + * \brief arch22 / Ascend910B tiling data for ExpSegsumGrad. |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #ifndef OPS_BUILT_IN_OP_TILING_RUNTIME_EXP_SEGSUM_GRAD_TILING_H | 16 | #ifndef OPS_BUILT_IN_OP_TILING_RUNTIME_EXP_SEGSUM_GRAD_TILING_H |
| 17 | #define OPS_BUILT_IN_OP_TILING_RUNTIME_EXP_SEGSUM_GRAD_TILING_H | 17 | #define OPS_BUILT_IN_OP_TILING_RUNTIME_EXP_SEGSUM_GRAD_TILING_H |
| 18 | 18 | ||
| 19 | - | ||
| 20 | #include "register/tilingdata_base.h" | 19 | #include "register/tilingdata_base.h" |
| 21 | 20 | ||
| 22 | namespace optiling { | 21 | namespace optiling { |
| @@ -39,5 +38,5 @@ TILING_DATA_FIELD_DEF_ARR(int32_t, MAX_CORE_CONT, batchEnd); | |||
| 39 | END_TILING_DATA_DEF; | 38 | END_TILING_DATA_DEF; |
| 40 | 39 | ||
| 41 | REGISTER_TILING_DATA_CLASS(ExpSegsumGrad, ExpSegsumGradTilingData) | 40 | REGISTER_TILING_DATA_CLASS(ExpSegsumGrad, ExpSegsumGradTilingData) |
| 42 | -} | 41 | +} // namespace optiling |
| 43 | -#endif | 42 | +#endif |
| @@ -9,15 +9,18 @@ | |||
| 9 | # ---------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------- |
| 10 | if(UT_TEST_ALL OR OP_HOST_UT) | 10 | if(UT_TEST_ALL OR OP_HOST_UT) |
| 11 | if("${ASCEND_COMPUTE_UNIT}" STREQUAL "ascend950") | 11 | if("${ASCEND_COMPUTE_UNIT}" STREQUAL "ascend950") |
| 12 | - if(NOT TARGET ${OP_TILING_MODULE_NAME}_cases_obj) | 12 | + set(EXP_SEGSUM_GRAD_UT_TILING_DIR arch35) |
| 13 | - add_library(${OP_TILING_MODULE_NAME}_cases_obj OBJECT) | 13 | + else() |
| 14 | - endif() | 14 | + set(EXP_SEGSUM_GRAD_UT_TILING_DIR arch22) |
| 15 | - target_sources(${OP_TILING_MODULE_NAME}_cases_obj PRIVATE | 15 | + endif() |
| 16 | - ${CMAKE_CURRENT_SOURCE_DIR}/arch35/test_exp_segsum_grad_tiling_arch35.cpp) | 16 | + add_modules_ut_sources( |
| 17 | + UT_NAME ${OP_TILING_MODULE_NAME} | ||
| 18 | + MODE PRIVATE | ||
| 19 | + DIR ${CMAKE_CURRENT_SOURCE_DIR} | ||
| 20 | + TILING_DIR ${EXP_SEGSUM_GRAD_UT_TILING_DIR}) | ||
| 21 | + if("${ASCEND_COMPUTE_UNIT}" STREQUAL "ascend950" AND TARGET ${OP_TILING_MODULE_NAME}_cases_obj) | ||
| 17 | target_compile_definitions(${OP_TILING_MODULE_NAME}_cases_obj | 22 | target_compile_definitions(${OP_TILING_MODULE_NAME}_cases_obj |
| 18 | PRIVATE BUILD_SOC_VERSION=${ASCEND_COMPUTE_UNIT}) | 23 | PRIVATE BUILD_SOC_VERSION=${ASCEND_COMPUTE_UNIT}) |
| 19 | - else() | ||
| 20 | - add_modules_ut_sources(UT_NAME ${OP_TILING_MODULE_NAME} MODE PRIVATE DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| 21 | endif() | 24 | endif() |
| 22 | endif() | 25 | endif() |
| 23 | 26 | ||
Rmath/exp_segsum_grad/tests/ut/op_host/test_exp_segsum_grad_tiling.cpp→math/exp_segsum_grad/tests/ut/op_host/arch22/test_exp_segsum_grad_tiling.cpp+18-26
| @@ -1,10 +1,10 @@ | |||
| 1 | /** | 1 | /** |
| 2 | - * This program is free software, you can redistribute it and/or modify it. | ||
| 3 | * Copyright (c) 2025 Huawei Technologies Co., Ltd. | 2 | * Copyright (c) 2025 Huawei Technologies Co., Ltd. |
| 4 | - * This file is a part of the CANN Open Software. | 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | - * Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | * Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | * Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | * See LICENSE in the root of the software repository for the full text of the License. | 8 | * See LICENSE in the root of the software repository for the full text of the License. |
| 9 | */ | 9 | */ |
| 10 | #include <iostream> | 10 | #include <iostream> |
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <gtest/gtest.h> | 13 | #include <gtest/gtest.h> |
| 14 | #include "tiling_context_faker.h" | 14 | #include "tiling_context_faker.h" |
| 15 | #include "tiling_case_executor.h" | 15 | #include "tiling_case_executor.h" |
| 16 | -#include "../../../op_host/exp_segsum_grad_tiling.h" | 16 | +#include "../../../../op_host/arch22/exp_segsum_grad_tiling.h" |
| 17 | 17 | ||
| 18 | using namespace std; | 18 | using namespace std; |
| 19 | using namespace ge; | 19 | using namespace ge; |
| @@ -21,32 +21,24 @@ using namespace gert; | |||
| 21 | 21 | ||
| 22 | class ExpSegsumGradTiling : public testing::Test { | 22 | class ExpSegsumGradTiling : public testing::Test { |
| 23 | protected: | 23 | protected: |
| 24 | - static void SetUpTestCase() | 24 | + static void SetUpTestCase() { std::cout << "ExpSegsumGradTiling SetUp" << std::endl; } |
| 25 | - { | ||
| 26 | - std::cout << "ExpSegsumGradTiling SetUp" << std::endl; | ||
| 27 | - } | ||
| 28 | 25 | ||
| 29 | - static void TearDownTestCase() | 26 | + static void TearDownTestCase() { std::cout << "ExpSegsumGradTiling TearDown" << std::endl; } |
| 30 | - { | ||
| 31 | - std::cout << "ExpSegsumGradTiling TearDown" << std::endl; | ||
| 32 | - } | ||
| 33 | }; | 27 | }; |
| 34 | 28 | ||
| 35 | -TEST_F(ExpSegsumGradTiling, exp_segsum_grad_tiling_001) { | 29 | +TEST_F(ExpSegsumGradTiling, exp_segsum_grad_tiling_001) |
| 30 | +{ | ||
| 36 | optiling::ExpSegsumGradCompileInfo compileInfo = {1, 10}; | 31 | optiling::ExpSegsumGradCompileInfo compileInfo = {1, 10}; |
| 37 | - gert::TilingContextPara tilingContextPara( | 32 | + gert::TilingContextPara tilingContextPara("ExpSegsumGrad", |
| 38 | - "ExpSegsumGrad", | 33 | + {{{{1, 1, 12, 12}, {1, 1, 12, 12}}, ge::DT_FLOAT, ge::FORMAT_ND}, |
| 39 | - { | 34 | + {{{1, 1, 12, 12}, {1, 1, 12, 12}}, ge::DT_FLOAT, ge::FORMAT_ND}}, |
| 40 | - {{{1, 1, 12, 12}, {1, 1, 12, 12}}, ge::DT_FLOAT, ge::FORMAT_ND}, | 35 | + { |
| 41 | - {{{1, 1, 12, 12}, {1, 1, 12, 12}}, ge::DT_FLOAT, ge::FORMAT_ND} | 36 | + {{{1, 1, 12, 12}, {1, 1, 12, 12}}, ge::DT_FLOAT, ge::FORMAT_ND}, |
| 42 | - }, | 37 | + }, |
| 43 | - { | 38 | + &compileInfo); |
| 44 | - {{{1, 1, 12, 12}, {1, 1, 12, 12}}, ge::DT_FLOAT, ge::FORMAT_ND}, | ||
| 45 | - }, | ||
| 46 | - &compileInfo); | ||
| 47 | uint64_t expectTilingKey = 1; | 39 | uint64_t expectTilingKey = 1; |
| 48 | - string expectTilingData = "1 1 12 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "; | 40 | + string expectTilingData = "1 1 12 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 " |
| 41 | + "0 0 0 0 0 0 0 0 0 0 0 0 "; | ||
| 49 | std::vector<size_t> expectWorkspaces = {33554432}; | 42 | std::vector<size_t> expectWorkspaces = {33554432}; |
| 50 | ExecuteTestCase(tilingContextPara, ge::GRAPH_SUCCESS, expectTilingKey, expectTilingData, expectWorkspaces); | 43 | ExecuteTestCase(tilingContextPara, ge::GRAPH_SUCCESS, expectTilingKey, expectTilingData, expectWorkspaces); |
| 51 | } | 44 | } |
| 52 | - | ||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include "platform/platform_info.h" | 23 | #include "platform/platform_info.h" |
| 24 | #include "tiling_context_faker.h" | 24 | #include "tiling_context_faker.h" |
| 25 | #include "tiling_case_executor.h" | 25 | #include "tiling_case_executor.h" |
| 26 | -#include "../../../../op_host/exp_segsum_grad_tiling.h" | ||
| 27 | #include "../../../../op_kernel/arch35/exp_segsum_grad_tiling_data.h" | 26 | #include "../../../../op_kernel/arch35/exp_segsum_grad_tiling_data.h" |
| 28 | 27 | ||
| 29 | using namespace ge; | 28 | using namespace ge; |
| @@ -38,6 +37,8 @@ constexpr size_t EXP_SEGSUM_GRAD_A2_WORKSPACE_SIZE = 32 * 1024 * 1024; | |||
| 38 | constexpr size_t EXP_SEGSUM_GRAD_ARCH35_SYS_WORKSPACE_SIZE = 16 * 1024 * 1024; | 37 | constexpr size_t EXP_SEGSUM_GRAD_ARCH35_SYS_WORKSPACE_SIZE = 16 * 1024 * 1024; |
| 39 | constexpr int64_t EXP_SEGSUM_GRAD_ARCH35_FP32_SLIDE_SIZE = 10912; | 38 | constexpr int64_t EXP_SEGSUM_GRAD_ARCH35_FP32_SLIDE_SIZE = 10912; |
| 40 | 39 | ||
| 40 | +struct ExpSegsumGradCompileInfoArch35 {}; | ||
| 41 | + | ||
| 41 | bool IsAscend950Build() { return std::string(EXP_SEGSUM_GRAD_ARCH35_STR(BUILD_SOC_VERSION)) == "ascend950"; } | 42 | bool IsAscend950Build() { return std::string(EXP_SEGSUM_GRAD_ARCH35_STR(BUILD_SOC_VERSION)) == "ascend950"; } |
| 42 | 43 | ||
| 43 | gert::StorageShape MakeStorageShape(const std::vector<int64_t>& dims) | 44 | gert::StorageShape MakeStorageShape(const std::vector<int64_t>& dims) |
| @@ -121,7 +122,7 @@ protected: | |||
| 121 | 122 | ||
| 122 | TEST_F(ExpSegsumGradTilingArch35Test, small_fp32_uses_arch35_tiling_data) | 123 | TEST_F(ExpSegsumGradTilingArch35Test, small_fp32_uses_arch35_tiling_data) |
| 123 | { | 124 | { |
| 124 | - optiling::ExpSegsumGradCompileInfo compileInfo = {1, 10}; | 125 | + ExpSegsumGradCompileInfoArch35 compileInfo = {}; |
| 125 | auto tilingContextPara = MakeTilingPara({1, 1, 12, 12}, ge::DT_FLOAT, &compileInfo); | 126 | auto tilingContextPara = MakeTilingPara({1, 1, 12, 12}, ge::DT_FLOAT, &compileInfo); |
| 126 | TilingInfo tilingInfo; | 127 | TilingInfo tilingInfo; |
| 127 | ASSERT_TRUE(ExecuteTiling(tilingContextPara, tilingInfo)); | 128 | ASSERT_TRUE(ExecuteTiling(tilingContextPara, tilingInfo)); |
| @@ -142,7 +143,7 @@ TEST_F(ExpSegsumGradTilingArch35Test, small_fp32_uses_arch35_tiling_data) | |||
| 142 | 143 | ||
| 143 | TEST_F(ExpSegsumGradTilingArch35Test, multi_batch_splits_across_ascend950_cores) | 144 | TEST_F(ExpSegsumGradTilingArch35Test, multi_batch_splits_across_ascend950_cores) |
| 144 | { | 145 | { |
| 145 | - optiling::ExpSegsumGradCompileInfo compileInfo = {1, 10}; | 146 | + ExpSegsumGradCompileInfoArch35 compileInfo = {}; |
| 146 | auto tilingContextPara = MakeTilingPara({65, 1, 12, 12}, ge::DT_FLOAT, &compileInfo); | 147 | auto tilingContextPara = MakeTilingPara({65, 1, 12, 12}, ge::DT_FLOAT, &compileInfo); |
| 147 | TilingInfo tilingInfo; | 148 | TilingInfo tilingInfo; |
| 148 | ASSERT_TRUE(ExecuteTiling(tilingContextPara, tilingInfo)); | 149 | ASSERT_TRUE(ExecuteTiling(tilingContextPara, tilingInfo)); |
| @@ -160,7 +161,7 @@ TEST_F(ExpSegsumGradTilingArch35Test, multi_batch_splits_across_ascend950_cores) | |||
| 160 | 161 | ||
| 161 | TEST_F(ExpSegsumGradTilingArch35Test, empty_batch_keeps_valid_block_dim) | 162 | TEST_F(ExpSegsumGradTilingArch35Test, empty_batch_keeps_valid_block_dim) |
| 162 | { | 163 | { |
| 163 | - optiling::ExpSegsumGradCompileInfo compileInfo = {1, 10}; | 164 | + ExpSegsumGradCompileInfoArch35 compileInfo = {}; |
| 164 | auto tilingContextPara = MakeTilingPara({0, 1, 12, 12}, ge::DT_FLOAT, &compileInfo); | 165 | auto tilingContextPara = MakeTilingPara({0, 1, 12, 12}, ge::DT_FLOAT, &compileInfo); |
| 165 | TilingInfo tilingInfo; | 166 | TilingInfo tilingInfo; |
| 166 | ASSERT_TRUE(ExecuteTiling(tilingContextPara, tilingInfo)); | 167 | ASSERT_TRUE(ExecuteTiling(tilingContextPara, tilingInfo)); |
| @@ -11,7 +11,7 @@ | |||
| 11 | if (UT_TEST_ALL OR OP_KERNEL_UT) | 11 | if (UT_TEST_ALL OR OP_KERNEL_UT) |
| 12 | 12 | ||
| 13 | set(exp_segsum_grad_tiling_files | 13 | set(exp_segsum_grad_tiling_files |
| 14 | - ${CMAKE_CURRENT_SOURCE_DIR}/../../../op_host/exp_segsum_grad_tiling.cpp | 14 | + ${CMAKE_CURRENT_SOURCE_DIR}/../../../op_host/arch22/exp_segsum_grad_tiling.cpp |
| 15 | ) | 15 | ) |
| 16 | # 使用AddOpTestCase | 16 | # 使用AddOpTestCase |
| 17 | # param1:算子名称,以kernel方式命名 | 17 | # param1:算子名称,以kernel方式命名 |