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> PrepareRead(const MemoryBuffer &remoteMemBuf, const MemoryBuffer &localMemBuf,
33 : const SqeConfig &config) override;
34 :
35 : unique_ptr<BaseTask> PrepareReadReduce(const MemoryBuffer &remoteMemBuf, const MemoryBuffer &localMemBuf,
36 : DataType datatype, ReduceOp reduceOp, const SqeConfig &config) override;
37 :
38 : unique_ptr<BaseTask> PrepareWrite(const MemoryBuffer &remoteMemBuf, const MemoryBuffer &localMemBuf,
39 : const SqeConfig &config) override;
40 :
41 : unique_ptr<BaseTask> PrepareWriteReduce(const MemoryBuffer &remoteMemBuf, const MemoryBuffer &localMemBuf,
42 : DataType datatype, ReduceOp reduceOp, const SqeConfig &config) override;
43 :
44 : private:
45 : void EnableP2p() const;
46 : };
47 :
48 : } // namespace Hccl
49 :
50 : #endif // HCCLV2_RMA_P2P_CONNECTION_H
|