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_ALLREDUCE_DETER_PIPELINE_EXECUTOR_H
12 : #define COLL_ALLREDUCE_DETER_PIPELINE_EXECUTOR_H
13 : #include "coll_all_reduce_executor.h"
14 :
15 : namespace hccl {
16 : class CollAllReduceDeterPipelineExecutor : public CollAllReduceExecutor {
17 : public:
18 : explicit CollAllReduceDeterPipelineExecutor(const HcclDispatcher dispatcher,
19 : std::unique_ptr<TopoMatcher> &topoMatcher);
20 0 : ~CollAllReduceDeterPipelineExecutor() override = default;
21 :
22 : private:
23 : void ParseParam(const OpParam& param) override;
24 : /* *************** 资源计算 *************** */
25 : HcclResult CalcStreamNum(u32& streamNum) override;
26 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
27 : HcclResult CalcLevel0CommInfo(TransportMemType inputType, TransportMemType outputType,
28 : std::vector<LevelNSubCommTransport>& opTransport) override;
29 : HcclResult CalcLevel1CommInfo(TransportMemType inputType, TransportMemType outputType,
30 : std::vector<LevelNSubCommTransport>& opTransport) override;
31 : HcclResult CalcTransportMemType(TransportMemType &inputType, TransportMemType &outputType);
32 :
33 : /* *************** 算法编排 *************** */
34 : HcclResult RunLoopInner(OpParam ¶m, const ReduceType &reduceType, ExecMem &execMem) override;
35 : HcclResult KernelRun(const OpParam ¶m, ExecMem &execMem) override;
36 :
37 : /* **************** 数据准备*************** */
38 : u64 CalcCountPerSlice(const u64 &totalCount, const u32 &unitSize);
39 : HcclResult PrepareDataSlice(const ExecMem &execMem, const u32 &unitSize, std::vector<Slice> &bufferSlices);
40 : u64 totalSize_{0U};
41 : };
42 :
43 : } // namespace hccl
44 :
45 : #endif
|