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_SOLE_EXECUTOR
12 : #define HCCLV2_ALL_GATHER_SOLE_EXECUTOR
13 :
14 : #include <string>
15 : #include <vector>
16 : #include <map>
17 :
18 : #include <hccl/hccl_types.h>
19 : #include "hccl/base.h"
20 : #include "types/types.h"
21 : #include "coll_alg_params.h"
22 : #include "connected_link_mgr.h"
23 : #include "template_utils.h"
24 : #include "alg_template_base_v2.h"
25 : #include "hccl_params_pub.h"
26 : #include "coll_alg_base.h"
27 : #include "rank_gph.h"
28 : #include "coll_operator.h"
29 :
30 : namespace Hccl {
31 :
32 : template <typename AlgTopoMatch, typename AlgTemplate> class AllGatherSoleExecutor : public CollAlgBase {
33 : public:
34 : explicit AllGatherSoleExecutor();
35 : ~AllGatherSoleExecutor() override;
36 :
37 0 : std::string Describe() const override
38 : {
39 0 : return "All Gather Sole Executor.";
40 : }
41 :
42 : HcclResult GenPrimQues(const RankGraph *rankGraph, const CollAlgOperator &op, const CollAlgParams ¶ms,
43 : PrimQuePtr primQue) override;
44 : HcclResult CalcResOffload(const RankGraph *rankGraph, const u64 &dataSize,
45 : CollOffloadOpResReq &resReq) override;
46 : HcclResult CalcRes(const RankGraph *rankGraph, CollAlgResReq &algResReq) override;
47 :
48 : HcclResult GenPrimQuesAIC(const AlgTopoInfo &topoInfo, const CollAlgOperator &op, const CollAlgParams ¶ms,
49 : ConnectedLinkMgr *linkMgr, PrimQuePtr primQue) override;
50 :
51 : private:
52 : HcclResult GenPrimQues4Offload(AlgTemplateBase &tempAlg);
53 : HcclResult GenPrimQues4Opbase(const u32 dataSizePerVolume, AlgTemplateBase &tempAlg);
54 :
55 : std::vector<RankId> virtRanks_;
56 : std::map<RankId, u32> virtRankMap_; // map<virtRank, virtRankOrder>
57 : std::vector<std::vector<RankId>> vTopo_;
58 :
59 : std::vector<PrimQuePtr> requiredQue_;
60 : ResLinks tempResLinks_;
61 : };
62 :
63 : } // namespace Hccl
64 :
65 : #endif // HCCLV2_ALL_GATHER_SOLE_EXECUTOR
|