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_REDUCE_SCATTER_SOLE_EXECUTOR
12 : #define HCCLV2_REDUCE_SCATTER_SOLE_EXECUTOR
13 :
14 : #include "temp_reduce_scatter_ring.h"
15 : #include "temp_reduce_scatter_concurr_mesh.h"
16 : #include "temp_reduce_scatter_mesh.h"
17 : #include "coll_alg_base.h"
18 : #include "topo_match_concurr_mesh.h"
19 : #include "topo_match_mesh.h"
20 :
21 : namespace Hccl {
22 :
23 : template <typename AlgTopoMatch, typename AlgTemplate> class ReduceScatterSoleExecutor : public CollAlgBase {
24 : public:
25 : explicit ReduceScatterSoleExecutor();
26 : ~ReduceScatterSoleExecutor() override;
27 :
28 0 : std::string Describe() const override
29 : {
30 0 : return "Reduce Scatter Sole Executor.";
31 : }
32 :
33 : HcclResult GenPrimQues(const RankGraph *rankGraph, const CollAlgOperator &op, const CollAlgParams ¶ms,
34 : PrimQuePtr primQue) override;
35 : HcclResult CalcResOffload(const RankGraph *rankGraph, const u64 &dataSize,
36 : CollOffloadOpResReq &resReq) override;
37 :
38 : HcclResult CalcRes(const RankGraph *rankGraph, CollAlgResReq &algResReq) override;
39 :
40 : HcclResult GenPrimQuesAIC(const AlgTopoInfo &topoInfo, const CollAlgOperator &op, const CollAlgParams ¶ms,
41 : ConnectedLinkMgr *linkMgr, PrimQuePtr primQue) override;
42 :
43 : private:
44 : HcclResult GenPrimQues4Offload(AlgTemplateBase &tempAlg);
45 : HcclResult GenPrimQues4Opbase(const u32 requiredScratchMultiplier, const u32 dataSizePerVolume,
46 : AlgTemplateBase &tempAlg);
47 :
48 : std::vector<RankId> virtRanks_;
49 : std::map<RankId, u32> virtRankMap_; // map<virtRank, virtRankOrder>
50 : std::vector<std::vector<RankId>> vTopo_;
51 :
52 : std::vector<PrimQuePtr> requiredQue_;
53 : ResLinks tempResLinks_;
54 : };
55 :
56 : } // namespace Hccl
57 :
58 : #endif // HCCLV2_REDUCE_SCATTER_SOLE_EXECUTOR
|