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_UB_MEM_CHANNEL_H
12 : #define AIV_UB_MEM_CHANNEL_H
13 :
14 : #include "../channel.h"
15 :
16 : // Orion
17 : #include "../../../../../../src/legacy/ascend950/unified_platform/resource/socket/socket.h"
18 : #include "buffer_key.h"
19 : #include "aiv_ub_mem_transport.h"
20 :
21 : namespace hcomm {
22 :
23 : class AivUbMemChannel : public Channel {
24 : public:
25 : AivUbMemChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc);
26 :
27 : HcclResult Init() override;
28 : HcclResult GetNotifyNum(uint32_t* notifyNum) const override;
29 : HcclResult GetRemoteMems(uint32_t* memNum, CommMem** remoteMem, char*** memInfos) override;
30 : ChannelStatus GetStatus() override;
31 : HcclResult UpdateMemInfo(HcommMemHandle* memHandles, uint32_t memHandleNum) override;
32 0 : const HcommChannelDesc& GetChannelDesc() const override { return channelDesc_; }
33 :
34 : virtual HcclResult Clean() override;
35 : virtual HcclResult Resume() override;
36 :
37 : // 数据面接口
38 : HcclResult NotifyWait(const uint32_t localNotifyIdx, const uint32_t timeout) override;
39 : HcclResult NotifyRecord(const uint32_t remoteNotifyIdx) override;
40 : HcclResult WriteWithNotify(void* dst, const void* src, const uint64_t len, uint32_t remoteNotifyIdx) override;
41 : HcclResult Write(void* dst, const void* src, uint64_t len) override;
42 : HcclResult Read(void* dst, const void* src, uint64_t len) override;
43 : HcclResult ChannelFence() override;
44 :
45 : private:
46 : HcclResult ParseInputParam();
47 : HcclResult BuildTransport();
48 :
49 : // --------------------- 入参 ---------------------
50 : EndpointHandle endpointHandle_;
51 : HcommChannelDesc channelDesc_;
52 :
53 : // --------------------- 具体成员 ---------------------
54 : Hccl::Socket* socket_{nullptr};
55 : std::unique_ptr<AivUbMemTransport> transport_{nullptr};
56 : };
57 :
58 : } // namespace hcomm
59 :
60 : #endif // AIV_UB_MEM_CHANNEL_H
|