Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 CHANNEL_AICPU_MGR_H
12 : #define CHANNEL_AICPU_MGR_H
13 :
14 : #include "common.h"
15 : #include "channel_param.h"
16 : #include "base_transport_lite_impl.h"
17 : #include "topo_matcher.h"
18 : #include "hcclCommDfxLite.h"
19 : #include <unordered_map>
20 : #include <vector>
21 : #include <memory>
22 :
23 : using namespace hccl;
24 :
25 : class ChannelAicpuMgr {
26 : public:
27 : ChannelAicpuMgr(HcclCommDfxLite& dfx, const HcclTopoInfo& topoInfo);
28 10 : ~ChannelAicpuMgr() = default;
29 :
30 : HcclResult AllocChannelResource(HcclChannelUrmaRes* commParam);
31 : HcclResult Resume(HcclChannelUrmaRes* commParam);
32 : HcclResult Clean();
33 :
34 : private:
35 : HcclResult InitUrmaChannel(HcclChannelUrmaRes* commParam);
36 : HcclResult ProcessUrmaRes(HcclChannelUrmaRes* commParam, bool isInit);
37 : HcclResult ParsePackData(std::vector<char>& data, ChannelHandle& handle);
38 : HcclResult ResumePackData(std::vector<char>& data, ChannelHandle& handle);
39 : HcclResult RegisterChannelCacheCallback(ChannelHandle channel);
40 :
41 : std::unordered_map<ChannelHandle, std::unique_ptr<Hccl::BaseTransportLiteImpl>> transportMap_;
42 : HcclCommDfxLite& dfx_;
43 : const HcclTopoInfo& topoInfo_;
44 : };
45 :
46 : #endif // CHANNEL_AICPU_MGR_H
|