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_TEMP_ALL_GATHER_MESH
12 : #define HCCLV2_INS_TEMP_ALL_GATHER_MESH
13 :
14 : #include "string_util.h"
15 : #include "executor_utils.h"
16 : #include "ins_alg_template_base.h"
17 :
18 : namespace Hccl {
19 :
20 : class InsTempAllGatherMesh1DOpt : public InsAlgTemplateBase {
21 : public:
22 : explicit InsTempAllGatherMesh1DOpt(const RankId virtualRank, const u32 tempRankSize,
23 : const std::vector<std::vector<RankId>> &tempVTopo,
24 : const std::map<RankId, u32> &tempVirtRankMap);
25 : ~InsTempAllGatherMesh1DOpt() override;
26 :
27 0 : std::string Describe() const override
28 : {
29 0 : return StringFormat("Instruction based Template of all gather mesh with tempRankSize [%u].", tempRankSize_);
30 : }
31 :
32 : HcclResult GenExtIns(const TempFuncs &tempFuncs, const TemplateDataParams &tempAlgParams,
33 : const ResLinks &tempLinks, std::vector<InsQuePtr> &tempInsQues);
34 : HcclResult CalcSliceInfo(const AllignInfo &allignInfo, const u64 dataSize, RankSliceInfo &sliceInfoVec) override;
35 : HcclResult CalcRes(AlgTempResReq &tempResReq) override;
36 : u32 CalcScratchMultiple(const BufferType &inBufferTpye, const BufferType &outBufferTpye) const
37 : {
38 : (void) inBufferTpye;
39 : (void) outBufferTpye;
40 : HCCL_INFO(
41 : "[InsTempAllGatherMesh1DOpt][CalcScratchMultiple] templateScratchMultiplier[%llu]", tempRankSize_);
42 : return tempRankSize_;
43 : }
44 : private:
45 : HcclResult LocalCopyToScratch(InsQuePtr tempInsQue);
46 : HcclResult LocalCopyToUsrOut(InsQuePtr tempInsQue);
47 : HcclResult RunMesh(const u32 myAlgRank, const std::vector<RankId> &vTopo, std::vector<InsQuePtr> &tempInsQues);
48 :
49 : u32 majorQueNum_ = 0;
50 : u32 queNumPerNeighbor_ = 1;
51 : bool enableInterRankCounterNotify_ = false;
52 : TemplateDataParams tempAlgParams_;
53 : ResLinks tempLinks_;
54 : };
55 :
56 : } // namespace Hccl
57 :
58 : #endif // !HCCLV2_INS_TEMP_ALL_GATHER_MESH
|