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