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