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_BROADCAST_RING_ZEROCOPY_EXECUTOR_H
12 : #define COLL_BROADCAST_RING_ZEROCOPY_EXECUTOR_H
13 : #include "coll_broadcast_executor.h"
14 : namespace hccl {
15 : class CollBroadCastRingZerocopyExecutor : public CollBroadcastExecutor {
16 :
17 : public:
18 : CollBroadCastRingZerocopyExecutor(const HcclDispatcher dispatcher,
19 : std::unique_ptr<TopoMatcher> &topoMatcher);
20 0 : ~CollBroadCastRingZerocopyExecutor() override = default;
21 :
22 : private:
23 : /* *************** 资源计算 *************** */
24 : HcclResult CalcStreamNum(u32& streamNum) override;
25 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
26 : HcclResult CalcLevel0CommInfo(TransportMemType inputType,
27 : TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport) override;
28 : HcclResult SetCommRankInfo();
29 :
30 : /* *************** 算法编排 *************** */
31 : HcclResult KernelRunInterServerBroadcastSingleSuperpod(const OpParam ¶m, ExecMem &execMem, const u64 level1DataSize);
32 : HcclResult KernelRunInterServerBroadcastMultiSuperpod(const OpParam ¶m, ExecMem &execMem, const u64 level1DataSize);
33 : HcclResult KernelRunIntraServerPre(const OpParam ¶m, ExecMem &execMem) override;
34 : HcclResult KernelRunInterServer(const OpParam ¶m, ExecMem &execMem) override;
35 : HcclResult KernelRunIntraServerPost(const OpParam ¶m, ExecMem &execMem) override;
36 :
37 : HcclResult DoubleRingScatter(const std::string &tag, DeviceMem inputMem, DeviceMem outputMem,
38 : const u64 count, const HcclDataType dataType, const std::vector<std::vector<Slice> > multRingsSliceZero,
39 : u32 root, Stream stream, HcomCollOpInfo *opInfo, const u64 baseOffset = 0);
40 : HcclResult DoubleRingAllGather(
41 : const std::string &tag, DeviceMem inputMem, DeviceMem outputMem,
42 : const u64 count, const HcclDataType dataType, const std::vector<std::vector<Slice> > multRingsSliceZero,
43 : Stream stream, s32 profStage, const u64 baseOffset, HcomCollOpInfo *opInfo,
44 : const std::vector<std::vector<Slice>> multRingsUserMemSlice);
45 :
46 : u32 level0Rank_ = INVALID_VALUE_RANKID;
47 : u32 level1Rank_ = INVALID_VALUE_RANKID;
48 : u32 level2Rank_ = INVALID_VALUE_RANKID;
49 : u32 level0RankSize_ = INVALID_VALUE_RANKSIZE;
50 : u32 level1RankSize_ = INVALID_VALUE_RANKSIZE;
51 : u32 level2RankSize_ = INVALID_VALUE_RANKSIZE;
52 : std::vector<std::vector<Slice>> level0MultiRingDataSlices_;
53 : };
54 : } // namespace hccl
55 :
56 : #endif
|