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, std::unique_ptr<NotifyPool>& notifyPool);
28 :
29 502 : virtual ~IHcclOneSidedService() = default;
30 :
31 : // 为了尽可能保障框架依赖兼容性,除了引用以外,参数不通过构造函数传递
32 : virtual HcclResult Config(
33 : const HcclDispatcher& dispatcher, const HcclRankLinkInfo& localRankInfo, const RankTable_t* rankTable,
34 15 : std::string identifier = "", bool isStandardCard = false, const std::unordered_set<u32>& enableP2PRankIds = {});
35 :
36 : // 析构时要处理的逻辑
37 : virtual HcclResult DeInit();
38 :
39 : virtual HcclResult SetNetDevCtx(const HcclNetDevCtx& netDevCtx, bool useRdma);
40 : virtual HcclResult GetNetDevCtx(HcclNetDevCtx& netDevCtx, bool useRdma);
41 : void SetTCAndSL(u32 trafficClass, u32 serviceLevel);
42 :
43 : protected:
44 : HcclNetDevCtx netDevRdmaCtx_{};
45 : HcclNetDevCtx netDevIpcCtx_{};
46 : HcclDispatcher dispatcher_{};
47 : HcclRankLinkInfo localRankInfo_{};
48 : HcclRankLinkInfo localRankVnicInfo_{};
49 : const RankTable_t* rankTable_{};
50 : std::unique_ptr<HcclSocketManager>& socketManager_;
51 : std::unique_ptr<NotifyPool>& notifyPool_;
52 : u32 trafficClass_;
53 : u32 serviceLevel_;
54 :
55 : std::string identifier_;
56 : bool isStandardCard_{false};
57 : std::unordered_set<u32> enableP2PRankIds_;
58 : };
59 : } // namespace hccl
60 :
61 : #endif
|