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