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 :
19 : public:
20 : CollAllReduceRingZerocopyExecutor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher);
21 0 : ~CollAllReduceRingZerocopyExecutor() 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, std::vector<LevelNSubCommTransport>& opTransport) override;
29 : HcclResult CalcTransportMemType(TransportMemType &inputType, TransportMemType &outputType);
30 :
31 : /* *************** 算法编排 *************** */
32 : HcclResult DoubleRingReduceScatter(const std::string &tag,
33 : 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,
39 : const u64 count, const HcclDataType dataType, const std::vector<std::vector<Slice> > multRingsSliceZero,
40 : Stream stream, s32 profStage, const u64 baseOffset, HcomCollOpInfo *opInfo,
41 : const std::vector<std::vector<Slice>> multRingsUserMemSlice);
42 : HcclResult KernelRunInterServerAllReduceSingleSuperpod(const OpParam ¶m, const ExecMem &execMem, const u64 level1DataSize);
43 : HcclResult KernelRunInterServerAllReduceMultiSuperpod(const OpParam ¶m, const ExecMem &execMem, const u64 level1DataSize);
44 : HcclResult KernelRunIntraServerPre(const OpParam ¶m, ExecMem &execMem) override;
45 : HcclResult KernelRunInterServer(const OpParam ¶m, ExecMem &execMem) override;
46 : HcclResult KernelRunIntraServerPost(const OpParam ¶m, ExecMem &execMem) override;
47 :
48 : std::vector<std::vector<Slice>> level0MultiRingDataSlices_;
49 : u32 level0Rank_ = INVALID_VALUE_RANKID;
50 : u32 level1Rank_ = INVALID_VALUE_RANKID;
51 : u32 level2Rank_ = INVALID_VALUE_RANKID;
52 : u32 level0RankSize_ = INVALID_VALUE_RANKSIZE;
53 : u32 level1RankSize_ = INVALID_VALUE_RANKSIZE;
54 : u32 level2RankSize_ = INVALID_VALUE_RANKSIZE;
55 : };
56 :
57 : } // namespace hccl
58 :
59 : #endif
|