已合并
refactor(unique): move aclnnUnique APIs to owning operator directory #8848
陈展熹创建于 24 天前
refactor(unique): move aclnnUnique APIs to owning operator directory #8848
已合并
共 26 个文件变更+25-41
| @@ -2484,10 +2484,10 @@ sort@ops-nn: | |||
| 2484 | src: | 2484 | src: |
| 2485 | release: | 2485 | release: |
| 2486 | style: | 2486 | style: |
| 2487 | - - ops/ops-nn/index/scatter_elements/op_api/aclnn_unique.cpp | 2487 | + - ops/ops-nn/index/unique_consecutive/op_api/aclnn_unique.cpp |
| 2488 | - - ops/ops-nn/index/scatter_elements/op_api/aclnn_unique.h | 2488 | + - ops/ops-nn/index/unique_consecutive/op_api/aclnn_unique.h |
| 2489 | - - ops/ops-nn/index/scatter_elements/op_api/aclnn_unique2.cpp | 2489 | + - ops/ops-nn/index/unique_consecutive/op_api/aclnn_unique2.cpp |
| 2490 | - - ops/ops-nn/index/scatter_elements/op_api/aclnn_unique2.h | 2490 | + - ops/ops-nn/index/unique_consecutive/op_api/aclnn_unique2.h |
| 2491 | opensource_style: null | 2491 | opensource_style: null |
| 2492 | kernel_style: null | 2492 | kernel_style: null |
| 2493 | unrelease: | 2493 | unrelease: |
| @@ -451,8 +451,8 @@ | |||
| 451 | | [aclnnTransQuantParamV3](../../quant/trans_quant_param_v2/docs/aclnnTransQuantParamV3.md) | 完成量化计算参数scale数据类型的转换,将Float32的数据类型转换为硬件需要的UINT64,INT64类型。 | 默认确定性实现 | 默认确定性实现 | | 451 | | [aclnnTransQuantParamV3](../../quant/trans_quant_param_v2/docs/aclnnTransQuantParamV3.md) | 完成量化计算参数scale数据类型的转换,将Float32的数据类型转换为硬件需要的UINT64,INT64类型。 | 默认确定性实现 | 默认确定性实现 | |
| 452 | | [aclnnTopKTopPSample](../../index/top_k_top_p_sample/docs/aclnnTopKTopPSample.md) | 根据输入词频logits、topK/topP采样参数、随机采样权重分布q,进行topK-topP-sample采样计算,输出每个batch的最大词频logitsSelectIdx,以及topK-topP采样后的词频分布logitsTopKPSelect。 | 默认确定性实现 | - | | 452 | | [aclnnTopKTopPSample](../../index/top_k_top_p_sample/docs/aclnnTopKTopPSample.md) | 根据输入词频logits、topK/topP采样参数、随机采样权重分布q,进行topK-topP-sample采样计算,输出每个batch的最大词频logitsSelectIdx,以及topK-topP采样后的词频分布logitsTopKPSelect。 | 默认确定性实现 | - | |
| 453 | | [aclnnTopKTopPSampleV2](../../index/top_k_top_p_sample_v2/docs/aclnnTopKTopPSampleV2.md) | 根据输入词频logits、topK/topP/minP采样参数、随机采样权重分布q,进行topK-topP-minP-sample采样计算。当输入isNeedSampleResult为false时,输出每个batch的最大词频logitsSelectIdx,以及topK-topP-minP采样后的词频分布logitsTopKPSelect;当输入isNeedSampleResult为true时,输出topK-topP-minP采样后的中间计算结果logitsIdx和logitsSortMasked,其中logitsSortMasked为词频logits经过topK-topP-minP采样计算后的中间结果,logitsIdx为logitsSortMasked在logits中对应的索引。 | 默认确定性实现 | - | | 453 | | [aclnnTopKTopPSampleV2](../../index/top_k_top_p_sample_v2/docs/aclnnTopKTopPSampleV2.md) | 根据输入词频logits、topK/topP/minP采样参数、随机采样权重分布q,进行topK-topP-minP-sample采样计算。当输入isNeedSampleResult为false时,输出每个batch的最大词频logitsSelectIdx,以及topK-topP-minP采样后的词频分布logitsTopKPSelect;当输入isNeedSampleResult为true时,输出topK-topP-minP采样后的中间计算结果logitsIdx和logitsSortMasked,其中logitsSortMasked为词频logits经过topK-topP-minP采样计算后的中间结果,logitsIdx为logitsSortMasked在logits中对应的索引。 | 默认确定性实现 | - | |
| 454 | -| [aclnnUnique](../../index/scatter_elements/docs/aclnnUnique.md) | 返回输入张量中的唯一元素。 | 默认确定性实现 | 默认确定性实现 | | 454 | +| [aclnnUnique](../../index/unique_consecutive/docs/aclnnUnique.md) | 返回输入张量中的唯一元素。 | 默认确定性实现 | 默认确定性实现 | |
| 455 | -| [aclnnUnique2](../../index/scatter_elements/docs/aclnnUnique2.md) | 对输入张量self进行去重,返回self中的唯一元素。unique功能的增强,新增返回值countsOut,表示valueOut中各元素在输入self中出现的次数,用returnCounts参数控制。 | 默认确定性实现 | 默认确定性实现 | | 455 | +| [aclnnUnique2](../../index/unique_consecutive/docs/aclnnUnique2.md) | 对输入张量self进行去重,返回self中的唯一元素。unique功能的增强,新增返回值countsOut,表示valueOut中各元素在输入self中出现的次数,用returnCounts参数控制。 | 默认确定性实现 | 默认确定性实现 | |
| 456 | | [aclnnUniqueConsecutive](../../index/unique_consecutive/docs/aclnnUniqueConsecutive.md) | 去除每一个元素后的重复元素。当dim不为空时,去除对应维度上的每一个张量后的重复张量。 | 默认确定性实现 | 默认确定性实现 | | 456 | | [aclnnUniqueConsecutive](../../index/unique_consecutive/docs/aclnnUniqueConsecutive.md) | 去除每一个元素后的重复元素。当dim不为空时,去除对应维度上的每一个张量后的重复张量。 | 默认确定性实现 | 默认确定性实现 | |
| 457 | | [aclnnUniqueDim](../../index/unique_with_counts_ext2/docs/aclnnUniqueDim.md) | 在某一dim轴上,对输入张量self做去重操作。 | 默认确定性实现 | 默认确定性实现 | | 457 | | [aclnnUniqueDim](../../index/unique_with_counts_ext2/docs/aclnnUniqueDim.md) | 在某一dim轴上,对输入张量self做去重操作。 | 默认确定性实现 | 默认确定性实现 | |
| 458 | | [aclnnWeightQuantBatchMatmulNz](../../matmul/weight_quant_batch_matmul_v2/docs/aclnnWeightQuantBatchMatmulNz.md) | 完成一个输入为伪量化场景的矩阵乘计算,仅支持NZ场景。 | - | 默认确定性实现 | | 458 | | [aclnnWeightQuantBatchMatmulNz](../../matmul/weight_quant_batch_matmul_v2/docs/aclnnWeightQuantBatchMatmulNz.md) | 完成一个输入为伪量化场景的矩阵乘计算,仅支持NZ场景。 | - | 默认确定性实现 | |
| @@ -12,4 +12,4 @@ | |||
| 12 | set(SUPPORT_COMPUTE_UNIT "ascend950" "mc62") | 12 | set(SUPPORT_COMPUTE_UNIT "ascend950" "mc62") |
| 13 | # 设置每种芯片类型对应的tiling文件目录,即采用op_host目录下哪个文件夹下的tiling文件编译 | 13 | # 设置每种芯片类型对应的tiling文件目录,即采用op_host目录下哪个文件夹下的tiling文件编译 |
| 14 | set(SUPPORT_TILING_DIR "arch35" "arch35") | 14 | set(SUPPORT_TILING_DIR "arch35" "arch35") |
| 15 | -add_modules_sources(HOSTNAME ${OPHOST_NAME} MODE PRIVATE DIR ${CMAKE_CURRENT_SOURCE_DIR} OPTYPE scatter_elements ACLNNTYPE aclnn_exclude COMPUTE_UNIT ${SUPPORT_COMPUTE_UNIT} TILING_DIR ${SUPPORT_TILING_DIR} DISABLE_IN_OPP TRUE DEPENDENCIES scatter_elements_v2 unique_consecutive scatter_update unique_with_counts_and_sorting tf_scatter_add scatter_nd_add) | 15 | +add_modules_sources(HOSTNAME ${OPHOST_NAME} MODE PRIVATE DIR ${CMAKE_CURRENT_SOURCE_DIR} OPTYPE scatter_elements ACLNNTYPE aclnn_exclude COMPUTE_UNIT ${SUPPORT_COMPUTE_UNIT} TILING_DIR ${SUPPORT_TILING_DIR} DISABLE_IN_OPP TRUE DEPENDENCIES scatter_elements_v2 scatter_update tf_scatter_add scatter_nd_add) |
| @@ -1,19 +1,16 @@ | |||
| 1 | # ---------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 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 | 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"). | 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. | 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, | 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. | 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 | -file(GLOB CURRENT_DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) | 11 | +add_modules_sources(HOSTNAME ${OPHOST_NAME} MODE PRIVATE DIR ${CMAKE_CURRENT_SOURCE_DIR} |
| 12 | -if(NOT ENABLE_TEST AND NOT BENCHMARK) | 12 | + OPTYPE unique_consecutive ACLNNTYPE aclnn_exclude |
| 13 | - list(REMOVE_ITEM CURRENT_DIRS tests) | 13 | + DEPENDENCIES scatter_elements_v2 unique_with_counts_and_sorting) |
| 14 | +if (TARGET ${OPHOST_NAME}_tiling_obj) | ||
| 15 | + target_sources(${OPHOST_NAME}_tiling_obj PRIVATE op_host/unique_consecutive_def.cpp) | ||
| 14 | endif() | 16 | endif() |
| 15 | -foreach(SUB_DIR ${CURRENT_DIRS}) | ||
| 16 | - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/CMakeLists.txt") | ||
| 17 | - add_subdirectory(${SUB_DIR}) | ||
| 18 | - endif() | ||
| 19 | -endforeach() | ||
Rindex/scatter_elements/examples/test_aclnn_unique.cpp→index/unique_consecutive/examples/test_aclnn_unique.cpp+0-0
文件重命名但无更改。
Rindex/scatter_elements/op_api/aclnn_unique.cpp→index/unique_consecutive/op_api/aclnn_unique.cpp+1-1
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | -#include "index/unique_consecutive/op_host/op_api/unique_consecutive.h" | 17 | +#include "index/unique_consecutive/op_api/unique_consecutive.h" |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | 20 | ||
Rindex/scatter_elements/op_api/aclnn_unique2.cpp→index/unique_consecutive/op_api/aclnn_unique2.cpp+1-1
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | -#include "index/unique_consecutive/op_host/op_api/unique_consecutive.h" | 17 | +#include "index/unique_consecutive/op_api/unique_consecutive.h" |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | 20 | ||
Rindex/unique_consecutive/op_host/op_api/aclnn_unique_consecutive.cpp→index/unique_consecutive/op_api/aclnn_unique_consecutive.cpp+0-0
文件重命名但无更改。
Rindex/unique_consecutive/op_host/op_api/aclnn_unique_consecutive.h→index/unique_consecutive/op_api/aclnn_unique_consecutive.h+0-0
文件重命名但无更改。
Rindex/scatter_elements/op_api/unique_common.cpp→index/unique_consecutive/op_api/unique_common.cpp+0-0
文件重命名但无更改。
Rindex/unique_consecutive/op_host/op_api/unique_consecutive.cpp→index/unique_consecutive/op_api/unique_consecutive.cpp+0-0
文件重命名但无更改。
Rindex/unique_consecutive/op_host/op_api/unique_consecutive.h→index/unique_consecutive/op_api/unique_consecutive.h+0-0
文件重命名但无更改。
| @@ -1,12 +0,0 @@ | |||
| 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 | -add_modules_sources(HOSTNAME ${OPHOST_NAME} MODE PRIVATE DIR ${CMAKE_CURRENT_SOURCE_DIR} OPTYPE unique_consecutive ACLNNTYPE aclnn_exclude) | ||
| 12 | -target_sources(${OPHOST_NAME}_tiling_obj PRIVATE unique_consecutive_def.cpp) | ||
Rindex/scatter_elements/tests/st/aclnnUnique/atk_aclnnUnique.json→index/unique_consecutive/tests/st/aclnnUnique/atk_aclnnUnique.json+0-0
文件重命名但无更改。
Rindex/scatter_elements/tests/st/aclnnUnique/executor_aclnnUnique.py→index/unique_consecutive/tests/st/aclnnUnique/executor_aclnnUnique.py+0-0
文件重命名但无更改。
Rindex/scatter_elements/tests/st/aclnnUnique2/atk_aclnnUnique2.json→index/unique_consecutive/tests/st/aclnnUnique2/atk_aclnnUnique2.json+0-0
文件重命名但无更改。
Rindex/scatter_elements/tests/st/aclnnUnique2/executor_aclnnUnique2.py→index/unique_consecutive/tests/st/aclnnUnique2/executor_aclnnUnique2.py+0-0
文件重命名但无更改。
Rindex/scatter_elements/tests/ut/op_host/test_aclnn_unique.cpp→index/unique_consecutive/tests/ut/op_host/test_aclnn_unique.cpp+0-0
文件重命名但无更改。
Rindex/scatter_elements/tests/ut/op_host/test_aclnn_unique2.cpp→index/unique_consecutive/tests/ut/op_host/test_aclnn_unique2.cpp+1-1
| @@ -220,4 +220,4 @@ TEST_F(l2_unique2_test, case_020_SHAPE_UNCONSISTENT) | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | // dim长度必须小于8 | 222 | // dim长度必须小于8 |
| 223 | -TEST_F(l2_unique2_test, case_021_DIM_OVERSIZE) { test_run_invalid(ACL_FLOAT, ACL_FORMAT_ND, 10); } | 223 | +TEST_F(l2_unique2_test, case_021_DIM_OVERSIZE) { test_run_invalid(ACL_FLOAT, ACL_FORMAT_ND, 10); } |
| @@ -1,18 +1,17 @@ | |||
| 1 | /** | 1 | /** |
| 2 | - * This program is free software, you can redistribute it and/or modify. | ||
| 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 | 6 | + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | - * BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. See LICENSE in the root of | 7 | + * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | - * 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. |
| 10 | */ | 9 | */ |
| 11 | 10 | ||
| 12 | 11 | ||
| 13 | 12 | ||
| 14 | 13 | ||
| 15 | -#include "../../../op_host/op_api/aclnn_unique_consecutive.h" | 14 | +#include "../../../op_api/aclnn_unique_consecutive.h" |
| 16 | 15 | ||
| 17 | 16 | ||
| 18 | 17 | ||