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