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_ZEROCOPY_EXECUTOR_H
12 : #define COLL_ALL_REDUCE_RING_ZEROCOPY_EXECUTOR_H
13 :
14 : #include "coll_all_reduce_executor.h"
15 :
16 : namespace hccl {
17 : class CollAllReduceRingZerocopyExecutor : public CollAllReduceExecutor {
18 : public:
19 : CollAllReduceRingZerocopyExecutor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher);
20 0 : ~CollAllReduceRingZerocopyExecutor() 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 CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType);
30 :
31 : /* *************** 算法编排 *************** */
32 : HcclResult DoubleRingReduceScatter(
33 : const std::string& tag, DeviceMem inputMem, DeviceMem outputMem, const u64 count, const HcclDataType dataType,
34 : const HcclReduceOp reductionOp, const std::vector<std::vector<Slice>> multRingsSliceZero, Stream stream,
35 : s32 profStage, const u64 baseOffset, const HcomCollOpInfo* opInfo,
36 : const std::vector<std::vector<Slice>> multRingsUserMemSlice);
37 : HcclResult DoubleRingAllGather(
38 : const std::string& tag, DeviceMem inputMem, DeviceMem outputMem, const u64 count, const HcclDataType dataType,
39 : const std::vector<std::vector<Slice>> multRingsSliceZero, Stream stream, s32 profStage, const u64 baseOffset,
40 : HcomCollOpInfo* opInfo, const std::vector<std::vector<Slice>> multRingsUserMemSlice);
41 : HcclResult
42 : KernelRunInterServerAllReduceSingleSuperpod(const OpParam& param, const ExecMem& execMem, const u64 level1DataSize);
43 : HcclResult
44 : KernelRunInterServerAllReduceMultiSuperpod(const OpParam& param, const ExecMem& execMem, const u64 level1DataSize);
45 : HcclResult KernelRunIntraServerPre(const OpParam& param, ExecMem& execMem) override;
46 : HcclResult KernelRunInterServer(const OpParam& param, ExecMem& execMem) override;
47 : HcclResult KernelRunIntraServerPost(const OpParam& param, ExecMem& execMem) override;
48 :
49 : std::vector<std::vector<Slice>> level0MultiRingDataSlices_;
50 : u32 level0Rank_ = INVALID_VALUE_RANKID;
51 : u32 level1Rank_ = INVALID_VALUE_RANKID;
52 : u32 level2Rank_ = INVALID_VALUE_RANKID;
53 : u32 level0RankSize_ = INVALID_VALUE_RANKSIZE;
54 : u32 level1RankSize_ = INVALID_VALUE_RANKSIZE;
55 : u32 level2RankSize_ = INVALID_VALUE_RANKSIZE;
56 : };
57 :
58 : } // namespace hccl
59 :
60 : #endif
|