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