Line data Source code
1 : /**
2 : * Copyright (c) 2025 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 : #include "batchsendrecv_operator.h"
12 : namespace hccl {
13 :
14 0 : BatchSendRecvOperator::BatchSendRecvOperator(AlgConfigurator* algConfigurator, CCLBufferManager &cclBufferManager,
15 0 : HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher)
16 0 : : CollAlgOperator(algConfigurator, cclBufferManager, dispatcher, topoMatcher, HcclCMDType::HCCL_CMD_BATCH_SEND_RECV)
17 : {
18 0 : }
19 :
20 0 : BatchSendRecvOperator::~BatchSendRecvOperator() {
21 0 : }
22 :
23 0 : HcclResult BatchSendRecvOperator::SelectAlg(const std::string& tag, const OpParam& param, std::string& algName,
24 : std::string& newTag)
25 : {
26 0 : if (retryEnable_ && param.aicpuUnfoldMode) {
27 0 : algName = "BatchSendRecvRetry";
28 0 : } else if (param.isGroupMode) {
29 0 : algName = "BatchSendRecvGroup";
30 : }
31 : else {
32 0 : algName = "BatchSendRecv";
33 : }
34 0 : newTag = tag;
35 0 : newTag += (param.aicpuUnfoldMode ? "_device" : "_host");
36 0 : HCCL_INFO("[BatchSendRecvOperator][SelectAlg] algName %s newTag %s", algName.c_str(), newTag.c_str());
37 0 : return HCCL_SUCCESS;
38 : }
39 :
40 : REGISTER_OP(HcclCMDType::HCCL_CMD_BATCH_SEND_RECV, BatchSendRecv, BatchSendRecvOperator);
41 : }
|