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 : #include "transport_virtural.h"
12 : #include "task_logic_info_pub.h"
13 :
14 : namespace hccl {
15 :
16 18 : TransportVirtural::TransportVirtural(DispatcherPub *dispatcher,
17 : const std::unique_ptr<NotifyPool> ¬ifyPool,
18 : MachinePara &machinePara,
19 18 : std::chrono::milliseconds timeout, u32 index)
20 18 : : TransportBase(dispatcher, notifyPool, machinePara, timeout), currentIndex_(index)
21 : {
22 18 : }
23 :
24 36 : TransportVirtural::~TransportVirtural()
25 : {
26 18 : HCCL_DEBUG("~TransportVirtural Enter!");
27 36 : }
28 :
29 : /* 发送ack消息(同步模式) */
30 0 : HcclResult TransportVirtural::TxAck(Stream &stream)
31 : {
32 0 : TaskLogicInfo info(currentIndex_, TaskLogicType::TRANSPORT_TYPE, TaskLogicFuncType::TRANSPORT_TXACK_TYPE);
33 0 : stream.PushTaskLogicInfo(info);
34 0 : return HCCL_SUCCESS;
35 0 : }
36 :
37 : /* 接收ack消息(同步模式) */
38 0 : HcclResult TransportVirtural::RxAck(Stream &stream)
39 : {
40 0 : TaskLogicInfo info(currentIndex_, TaskLogicType::TRANSPORT_TYPE, TaskLogicFuncType::TRANSPORT_RXACK_TYPE);
41 0 : stream.PushTaskLogicInfo(info);
42 0 : return HCCL_SUCCESS;
43 0 : }
44 :
45 0 : HcclResult TransportVirtural::TxAsync(std::vector<TxMemoryInfo>& txMems, Stream &stream)
46 : {
47 : TaskLogicInfo info(currentIndex_, TaskLogicType::TRANSPORT_TYPE, TaskLogicFuncType::TRANSPORT_TXASYNC_TYPE,
48 0 : txMems);
49 0 : stream.PushTaskLogicInfo(info);
50 0 : return HCCL_SUCCESS;
51 0 : }
52 :
53 0 : HcclResult TransportVirtural::RxAsync(std::vector<RxMemoryInfo>& rxMems, Stream &stream)
54 : {
55 : TaskLogicInfo info(currentIndex_, TaskLogicType::TRANSPORT_TYPE, TaskLogicFuncType::TRANSPORT_RXASYNC_TYPE,
56 0 : rxMems);
57 0 : stream.PushTaskLogicInfo(info);
58 0 : return HCCL_SUCCESS;
59 0 : }
60 :
61 0 : HcclResult TransportVirtural::TxDataSignal(Stream &stream)
62 : {
63 0 : TaskLogicInfo info(currentIndex_, TaskLogicType::TRANSPORT_TYPE, TaskLogicFuncType::TRANSPORT_TXDATASIGNAL_TYPE);
64 0 : stream.PushTaskLogicInfo(info);
65 0 : return HCCL_SUCCESS;
66 0 : }
67 :
68 0 : HcclResult TransportVirtural::RxDataSignal(Stream &stream)
69 : {
70 0 : TaskLogicInfo info(currentIndex_, TaskLogicType::TRANSPORT_TYPE, TaskLogicFuncType::TRANSPORT_RXDATASIGNAL_TYPE);
71 0 : stream.PushTaskLogicInfo(info);
72 0 : return HCCL_SUCCESS;
73 0 : }
74 :
75 0 : HcclResult TransportVirtural::TxPrepare(Stream &stream)
76 : {
77 0 : return HCCL_SUCCESS;
78 : }
79 0 : HcclResult TransportVirtural::RxPrepare(Stream &stream)
80 : {
81 0 : return HCCL_SUCCESS;
82 : }
83 :
84 0 : HcclResult TransportVirtural::TxData(UserMemType dstMemType, u64 dstOffset, const void *src, u64 len, Stream &stream)
85 : {
86 0 : return HCCL_SUCCESS;
87 : }
88 0 : HcclResult TransportVirtural::RxData(UserMemType srcMemType, u64 srcOffset, void *dst, u64 len, Stream &stream)
89 : {
90 0 : return HCCL_SUCCESS;
91 : }
92 :
93 0 : HcclResult TransportVirtural::TxDone(Stream &stream)
94 : {
95 0 : return HCCL_SUCCESS;
96 : }
97 0 : HcclResult TransportVirtural::RxDone(Stream &stream)
98 : {
99 0 : return HCCL_SUCCESS;
100 : }
101 : } // namespace hccl
|