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 HCCLV2_RMA_P2P_CONNECTION_H
12 : #define HCCLV2_RMA_P2P_CONNECTION_H
13 :
14 : #include <map>
15 : #include <string>
16 :
17 : #include "socket_manager.h"
18 : #include "virtual_topo.h"
19 : #include "rma_connection.h"
20 : #include "task.h"
21 :
22 : namespace Hccl {
23 :
24 : class P2PConnection : public RmaConnection {
25 : public:
26 : P2PConnection(Socket* socket, const string& tag);
27 5 : ~P2PConnection() override = default;
28 :
29 : void Connect() override;
30 : RmaConnStatus GetStatus() override;
31 : string Describe() const override;
32 :
33 : unique_ptr<BaseTask>
34 : PrepareRead(const MemoryBuffer& remoteMemBuf, const MemoryBuffer& localMemBuf, const SqeConfig& config) override;
35 :
36 : unique_ptr<BaseTask> PrepareReadReduce(
37 : const MemoryBuffer& remoteMemBuf, const MemoryBuffer& localMemBuf, DataType datatype, ReduceOp reduceOp,
38 : const SqeConfig& config) override;
39 :
40 : unique_ptr<BaseTask>
41 : PrepareWrite(const MemoryBuffer& remoteMemBuf, const MemoryBuffer& localMemBuf, const SqeConfig& config) override;
42 :
43 : unique_ptr<BaseTask> PrepareWriteReduce(
44 : const MemoryBuffer& remoteMemBuf, const MemoryBuffer& localMemBuf, DataType datatype, ReduceOp reduceOp,
45 : const SqeConfig& config) override;
46 :
47 : private:
48 : void EnableP2p() const;
49 : };
50 :
51 : } // namespace Hccl
52 :
53 : #endif // HCCLV2_RMA_P2P_CONNECTION_H
|