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_ALL_GATHER_SEQ_EXECUTOR
12 : #define HCCLV2_ALL_GATHER_SEQ_EXECUTOR
13 :
14 : #include "temp_all_gather_ring.h"
15 : #include "temp_all_gather_mesh.h"
16 : #include "coll_alg_base.h"
17 : #include "topo_match_mesh_ring.h"
18 :
19 : namespace Hccl {
20 : template <typename AlgTopoMatch, typename AlgTemp0, typename AlgTemp1>
21 : class AllGatherSeqExecutor : public CollAlgBase {
22 : public:
23 : explicit AllGatherSeqExecutor();
24 : ~AllGatherSeqExecutor() override;
25 :
26 0 : std::string Describe() const override { return "All Gather Sequential Executor."; }
27 :
28 : HcclResult GenPrimQues(
29 : const RankGraph* rankGraph, const CollAlgOperator& op, const CollAlgParams& params,
30 : PrimQuePtr primQue) override;
31 : HcclResult CalcResOffload(const RankGraph* rankGraph, const u64& dataSize, CollOffloadOpResReq& resReq) override;
32 : HcclResult CalcRes(const RankGraph* rankGraph, CollAlgResReq& algResReq) override;
33 :
34 : HcclResult GenPrimQuesAIC(
35 : const AlgTopoInfo& topoInfo, const CollAlgOperator& op, const CollAlgParams& params, ConnectedLinkMgr* linkMgr,
36 : PrimQuePtr primQue) override;
37 :
38 : private:
39 : HcclResult GenPrimQues4Offload(AlgTemplateBase& tempAlg0, AlgTemplateBase& tempAlg1);
40 : HcclResult GenPrimQues4Opbase(const u32 dataSizePerVolume, AlgTemplateBase& tempAlg0, AlgTemplateBase& tempAlg1);
41 :
42 : HcclResult PrepRes(const RankGraph* rankGraph, const LinkReq& linkReq, ResLinks& resLinks);
43 :
44 : std::vector<std::vector<RankId>> virtRanks_;
45 : std::vector<std::map<RankId, u32>> virtRankMap_; // map<virtRank, virtRankOrder>
46 : std::vector<std::vector<std::vector<RankId>>> vTopo_;
47 :
48 : std::vector<u32> tempRankSizes_;
49 : std::vector<std::vector<PrimQuePtr>> tempRequiredQues_;
50 : std::vector<ResLinks> tempResLinks_;
51 : };
52 :
53 : } // namespace Hccl
54 :
55 : #endif // HCCLV2_ALL_GATHER_SEQ_EXECUTOR
|