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 "batch_send_recv_auto_selector.h"
12 : #include "selector_registry.h"
13 : #include "coll_operator.h"
14 :
15 : namespace Hccl {
16 :
17 0 : SelectorStatus BatchSendRecvAutoSelector::SelectAicpuAlgo(
18 : const TopoInfo& topoInfo, const CollAlgOperator& op,
19 : const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
20 : {
21 : (void)topoInfo;
22 : std::vector<HcclAlgoType> algos
23 0 : = std::vector<HcclAlgoType>(HCCL_ALGO_LEVEL_NUM, HcclAlgoType::HCCL_ALGO_TYPE_DEFAULT);
24 0 : auto it = configAlgMap.find(op.opType);
25 0 : if (it != configAlgMap.end()) {
26 0 : algos = it->second;
27 : }
28 :
29 0 : HCCL_INFO(
30 : "hccl algo op config: config opType:%s, level0:%u, level1:%u, level2:%u, level3:%u",
31 : op.opType.Describe().c_str(), algos[0], algos[1], algos[2], algos[3]);
32 :
33 0 : primQueueGenName = "InsBatchSendRecv";
34 0 : return SelectorStatus::MATCH;
35 0 : }
36 :
37 0 : SelectorStatus BatchSendRecvAutoSelector::SelectAivAlgo(
38 : const TopoInfo& topoInfo, const CollAlgOperator& op,
39 : const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
40 : {
41 : (void)topoInfo;
42 : std::vector<HcclAlgoType> algos
43 0 : = std::vector<HcclAlgoType>(HCCL_ALGO_LEVEL_NUM, HcclAlgoType::HCCL_ALGO_TYPE_DEFAULT);
44 0 : auto it = configAlgMap.find(op.opType);
45 0 : if (it != configAlgMap.end()) {
46 0 : algos = it->second;
47 : }
48 :
49 0 : HCCL_INFO("[BatchSendRecvAutoSelector] select AIV algo for BatchSendRecv");
50 :
51 0 : primQueueGenName = "AivBatchSendRecv";
52 0 : return SelectorStatus::MATCH;
53 0 : }
54 :
55 : REGISTER_SELECTOR_BY_OPTYPE(OpType::BATCHSENDRECV, 18, BatchSendRecvAutoSelector);
56 : } // namespace Hccl
|