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