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 : #include "ub_mem_endpoint.h"
11 : #include "log.h"
12 : #include "ub_mem.h"
13 :
14 : namespace hcomm {
15 11 : UbMemEndpoint::UbMemEndpoint(const EndpointDesc &endpointDesc) : Endpoint(endpointDesc){}
16 :
17 11 : HcclResult UbMemEndpoint::Init()
18 : {
19 11 : EXCEPTION_CATCH(regedMemMgr_ = std::make_unique<UbMemRegedMemMgr>(), return HCCL_E_INTERNAL);
20 :
21 11 : return HcclResult::HCCL_SUCCESS;
22 : }
23 :
24 6 : HcclResult UbMemEndpoint::ServerSocketListen(const uint32_t port)
25 : {
26 : (void)port;
27 6 : HCCL_INFO("UbMemEndpoint ServerSocketListen is not supported");
28 6 : return HCCL_SUCCESS;
29 : }
30 :
31 9 : HcclResult UbMemEndpoint::RegisterMemory(HcommMem mem, const char *memTag, void **memHandle)
32 : {
33 9 : CHK_RET(this->regedMemMgr_->RegisterMemory(mem, memTag, memHandle));
34 6 : return HCCL_SUCCESS;
35 : }
36 :
37 9 : HcclResult UbMemEndpoint::UnregisterMemory(void* memHandle)
38 : {
39 9 : CHK_RET(this->regedMemMgr_->UnregisterMemory(memHandle));
40 6 : return HCCL_SUCCESS;
41 : }
42 :
43 0 : HcclResult UbMemEndpoint::MemoryExport(void *memHandle, void **memDesc, uint32_t *memDescLen)
44 : {
45 0 : HCCL_INFO("UbMemEndpoint MemoryExport is not supported");
46 0 : return HCCL_SUCCESS;
47 : }
48 :
49 0 : HcclResult UbMemEndpoint::MemoryImport(const void *memDesc, uint32_t descLen, HcommMem *outMem)
50 : {
51 0 : HCCL_INFO("UbMemEndpoint MemoryImport is not supported");
52 0 : return HCCL_SUCCESS;
53 : }
54 :
55 0 : HcclResult UbMemEndpoint::MemoryUnimport(const void *memDesc, uint32_t descLen)
56 : {
57 0 : HCCL_INFO("UbMemEndpoint MemoryUnimport is not supported");
58 0 : return HCCL_SUCCESS;
59 : }
60 :
61 0 : HcclResult UbMemEndpoint::GetAllMemHandles(void **memHandles, uint32_t *memHandleNum)
62 : {
63 0 : HCCL_INFO("UbMemEndpoint GetAllMemHandles is not supported");
64 0 : return HCCL_SUCCESS;
65 : }
66 : }
|