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 : #ifndef HCCLV2_TOPO_MATCH_MESH_NHR_PCIE
12 : #define HCCLV2_TOPO_MATCH_MESH_NHR_PCIE
13 : #include <string>
14 : #include <vector>
15 : #include <map>
16 :
17 : #include "types.h"
18 : #include "dev_type.h"
19 : #include "topo_match_base.h"
20 : #include "rank_gph.h"
21 :
22 : namespace Hccl {
23 :
24 : class TopoMatchMeshNHRPcie : public TopoMatchBase {
25 : public:
26 : explicit TopoMatchMeshNHRPcie(
27 : const RankId vRank, const u32 rankSize, const RankGraph* rankGraph, const DevType devType);
28 : ~TopoMatchMeshNHRPcie() override;
29 :
30 0 : std::string Describe() const override
31 : {
32 0 : return "Topo Match for combined Algorithm: level 0 Mesh, level 1 NHR, for PCIE only.";
33 : }
34 : using TopoMatchBase::MatchTopo;
35 : HcclResult MatchTopo(
36 : std::vector<std::vector<std::vector<RankId>>>& vTopo, std::vector<std::vector<RankId>>& virtRanks,
37 : std::vector<std::map<RankId, u32>>& virtRankMap) override;
38 :
39 : private:
40 : HcclResult LoadTopoInstRanks(u32 topoInstId, std::vector<RankId>& ranksOfSameLinkType) const;
41 : HcclResult DeduplicateLevelRanks(std::vector<RankId>& level0Ranks, std::vector<RankId>& level1Ranks) const;
42 : };
43 : } // namespace Hccl
44 :
45 : #endif // !HCCLV2_TOPO_MATCH_MESH_NHR
|