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_COMM_EXECUTOR_H
12 : #define COLL_BROADCAST_COMM_EXECUTOR_H
13 : #include "coll_comm_executor.h"
14 : #include "coll_alg_operator.h"
15 :
16 : namespace hccl {
17 : class CollBroadcastExecutor : public CollCommExecutor {
18 : public:
19 : CollBroadcastExecutor(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher);
20 2 : ~CollBroadcastExecutor() override = default;
21 :
22 : HcclResult Orchestrate(OpParam& param, AlgResourceResponse& algRes) override;
23 :
24 : protected:
25 : /* *************** 算法编排 *************** */
26 : // Broadcast Loop Executor公共接口
27 : HcclResult RunLoop(OpParam& param, AlgResourceResponse& algRes);
28 : HcclResult GetSliceNum(const u64 size, const bool isSmallData, u64& sliceNum);
29 : bool IsBroadcastSmallData(u64 size, u64 totalSize);
30 : HcclResult CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType);
31 : virtual u64 CalcLoopMaxCount(const u64 cclBuffSize, const u32 unitSize);
32 : HcclResult
33 : GetRankSliceSize(HcclDataType dataType, const u64 count, const u32 rankSize, std::vector<Slice>& sliceList);
34 : bool DMAReduceFlag_{false}; // 是否DMA消减
35 : bool scratchMemFlag_{false}; // 是否需要申请scratch memory,不需要申请则传入outputmem为scratchmem
36 : std::vector<Slice> l0SliceList_; // 零拷贝时l0通信域各个rank切片,用于正确计算runloop时userIn到cclIn的偏移的大小
37 :
38 : private:
39 : HcclResult RunLoopInner(OpParam& param, ExecMem& execMem);
40 : };
41 : } // namespace hccl
42 :
43 : #endif
|