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