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 HCCLV2_CCU_CONTEXT_ALL_REDUCE_MESH_1D_H_
12 : #define HCCLV2_CCU_CONTEXT_ALL_REDUCE_MESH_1D_H_
13 :
14 : #include <vector>
15 : #include <ios>
16 : #include "log.h"
17 : #include "ccu_context_alg_base.h"
18 : #include "ccu_datatype.h"
19 : #include "ccu_device_manager.h"
20 : #include "ccu_context_alg_base.h"
21 :
22 : namespace Hccl {
23 :
24 : class CcuContextAllReduceMesh1D : public CcuContextAlgBase {
25 : public:
26 : CcuContextAllReduceMesh1D(
27 : const CcuCtxArg& arg, const std::vector<CcuTransport*>& transports, const CcuTransportGroup& group);
28 0 : ~CcuContextAllReduceMesh1D() override {}
29 :
30 : void Algorithm() override;
31 : std::vector<uint64_t> GeneArgs(const CcuTaskArg& arg) override;
32 :
33 : private:
34 : void RunBroadcast(std::vector<CcuRep::Memory>& dst, CcuRep::Memory& src);
35 : void RunReduce(CcuRep::Memory& dst, std::vector<CcuRep::Memory>& src);
36 :
37 : CcuVersion ccuVersion_ = CcuVersion::CCU_INVALID;
38 : DataType dataType_;
39 : DataType outputDataType_;
40 : std::vector<CcuRep::Variable> input_;
41 : std::vector<CcuRep::Variable> output_;
42 : std::vector<CcuRep::Variable> token_;
43 : CcuRep::Variable offset_;
44 : GroupOpSize groupOpSize_;
45 : GroupOpSizeV2 groupOpSizeV2_;
46 : };
47 : } // namespace Hccl
48 :
49 : #endif // HCCLV2_CCU_CONTEXT_ALL_REDUCE_MESH_1D_H_
|