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_INS_V2_REDUCE_SCATTER_SOLE_EXECUTOR_H
12 : #define HCCLV2_INS_V2_REDUCE_SCATTER_SOLE_EXECUTOR_H
13 : #include "ins_coll_alg_base.h"
14 :
15 : namespace Hccl {
16 : template <typename AlgTopoMatch, typename InsAlgTemplate> class InsV2ReduceScatterSoleExecutor : public InsCollAlgBase {
17 : public:
18 : explicit InsV2ReduceScatterSoleExecutor();
19 : ~InsV2ReduceScatterSoleExecutor() override;
20 :
21 0 : std::string Describe() const override
22 : {
23 0 : return "Instruction based Reduce Scatter Seq Executor.";
24 : }
25 :
26 : // HOST 接口
27 : HcclResult Orchestrate(const RankGraph *rankGraph, const CollAlgOperator &op, const CollAlgParams ¶ms,
28 : InsQuePtr insQue) override;
29 :
30 : HcclResult CalcResOffload(const RankGraph *rankGraph, const u64 &dataSize,
31 : CollOffloadOpResReq &resReq) override;
32 :
33 : HcclResult CalcRes(const RankGraph *rankGraph, CollAlgResReq &algResReq) override;
34 :
35 : // AICPU 接口
36 : HcclResult Orchestrate(const AlgTopoInfo &topoInfo, const CollAlgOperator &op, const CollAlgParams ¶ms,
37 : ConnectedLinkMgr *linkMgr, InsQuePtr insQue) override;
38 :
39 : HcclResult CalNumBlocks(u32& numBlocks, u64 dataSize, u32 numBlocksLimit) override;
40 :
41 : private:
42 : HcclResult InitCommInfo(const RankGraph *rankGraph);
43 : HcclResult InitCommInfo(const AlgTopoInfo &topoInfo);
44 : HcclResult CreateTemplates(std::shared_ptr<InsAlgTemplate> &algTemplatePtr);
45 : HcclResult OrchestrateLoop(std::shared_ptr<InsAlgTemplate> algTemplate);
46 :
47 : std::map<RankId, u32> virtRankMap_;
48 : std::vector<std::vector<RankId>> vTopo_;
49 : ResLinks tempResLinks_;
50 : std::vector<InsQuePtr> tempInsQue_;
51 : std::vector<RankId> virtRanks_;
52 : };
53 : } // namespace Hccl
54 :
55 : #endif // HCCLV2_INS_V2_REDUCE_SCATTER_SOLE_EXECUTOR_H
|