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>
33 : class AllGatherSoleExecutor : public CollAlgBase {
34 : public:
35 : explicit AllGatherSoleExecutor();
36 : ~AllGatherSoleExecutor() override;
37 :
38 0 : std::string Describe() const override { return "All Gather Sole Executor."; }
39 :
40 : HcclResult GenPrimQues(
41 : const RankGraph* rankGraph, const CollAlgOperator& op, const CollAlgParams& params,
42 : PrimQuePtr primQue) override;
43 : HcclResult CalcResOffload(const RankGraph* rankGraph, const u64& dataSize, CollOffloadOpResReq& resReq) override;
44 : HcclResult CalcRes(const RankGraph* rankGraph, CollAlgResReq& algResReq) override;
45 :
46 : HcclResult GenPrimQuesAIC(
47 : const AlgTopoInfo& topoInfo, const CollAlgOperator& op, const CollAlgParams& params, ConnectedLinkMgr* linkMgr,
48 : PrimQuePtr primQue) override;
49 :
50 : private:
51 : HcclResult GenPrimQues4Offload(AlgTemplateBase& tempAlg);
52 : HcclResult GenPrimQues4Opbase(const u32 dataSizePerVolume, AlgTemplateBase& tempAlg);
53 :
54 : std::vector<RankId> virtRanks_;
55 : std::map<RankId, u32> virtRankMap_; // map<virtRank, virtRankOrder>
56 : std::vector<std::vector<RankId>> vTopo_;
57 :
58 : std::vector<PrimQuePtr> requiredQue_;
59 : ResLinks tempResLinks_;
60 : };
61 :
62 : } // namespace Hccl
63 :
64 : #endif // HCCLV2_ALL_GATHER_SOLE_EXECUTOR
|