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 : ~AivMc2Compont();
25 : void AllocCommResource(void* mc2Tiling, void** commContext);
26 :
27 : private:
28 : void GenerateCommContext(void** commContext);
29 : void AivMC2AllocCommRes(Mc2Tiling* mc2TilingPtr) const;
30 : void AivMC2AllocCommResV2(Mc2InitTilingInner* mc2TilingPtr) const;
31 : void FillCollOperator(const Mc2CommConfig& config) const;
32 : void FillCollOperatorV2(const Mc2CcTilingInner& config) const;
33 :
34 : private:
35 : void GenerateAivMemoryCommContext(HcclCombinOpParam& combinOpParam);
36 : void GenerateAivUrmaCommContext(HcclCombinOpParam& combinOpParam) const;
37 :
38 : CommunicatorImpl* comm;
39 : std::shared_ptr<DevBuffer> workspaceBuffer{nullptr};
40 : std::shared_ptr<DevBuffer> combinOpParamBuffer{nullptr};
41 : std::shared_ptr<DevBuffer> comParamBuffer{nullptr};
42 : std::shared_ptr<DevBuffer> comSyncBuffer{nullptr};
43 : };
44 : } // namespace Hccl
45 : #endif // AIV_MC2_COMPONT_H
|