已合并
use sio and hccs #2100
hu-yiliang11创建于 5月11日
use sio and hccs #2100
已合并
hu-yiliang11创建于 5月11日
5 个文件变更+33-7
@@ -80,6 +80,7 @@ typedef enum {
80 COMM_PROTOCOL_UBC_TP = 5, ///< 华为统一总线UBC_TP80 COMM_PROTOCOL_UBC_TP = 5, ///< 华为统一总线UBC_TP
81 COMM_PROTOCOL_UB_MEM = 6, ///< UB_MEM81 COMM_PROTOCOL_UB_MEM = 6, ///< UB_MEM
82 COMM_PROTOCOL_UBOE = 7, ///< UBoE82 COMM_PROTOCOL_UBOE = 7, ///< UBoE
83+ COMM_PROTOCOL_HCCS_ONLY = 8, ///< 一卡双DIE使用HCCS
83} CommProtocol;84} CommProtocol;
84 85 
85/**86/**
@@ -63,9 +63,11 @@ HcclResult ChannelManager::CheckChannelParam(CommEngine engine,
63 HCCL_E_PARA);63 HCCL_E_PARA);
64 // 检查是否有不支持协议64 // 检查是否有不支持协议
65 CHK_PRT_RET(channelDesc[descIdx].channelProtocol != COMM_PROTOCOL_HCCS &&65 CHK_PRT_RET(channelDesc[descIdx].channelProtocol != COMM_PROTOCOL_HCCS &&
66- channelDesc[descIdx].channelProtocol != COMM_PROTOCOL_ROCE,66+ channelDesc[descIdx].channelProtocol != COMM_PROTOCOL_ROCE &&
67+ channelDesc[descIdx].channelProtocol != COMM_PROTOCOL_HCCS_ONLY &&
68+ channelDesc[descIdx].channelProtocol != COMM_PROTOCOL_SIO,
67 HCCL_ERROR("[%s]Unsupported protocol[%d] found in channeldesc, protocol: %d.", __func__,69 HCCL_ERROR("[%s]Unsupported protocol[%d] found in channeldesc, protocol: %d.", __func__,
68- channelDesc[descIdx].channelProtocol), HCCL_E_PARA);70+ descIdx, channelDesc[descIdx].channelProtocol), HCCL_E_PARA);
69 71
70 // 检查engine支持情况72 // 检查engine支持情况
71 if (engine != COMM_ENGINE_CPU && engine != COMM_ENGINE_CPU_TS && 73 if (engine != COMM_ENGINE_CPU && engine != COMM_ENGINE_CPU_TS &&
@@ -89,7 +91,7 @@ HcclResult ChannelManager::RegisterHandle(const std::string &tag, CommEngine eng
89 channelHandleMap_[channelKey] = channelHandle;91 channelHandleMap_[channelKey] = channelHandle;
90 keyMap_[channelHandle] = channelKey;92 keyMap_[channelHandle] = channelKey;
91 engineMap_[channelHandle] = engine;93 engineMap_[channelHandle] = engine;
92- HCCL_INFO("[%s]Register channel handle[%llu]", __func__, channelHandle);94+ HCCL_INFO("[%s]Register channel handle[%llu], channelKey[%s]", __func__, channelHandle, channelKey.c_str());
93 return HCCL_SUCCESS;95 return HCCL_SUCCESS;
94}96}
95 97 
@@ -120,7 +122,7 @@ HcclResult ChannelManager::IsChannelExist(ChannelHandle channel)
120{122{
121 CHK_PRT_RET((keyMap_.find(channel) == keyMap_.end()),123 CHK_PRT_RET((keyMap_.find(channel) == keyMap_.end()),
122 HCCL_ERROR("[%s]ChannelHandle is not exist.", __func__), HCCL_E_PARA);124 HCCL_ERROR("[%s]ChannelHandle is not exist.", __func__), HCCL_E_PARA);
123- HCCL_INFO("[%s]ChannelHandle exist, ChannelHandle[%llu]", __func__, channel);125+ HCCL_INFO("[%s]ChannelHandle exist, ChannelHandle[%llu], channelKey[%s]", __func__, channel, keyMap_[channel].c_str());
124 return HCCL_SUCCESS;126 return HCCL_SUCCESS;
125}127}
126 128 
@@ -271,6 +273,13 @@ OpCommTransport ChannelManager::BuildChannelRequests(const std::vector<HcclChann
271 tmpTransport.inputMemType = TransportMemType::CCL_INPUT;273 tmpTransport.inputMemType = TransportMemType::CCL_INPUT;
272 tmpTransport.outputMemType = TransportMemType::CCL_OUTPUT;274 tmpTransport.outputMemType = TransportMemType::CCL_OUTPUT;
273 tmpTransport.isUsedRdma = (desc.channelProtocol == CommProtocol::COMM_PROTOCOL_ROCE);275 tmpTransport.isUsedRdma = (desc.channelProtocol == CommProtocol::COMM_PROTOCOL_ROCE);
276+ TransportLinkType linkType = TransportLinkType::RESERVED;
277+ if (desc.channelProtocol == CommProtocol::COMM_PROTOCOL_HCCS_ONLY) {
278+ linkType = TransportLinkType::HCCS;
279+ } else if (desc.channelProtocol == CommProtocol::COMM_PROTOCOL_SIO) {
280+ linkType = TransportLinkType::SIO;
281+ }
282+ tmpTransport.linkType = linkType;
274 commTransport.transportRequests.push_back(tmpTransport);283 commTransport.transportRequests.push_back(tmpTransport);
275 }284 }
276 285
@@ -749,8 +758,8 @@ HcclResult ChannelManager::ChannelCommGetHcclBuffer(ChannelHandle channel, CommB
749 CHK_RET(transportPtr->GetRemoteMemSize(UserMemType::INPUT_MEM, tempSize));758 CHK_RET(transportPtr->GetRemoteMemSize(UserMemType::INPUT_MEM, tempSize));
750 buffer->size = static_cast<uint64_t>(tempSize);759 buffer->size = static_cast<uint64_t>(tempSize);
751 buffer->type = HCCL_MEM_TYPE_DEVICE;760 buffer->type = HCCL_MEM_TYPE_DEVICE;
752- HCCL_INFO("[%s]get remote hccl buffer success, remote addr[%llu], size[%u]", 761+ HCCL_INFO("[%s]channel[%llu] channelKey[%s] get remote hccl buffer success, remote addr[%p], size[%u]",
753- __func__, buffer->addr, buffer->size);762+ __func__, channel, keyMap_[channel].c_str(), buffer->addr, buffer->size);
754 return HCCL_SUCCESS;763 return HCCL_SUCCESS;
755}764}
756 765 
@@ -5381,8 +5381,9 @@ HcclResult HcclCommAicpu::InitP2pChannel(HcclIndOpChannelRemoteResV3 *commParam,
5381 CHK_PTR_NULL(commParam);5381 CHK_PTR_NULL(commParam);
5382 CHK_PTR_NULL(commParam->channelList);5382 CHK_PTR_NULL(commParam->channelList);
5383 HcclIndOpChannelRemoteResV2 &remoteResV2 = commParam->remoteResV2[channelIndex];5383 HcclIndOpChannelRemoteResV2 &remoteResV2 = commParam->remoteResV2[channelIndex];
5384+ u32 linkType = static_cast<u32>(remoteResV2.channelP2p.transportAttr.linkType);
5384 std::string channelKey = std::string(commParam->channelTag) + ":" + std::to_string(commParam->engine) + ":" +5385 std::string channelKey = std::string(commParam->channelTag) + ":" + std::to_string(commParam->engine) + ":" +
5385- std::to_string(remoteResV2.remoteRank) + ":" + std::to_string(CommProtocol::COMM_PROTOCOL_HCCS);5386+ std::to_string(remoteResV2.remoteRank) + ":" + std::to_string(linkType);
5386 HCCL_INFO("%s channelKey[%s]", __func__, channelKey.c_str());5387 HCCL_INFO("%s channelKey[%s]", __func__, channelKey.c_str());
5387 if (channelHandleMap_.find(channelKey) != channelHandleMap_.end()) {5388 if (channelHandleMap_.find(channelKey) != channelHandleMap_.end()) {
5388 HCCL_ERROR("[%s]the channel has existed.", __func__);5389 HCCL_ERROR("[%s]the channel has existed.", __func__);
@@ -123,6 +123,7 @@ HcclResult ProcessHcclChannelDesc(const HcclChannelDesc &channelDesc, HcclChanne
123 // 根据协议类型拷贝union中的相应成员123 // 根据协议类型拷贝union中的相应成员
124 switch (channelDesc.channelProtocol) {124 switch (channelDesc.channelProtocol) {
125 case COMM_PROTOCOL_HCCS:125 case COMM_PROTOCOL_HCCS:
126+ case COMM_PROTOCOL_HCCS_ONLY:
126 case COMM_PROTOCOL_PCIE:127 case COMM_PROTOCOL_PCIE:
127 case COMM_PROTOCOL_SIO:128 case COMM_PROTOCOL_SIO:
128 case COMM_PROTOCOL_UBC_CTP:129 case COMM_PROTOCOL_UBC_CTP:
@@ -143,6 +144,7 @@ HcclResult ProcessHcclChannelDesc(const HcclChannelDesc &channelDesc, HcclChanne
143 case COMM_PROTOCOL_ROCE: return "COMM_PROTOCOL_ROCE";144 case COMM_PROTOCOL_ROCE: return "COMM_PROTOCOL_ROCE";
144 case COMM_PROTOCOL_UBC_TP: return "COMM_PROTOCOL_UBC_TP";145 case COMM_PROTOCOL_UBC_TP: return "COMM_PROTOCOL_UBC_TP";
145 case COMM_PROTOCOL_UBOE: return "COMM_PROTOCOL_UBOE";146 case COMM_PROTOCOL_UBOE: return "COMM_PROTOCOL_UBOE";
147+ case COMM_PROTOCOL_HCCS_ONLY: return "COMM_PROTOCOL_HCCS_ONLY";
146 default: return "UNKNOWN_PROTOCOL";148 default: return "UNKNOWN_PROTOCOL";
147 }149 }
148 };150 };
@@ -55,3 +55,16 @@ TEST_F(HcclIndependentOpChannelTest, Ut_HcclChannelAcquire_When_NotifyNum_Is_Inv
55 HcclResult ret = HcclChannelAcquire(comm, CommEngine::COMM_ENGINE_AICPU_TS, channelDesc.data(), 1, channels.data());55 HcclResult ret = HcclChannelAcquire(comm, CommEngine::COMM_ENGINE_AICPU_TS, channelDesc.data(), 1, channels.data());
56 EXPECT_EQ(ret, HCCL_E_PARA);56 EXPECT_EQ(ret, HCCL_E_PARA);
57}57}
58+ 
59+TEST_F(HcclIndependentOpChannelTest, Ut_BuildChannelRequests_Expect_Success)
60+{
61+ ChannelManager channelManager_;
62+ std::vector<HcclChannelDesc> channelDesc(2);
63+ HcclChannelDescInit(channelDesc.data(), 2);
64+ channelDesc[0].remoteRank = 1;
65+ channelDesc[0].channelProtocol = CommProtocol::COMM_PROTOCOL_HCCS_ONLY;
66+ channelDesc[0].remoteRank = 1;
67+ channelDesc[0].channelProtocol = CommProtocol::COMM_PROTOCOL_SIO;
68+ OpCommTransport transport = channelManager_.BuildChannelRequests(channelDesc);
69+ EXPECT_EQ(1, transport.size());
70+}