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 COLL_ALLGATHER_RING_FOR_910_93_EXECUTOR_H
12 : #define COLL_ALLGATHER_RING_FOR_910_93_EXECUTOR_H
13 : #include "coll_all_gather_executor.h"
14 : namespace hccl {
15 : class CollAllGatherRingFor91093Executor : public CollAllGatherExecutor {
16 : public:
17 : explicit CollAllGatherRingFor91093Executor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher);
18 2 : ~CollAllGatherRingFor91093Executor() override = default;
19 :
20 : private:
21 : /* *************** 资源计算 *************** */
22 : HcclResult CalcStreamNum(u32& streamNum) override;
23 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
24 : HcclResult CalcLevel0CommInfo(TransportMemType inputType, TransportMemType outputType,
25 : std::vector<LevelNSubCommTransport>& opTransport) override;
26 : HcclResult CalcLevel2CommInfo(TransportMemType inputType, TransportMemType outputType,
27 : std::vector<LevelNSubCommTransport>& opTransport) override;
28 : HcclResult CalcTransportMemType(TransportMemType &inputType, TransportMemType &outputType);
29 :
30 : /* *************** 算法编排 *************** */
31 : u64 CalcLoopMaxCount(const u64 cclBuffSize, const u32 unitSize) override;
32 :
33 : virtual u64 CalcDstMemOffset(const OpParam ¶m, u32 perDataSize, u64 inputMemSize) const;
34 : virtual HcomCollOpInfo GetHcomCollOpInfo(const OpParam ¶m, const ExecMem &execMem) const;
35 : virtual std::vector<Slice> PrepareSlicesL2(const OpParam ¶m, const SubCommInfo &level2CommInfo,
36 : const SubCommInfo &level1CommInfo, const SubCommInfo &level0CommInfo, u32 perDataSize, u64 inputMemSize) const;
37 : virtual std::vector<Slice> PrepareSlicesL1(const OpParam ¶m, const SubCommInfo &level2CommInfo,
38 : const SubCommInfo &level1CommInfo, const SubCommInfo &level0CommInfo, u32 perDataSize, u64 inputMemSize) const;
39 : virtual HcclResult PrepareSlicesL0(std::vector<std::vector<Slice>> &multRingsSlice, const OpParam ¶m,
40 : const SubCommInfo &level2CommInfo, const SubCommInfo &level1CommInfo, const SubCommInfo &level0CommInfo,
41 : u32 perDataSize, u64 inputMemSize);
42 : virtual HcclResult PrepareUserMemSlices(std::vector<std::vector<Slice>> &userMemSlices,
43 : const std::vector<std::vector<Slice>> &multRingsSlice, const OpParam ¶m, const SubCommInfo &level2CommInfo,
44 : const SubCommInfo &level1CommInfo, const SubCommInfo &level0CommInfo, u32 perDataSize, u64 inputMemSize);
45 : virtual HcclResult GetLevelCommInfo();
46 :
47 : virtual HcclResult RunIntraSeverAllGather(const std::string &tag, DeviceMem &inputMem, DeviceMem &outputMem,
48 : const u64 count, const HcclDataType &dataType,
49 : const std::vector<std::vector<Slice>> &multRingsSliceZero, const Stream &stream,
50 : s32 profStage, const u64 baseOffset = 0, const HcomCollOpInfo *opInfo = nullptr,
51 : const std::vector<std::vector<Slice>> &multRingsUserMemSlice = std::vector<std::vector<Slice>> (0));
52 : HcclResult KernelRun(const OpParam ¶m, ExecMem &execMem) override;
53 : HcclResult Getlevel1CommRank(SubCommInfo& level1CommInfo) override;
54 : HcclResult SelectTempAlg(std::unique_ptr<AlgTemplateBase> &level1TempAlg, u32 level1RankSize) override;
55 : protected:
56 : SubCommInfo logicalLevel0CommInfo_ = {0, 0, {}, {}};
57 : SubCommInfo logicalLevel1CommInfo_ = {0, 0, {}, {}};
58 : CommPlane logicalLevel0plane_ = COMM_LEVEL_RESERVED;
59 : CommPlane logicalLevel1plane_ = COMM_LEVEL_RESERVED;
60 : };
61 :
62 : } // namespace hccl
63 :
64 : #endif
|