已合并
update aicpu op tile register func to v2. #2844
liu-wei创建于 5月20日
update aicpu op tile register func to v2. #2844
已合并
共 4 个文件变更+38-1
| @@ -244,6 +244,7 @@ function(add_aicpu_host_kernel_modules host_target_name) | |||
| 244 | ${host_target_name} PRIVATE | 244 | ${host_target_name} PRIVATE |
| 245 | _FORTIFY_SOURCE=2 | 245 | _FORTIFY_SOURCE=2 |
| 246 | google=ascend_private | 246 | google=ascend_private |
| 247 | + OPS_MATH_AICPU_HOST_KERNEL | ||
| 247 | ) | 248 | ) |
| 248 | target_compile_options( | 249 | target_compile_options( |
| 249 | ${host_target_name} PRIVATE | 250 | ${host_target_name} PRIVATE |
| @@ -184,6 +184,7 @@ set(AICPU_INCLUDE | |||
| 184 | ${C_SEC_INCLUDE} | 184 | ${C_SEC_INCLUDE} |
| 185 | ${NNOPBASE_INCLUDE_DIRS} | 185 | ${NNOPBASE_INCLUDE_DIRS} |
| 186 | ${HCCL_EXTERNAL_INCLUDE} | 186 | ${HCCL_EXTERNAL_INCLUDE} |
| 187 | + ${OPS_MATH_DIR}/common/inc | ||
| 187 | ${OPS_MATH_DIR}/common/inc/op_api | 188 | ${OPS_MATH_DIR}/common/inc/op_api |
| 188 | ${METADEF_INCLUDE_DIRS} | 189 | ${METADEF_INCLUDE_DIRS} |
| 189 | ) | 190 | ) |
| @@ -0,0 +1,34 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| 3 | + * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | + * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | + * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 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. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +namespace aicpu { | ||
| 17 | +__attribute__((weak)) bool RegistCpuKernelV2(const std::string &type, const KERNEL_CREATOR_FUN &fun); | ||
| 18 | +} // namespace aicpu | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + static std::shared_ptr<aicpu::CpuKernel> Creator_# | ||
| 23 | + { \ | ||
| 24 | + return aicpu::MakeShared<clazz>(); \ | ||
| 25 | + } \ | ||
| 26 | + static bool g_# | ||
| 27 | + ((&::aicpu::RegistCpuKernelV2) != nullptr) \ | ||
| 28 | + ? ::aicpu::RegistCpuKernelV2((type), Creator_# | ||
| 29 | + : ::aicpu::RegistCpuKernel((type), Creator_# | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + | ||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | 21 | ||
| @@ -484,7 +485,7 @@ uint32_t TileCpuKernel::Compute(CpuKernelContext &ctx) { | |||
| 484 | return KERNEL_STATUS_OK; | 485 | return KERNEL_STATUS_OK; |
| 485 | } | 486 | } |
| 486 | 487 | ||
| 487 | -REGISTER_CPU_KERNEL(kTile, TileCpuKernel); | 488 | +OPS_MATH_REGISTER_CPU_KERNELV2(kTile, TileCpuKernel); |
| 488 | 489 | ||
| 489 | template <typename T> | 490 | template <typename T> |
| 490 | void TileCpuKernel::TileCompute3DSharderFirst(const CpuKernelContext &ctx, T *input_x_data, T *output_data, | 491 | void TileCpuKernel::TileCompute3DSharderFirst(const CpuKernelContext &ctx, T *input_x_data, T *output_data, |