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 UB_MEM_ENDPOINT_H
12 : #define UB_MEM_ENDPOINT_H
13 :
14 : #include <memory>
15 : #include <vector>
16 : #include <string>
17 : #include "endpoint.h"
18 : #include "proc_reged_mem_mgr_cache.h"
19 :
20 : namespace hcomm {
21 : class UbMemEndpoint : public Endpoint {
22 : public:
23 : explicit UbMemEndpoint(const EndpointDesc& endpointDesc);
24 : ~UbMemEndpoint() noexcept override;
25 : // 构造函数
26 : HcclResult Init() override;
27 : HcclResult ServerSocketListen(const uint32_t port) override;
28 : HcclResult RegisterMemory(HcommMem mem, const char* memTag, void** memHandle) override;
29 : HcclResult UnregisterMemory(void* memHandle) override;
30 : HcclResult MemoryExport(void* memHandle, void** memDesc, uint32_t* memDescLen) override;
31 : HcclResult MemoryImport(const void* memDesc, uint32_t descLen, HcommMem* outMem) override;
32 : HcclResult MemoryUnimport(const void* memDesc, uint32_t descLen) override;
33 : HcclResult GetAllMemHandles(void** memHandles, uint32_t* memHandleNum) override;
34 0 : std::shared_ptr<RegedMemMgr> GetRegedMemMgr() override { return regedMemMgr_; }
35 :
36 : private:
37 : MemMgrCacheKey cacheKey_{};
38 : };
39 :
40 : } // namespace hcomm
41 :
42 : #endif // UB_MEM_ENDPOINT_H
|