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