* Copyright (c) 2026 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* 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.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#include "kernel_operator.h"
#include "kernel_operator_list_tensor_intf.h"
#include "parallel_concat_tiling_struct.h"
#include "parallel_concat_struct.h"
#include "parallel_concat_kernel_simt.h"
#include "parallel_concat_kernel_simd.h"
template <int COPY_MODE>
__global__ __aicore__ void parallel_concat(GM_ADDR values, GM_ADDR output_data, GM_ADDR workspace, GM_ADDR tiling)
{
KERNEL_TASK_TYPE_DEFAULT(KERNEL_TYPE_AIV_ONLY);
REGISTER_TILING_DEFAULT(ParallelConcatTilingData);
GET_TILING_DATA_WITH_STRUCT(ParallelConcatTilingData, tilingData, tiling);
if (tilingData.totalBytes == 0) {
return;
}
if constexpr (COPY_MODE == PARALLELCONCAT_COPY_MODE_SIMT) {
AscendC::InitSocState();
ParallelConcatKernelSimt kernel;
kernel.Init(values, output_data, &tilingData);
kernel.Process();
} else {
AscendC::TPipe pipe;
ParallelConcatKernelSimd kernel;
kernel.Init(values, output_data, &tilingData, &pipe);
kernel.Process();
}
}