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