/**
* Copyright (c) 2025 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 "common.h"
#include "aiv_all_gather_mesh_1d.h"
using namespace ops_hccl_allgather;
#define CALL_AIV_KERNEL(type) \
{ \
ExtraArgs extraArgsLocal = param.extraArgs; \
AivAllGatherV2Mesh1D<type>( \
(GM_ADDR)param.buffIn, \
param.input, param.output, \
param.rank, param.rankSize, param.xRankSize, param.yRankSize, param.zRankSize, param.len, \
param.dataType, param.reduceOp, param.root, param.tagId, \
param.inputSliceStride, param.outputSliceStride, param.repeatNum, param.inputRepeatStride, param.outputRepeatStride, \
param.isOpBase, \
(GM_ADDR)param.headCountMem, (GM_ADDR)param.tailCountMem, (GM_ADDR)param.addOneMem, param.counterMemSize, param.isEnableCounter, \
extraArgsLocal \
); \
}
extern "C" __global__ __aicore__ void HcclAllGatherAivKernel(OpParam param) {
switch(param.dataType) {
case AscendC::HCCL_DATA_TYPE_INT8:
CALL_AIV_KERNEL(int8_t);
break;
case AscendC::HCCL_DATA_TYPE_INT32:
CALL_AIV_KERNEL(int32_t);
break;
case AscendC::HCCL_DATA_TYPE_FP16:
CALL_AIV_KERNEL(half);
break;
case AscendC::HCCL_DATA_TYPE_FP32:
CALL_AIV_KERNEL(float);
break;
default:
break;
}
}
EXPORT_AIV_META_INFO(HcclAllGatherAivKernel);