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_BROADCAST_SOLE_EXECUTOR
12 : #define HCCLV2_INS_BROADCAST_SOLE_EXECUTOR
13 :
14 : #include "ins_coll_alg_base.h"
15 :
16 : namespace Hccl {
17 :
18 : template <typename AlgTopoMatch, typename InsAlgTemplate> class InsBroadcastSoleExecutor : public InsCollAlgBase {
19 : public:
20 : explicit InsBroadcastSoleExecutor();
21 : ~InsBroadcastSoleExecutor() override;
22 :
23 0 : std::string Describe() const override
24 : {
25 0 : return "Instruction based broadcast Sole Executor.";
26 : }
27 :
28 : HcclResult Orchestrate(const AlgTopoInfo &topoInfo, const CollAlgOperator &op, const CollAlgParams ¶ms,
29 : ConnectedLinkMgr *linkMgr, InsQuePtr insQue) override;
30 : HcclResult Orchestrate(const RankGraph *rankGraph, const CollAlgOperator &op, const CollAlgParams ¶ms,
31 : InsQuePtr insQue) override;
32 : HcclResult CalcResOffload(const RankGraph *rankGraph, const u64 &dataSize,
33 : CollOffloadOpResReq &resReq) override;
34 : HcclResult CalcRes(const RankGraph *rankGraph, CollAlgResReq &algResReq) override;
35 :
36 : private:
37 : HcclResult OrchestrateOffload(InsAlgTemplate &tempAlg);
38 : HcclResult OrchestrateOpbase(InsAlgTemplate &tempAlg);
39 :
40 : std::vector<RankId> virtRanks_;
41 : std::map<RankId, u32> virtRankMap_; // map<virtRank, virtRankOrder>
42 : std::vector<std::vector<RankId>> vTopo_;
43 :
44 : std::vector<InsQuePtr> requiredQue_;
45 : ResLinks tempResLinks_;
46 : };
47 :
48 : } // namespace Hccl
49 :
50 : #endif // #ifndef HCCLV2_INS_BROADCAST_SOLE_EXECUTOR
|