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