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 : public:
19 : CollAllReduceRingFor91093Executor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher);
20 6 : ~CollAllReduceRingFor91093Executor() override = default;
21 :
22 : private:
23 : /* *************** 资源计算 *************** */
24 : HcclResult CalcStreamNum(u32& streamNum) override;
25 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
26 : HcclResult CalcLevel0CommInfo(
27 : TransportMemType inputType, TransportMemType outputType,
28 : std::vector<LevelNSubCommTransport>& opTransport) override;
29 : HcclResult CalcLevel2CommInfo(
30 : TransportMemType inputType, TransportMemType outputType,
31 : std::vector<LevelNSubCommTransport>& opTransport) override;
32 : HcclResult CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType);
33 :
34 : /* *************** 算法编排 *************** */
35 : bool IsHugeData(const u64 curSize) override;
36 : bool IsSmallData(const u64 totalSize, const u64 curSize) override;
37 : virtual HcclResult RunIntraSeverReduceScatter(
38 : const std::string& tag, DeviceMem& inputMem, DeviceMem& outputMem, const u64 count,
39 : 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(
45 : const std::string& tag, DeviceMem& inputMem, DeviceMem& outputMem, const u64 count,
46 : const HcclDataType& dataType, 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& param, 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(
55 : u32& segmentIdx, u32& commIndex, u64& hdSize, const SubCommInfo& commInfo,
56 : const std::vector<std::vector<Slice>>& multRingsSliceZero, const std::string& tag,
57 : const std::vector<u32>& nicList);
58 :
59 : protected:
60 : SubCommInfo logicalLevel0CommInfo_ = {0, 0, {}, {}};
61 : SubCommInfo logicalLevel1CommInfo_ = {0, 0, {}, {}};
62 : CommPlane logicalLevel0plane_ = COMM_LEVEL_RESERVED;
63 : CommPlane logicalLevel1plane_ = COMM_LEVEL_RESERVED;
64 : };
65 :
66 : } // namespace hccl
67 :
68 : #endif
|