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 I_HCCL_ONE_SIDED_SERVICE_H
12 : #define I_HCCL_ONE_SIDED_SERVICE_H
13 :
14 : #include <memory>
15 : #include <hccl/base.h>
16 : #include <hccl/hccl_types.h>
17 : #include <unordered_set>
18 : #include "hccl_network_pub.h"
19 : #include "hccl_socket.h"
20 : #include "topoinfo_struct.h"
21 : #include "hccl_socket_manager.h"
22 : #include "notify_pool.h"
23 :
24 : namespace hccl {
25 : class IHcclOneSidedService {
26 : public:
27 : IHcclOneSidedService(std::unique_ptr<HcclSocketManager> &socketManager,
28 : std::unique_ptr<NotifyPool> ¬ifyPool);
29 :
30 501 : virtual ~IHcclOneSidedService() = default;
31 :
32 : // 为了尽可能保障框架依赖兼容性,除了引用以外,参数不通过构造函数传递
33 : virtual HcclResult Config(const HcclDispatcher &dispatcher, const HcclRankLinkInfo &localRankInfo,
34 15 : const RankTable_t *rankTable, std::string identifier = "", bool isStandardCard = false,
35 : const std::unordered_set<u32>& enableP2PRankIds = {});
36 :
37 : // 析构时要处理的逻辑
38 : virtual HcclResult DeInit();
39 :
40 : virtual HcclResult SetNetDevCtx(const HcclNetDevCtx &netDevCtx, bool useRdma);
41 : virtual HcclResult GetNetDevCtx(HcclNetDevCtx &netDevCtx, bool useRdma);
42 : void SetTCAndSL(u32 trafficClass, u32 serviceLevel);
43 :
44 : protected:
45 : HcclNetDevCtx netDevRdmaCtx_{};
46 : HcclNetDevCtx netDevIpcCtx_{};
47 : HcclDispatcher dispatcher_{};
48 : HcclRankLinkInfo localRankInfo_{};
49 : HcclRankLinkInfo localRankVnicInfo_{};
50 : const RankTable_t *rankTable_{};
51 : std::unique_ptr<HcclSocketManager> &socketManager_;
52 : std::unique_ptr<NotifyPool> ¬ifyPool_;
53 : u32 trafficClass_;
54 : u32 serviceLevel_;
55 :
56 : std::string identifier_;
57 : bool isStandardCard_{false};
58 : std::unordered_set<u32> enableP2PRankIds_;
59 : };
60 : }
61 :
62 : #endif
|