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 AIV_MC2_COMPONT_H
12 : #define AIV_MC2_COMPONT_H
13 :
14 : #include <memory>
15 : #include "communicator_impl.h"
16 : #include "ins_exe_que.h"
17 : #include "mc2_type.h"
18 :
19 : namespace Hccl {
20 :
21 : class AivMc2Compont {
22 : public:
23 242 : explicit AivMc2Compont(CommunicatorImpl *comm) : comm(comm)
24 : {
25 242 : }
26 : ~AivMc2Compont();
27 : void AllocCommResource(void *mc2Tiling, void **commContext);
28 :
29 : private:
30 : void GenerateCommContext(void **commContext);
31 : void AivMC2AllocCommRes(Mc2Tiling *mc2TilingPtr) const;
32 : void AivMC2AllocCommResV2(Mc2InitTilingInner *mc2TilingPtr) const;
33 : void FillCollOperator(const Mc2CommConfig &config) const;
34 : void FillCollOperatorV2(const Mc2CcTilingInner &config) const;
35 : private:
36 : void GenerateAivMemoryCommContext(HcclCombinOpParam &combinOpParam);
37 : void GenerateAivUrmaCommContext(HcclCombinOpParam &combinOpParam) const;
38 :
39 : CommunicatorImpl *comm;
40 : std::shared_ptr<DevBuffer> workspaceBuffer{nullptr};
41 : std::shared_ptr<DevBuffer> combinOpParamBuffer{nullptr};
42 : std::shared_ptr<DevBuffer> comParamBuffer{nullptr};
43 : std::shared_ptr<DevBuffer> comSyncBuffer{nullptr};
44 : };
45 : } // namespace Hccl
46 : #endif // AIV_MC2_COMPONT_H
|