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_ALL_REDUCE_RING_FOR_910_93_EXECUTOR_H
12 : #define COLL_ALL_REDUCE_RING_FOR_910_93_EXECUTOR_H
13 :
14 : #include "coll_all_reduce_executor.h"
15 :
16 : namespace hccl {
17 : class CollAllReduceRingFor91093Executor : public CollAllReduceExecutor {
18 :
19 : public:
20 : CollAllReduceRingFor91093Executor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher);
21 6 : ~CollAllReduceRingFor91093Executor() override = default;
22 :
23 : private:
24 : /* *************** 资源计算 *************** */
25 : HcclResult CalcStreamNum(u32& streamNum) override;
26 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
27 : HcclResult CalcLevel0CommInfo(TransportMemType inputType,
28 : TransportMemType outputType,
29 : std::vector<LevelNSubCommTransport>& opTransport) override;
30 : HcclResult CalcLevel2CommInfo(TransportMemType inputType,
31 : TransportMemType outputType,
32 : std::vector<LevelNSubCommTransport>& opTransport) override;
33 : HcclResult CalcTransportMemType(TransportMemType &inputType, TransportMemType &outputType);
34 :
35 : /* *************** 算法编排 *************** */
36 : bool IsHugeData(const u64 curSize) override;
37 : bool IsSmallData(const u64 totalSize, const u64 curSize) override;
38 : virtual HcclResult RunIntraSeverReduceScatter(const std::string &tag, DeviceMem &inputMem, DeviceMem &outputMem,
39 : const u64 count, const HcclDataType &dataType, const HcclReduceOp &reductionOp,
40 : const std::vector<std::vector<Slice>> &multRingsSliceZero, const Stream &stream, s32 profStage,
41 : const u64 baseOffset = 0, const HcomCollOpInfo *opInfo = nullptr,
42 : const std::vector<std::vector<Slice>> &multRingsUserMemSlice = std::vector<std::vector<Slice>>(0),
43 : const bool disableDMAReduce = false);
44 : virtual HcclResult RunIntraSeverAllGather(const std::string &tag, DeviceMem &inputMem, DeviceMem &outputMem,
45 : const u64 count, const HcclDataType &dataType,
46 : const std::vector<std::vector<Slice>> &multRingsSliceZero, const Stream &stream,
47 : s32 profStage, const u64 baseOffset = 0, const HcomCollOpInfo *opInfo = nullptr,
48 : const std::vector<std::vector<Slice>> &multRingsUserMemSlice = std::vector<std::vector<Slice>> (0));
49 : HcclResult KernelRun(const OpParam ¶m, ExecMem &execMem) override;
50 : HcclResult Getlevel1CommRank(SubCommInfo& level1CommInfo) override;
51 : HcclResult SelectTempAlg(std::unique_ptr<AlgTemplateBase> &level1TempAlg, u32 level1RankSize) override;
52 : virtual HcclResult GetLevelCommInfo();
53 : HcclResult GetNicList(std::vector<u32> &mockNicList);
54 : HcclResult PrepareARSLevel1CommInfo(u32 &segmentIdx, u32 &commIndex, u64 &hdSize,
55 : const SubCommInfo &commInfo,
56 : const std::vector<std::vector<Slice>> &multRingsSliceZero,
57 : const std::string &tag, const std::vector<u32>& nicList);
58 : protected:
59 : SubCommInfo logicalLevel0CommInfo_ = {0, 0, {}, {}};
60 : SubCommInfo logicalLevel1CommInfo_ = {0, 0, {}, {}};
61 : CommPlane logicalLevel0plane_ = COMM_LEVEL_RESERVED;
62 : CommPlane logicalLevel1plane_ = COMM_LEVEL_RESERVED;
63 : };
64 :
65 : } // namespace hccl
66 :
67 : #endif
|