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_ALLGATHER_RING_ZEROCOPY_EXECUTOR_H
12 : #define COLL_ALLGATHER_RING_ZEROCOPY_EXECUTOR_H
13 : #include "coll_all_gather_executor.h"
14 : namespace hccl {
15 : class CollAllGatherRingZerocopyExecutor : public CollAllGatherExecutor {
16 : public:
17 : explicit CollAllGatherRingZerocopyExecutor(
18 : const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher);
19 0 : ~CollAllGatherRingZerocopyExecutor() override = default;
20 :
21 : protected:
22 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
23 : u32 level0Rank_ = INVALID_VALUE_RANKID;
24 : u32 level1Rank_ = INVALID_VALUE_RANKID;
25 : u32 level2Rank_ = INVALID_VALUE_RANKID;
26 : u32 level0RankSize_ = INVALID_VALUE_RANKSIZE;
27 : u32 level1RankSize_ = INVALID_VALUE_RANKSIZE;
28 : u32 level2RankSize_ = INVALID_VALUE_RANKSIZE;
29 :
30 : private:
31 : /* *************** 资源计算 *************** */
32 : HcclResult CalcStreamNum(u32& streamNum) override;
33 : HcclResult CalcLevel0CommInfo(
34 : TransportMemType inputType, TransportMemType outputType,
35 : std::vector<LevelNSubCommTransport>& opTransport) override;
36 : HcclResult CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType);
37 : u64 CalcLoopMaxCount(const u64 cclBuffSize, const u32 unitSize) override;
38 : void ParseParam(const OpParam& param) override;
39 :
40 : /* *************** 算法编排 *************** */
41 : HcclResult SemiRingAllGather(
42 : const std::string& tag, DeviceMem& inputMem, DeviceMem& outputMem, const u64 count,
43 : const HcclDataType& dataType, const std::vector<std::vector<Slice>>& multRingsSliceZero, const Stream& stream,
44 : s32 profStage, const u64 baseOffset, const HcomCollOpInfo* opInfo,
45 : const std::vector<std::vector<Slice>>& multRingsUserMemSlice);
46 : virtual HcclResult KernelRunInterServerPreProcess(const OpParam& param, const ExecMem& execMem);
47 : HcclResult KernelRunInterServer(const OpParam& param, ExecMem& execMem) override;
48 : HcclResult KernelRunIntraServerPost(const OpParam& param, ExecMem& execMem) override;
49 : virtual HcclResult
50 : CalcLevel0DataSlices(const OpParam& param, const ExecMem& execMem, std::vector<Slice>& dataSegsSlice);
51 : virtual HcclResult KernelRunInterServerPostProcess(const OpParam& param, const ExecMem& execMem);
52 : };
53 :
54 : } // namespace hccl
55 :
56 : #endif
|