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_TEMP_ALL_GATHER_RING
12 : #define HCCLV2_TEMP_ALL_GATHER_RING
13 :
14 : #include "string_util.h"
15 :
16 : #include "alg_template_base_v2.h"
17 :
18 : namespace Hccl {
19 :
20 : class TempAllGatherRing : public AlgTemplateBase {
21 : public:
22 : explicit TempAllGatherRing(
23 : const RankId virtualRank, const u32 tempRankSize, const std::vector<std::vector<RankId>>& tempVTopo,
24 : const std::map<RankId, u32>& tempVirtRankMap);
25 : ~TempAllGatherRing() override;
26 :
27 0 : std::string Describe() const override
28 : {
29 0 : return StringFormat("Template of all gather ring with tempRankSize [%u].", tempRankSize_);
30 : }
31 :
32 : HcclResult GenPrimQue(
33 : const TempFuncs& tempFuncs, const RankSliceInfo& sliceInfoVec, const BuffInfo& buffInfo,
34 : const ResLinks& tempLinks, std::vector<PrimQuePtr>& tempPrimQues) override;
35 : using AlgTemplateBase::CalcSliceInfo;
36 : HcclResult CalcSliceInfo(const AllignInfo& allignInfo, const u64 dataSize, RankSliceInfo& sliceInfoVec) override;
37 : using AlgTemplateBase::CalcRes;
38 : HcclResult CalcRes(AlgTempResReq& tempResReq) override;
39 :
40 : private:
41 : HcclResult
42 : PreCopyOffload(const RankSliceInfo& sliceInfoVec, const bool forAllReduce, std::vector<PrimQuePtr>& tempPrimQues);
43 : HcclResult RunIndividualRing(
44 : const u32 queIdx, const RankSliceInfo& sliceInfoVec, const ResLinks& tempLinks, PrimQuePtr currPrimQue);
45 :
46 : u32 stepNum_ = 0;
47 : };
48 :
49 : } // namespace Hccl
50 :
51 : #endif // !HCCLV2_TEMP_ALL_GATHER_RING
|