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 : #include "hccl_communicator.h"
11 :
12 : #include <memory>
13 : #include <utility>
14 : #include "communicator_impl.h"
15 : #include "snap_shot_parse.h"
16 : #include "task_abort_handler_v2.h"
17 : #include "ccu_dev_mgr.h"
18 : #include "communicator_callback.h"
19 : #include "comm_manager.h"
20 : #include "orion_adapter_rts.h"
21 :
22 : namespace Hccl {
23 :
24 253 : HcclCommunicator::HcclCommunicator(const CommParams& commParams) : commParams(std::move(commParams))
25 : {
26 253 : pimpl = std::make_unique<CommunicatorImpl>();
27 253 : config.hcclBufferSize = 0;
28 253 : config.hcclDeterministic = 0;
29 253 : RegistTaskAbortHandler();
30 253 : }
31 :
32 20 : HcclCommunicator::HcclCommunicator(const CommParams& commParams, const HcclCommConfig* config)
33 20 : : commParams(std::move(commParams)),
34 20 : config(*config)
35 : {
36 20 : pimpl = std::make_unique<CommunicatorImpl>();
37 20 : RegistTaskAbortHandler();
38 20 : }
39 :
40 273 : HcclCommunicator::~HcclCommunicator()
41 : {
42 273 : DECTOR_TRY_CATCH("HcclCommunicator", {
43 : UnRegistTaskAbortHandler();
44 : u32 devLogicId = GetDeviceLogicId();
45 : pimpl = nullptr;
46 : CommManager::GetInstance(static_cast<s32>(devLogicId)).DeinitCcuDriver();
47 : });
48 273 : }
49 :
50 10 : HcclResult HcclCommunicator::Init(const std::string& ranktableM) { return pimpl->Init(commParams, ranktableM, config); }
51 :
52 0 : HcclResult HcclCommunicator::Init(const RankTableInfo& ranktable) { return pimpl->Init(commParams, ranktable, config); }
53 :
54 3 : HcclResult HcclCommunicator::CreateSubComm(
55 : const CommParams& subCommParams, const std::vector<u32>& rankIds, std::shared_ptr<HcclCommunicator>& subHcclComm)
56 : {
57 3 : subHcclComm = std::make_shared<Hccl::HcclCommunicator>(subCommParams);
58 3 : return pimpl->CreateSubComm(subCommParams, rankIds, subHcclComm->GetCommImpl());
59 : }
60 :
61 3 : HcclResult HcclCommunicator::CreateSubComm(
62 : const CommParams& subCommParams, const std::vector<u32>& rankIds, std::shared_ptr<HcclCommunicator>& subHcclComm,
63 : HcclCommConfig& subConfig)
64 : {
65 3 : subHcclComm = std::make_shared<Hccl::HcclCommunicator>(subCommParams);
66 3 : config.hcclBufferSize = 0;
67 3 : config.hcclDeterministic = 0;
68 3 : return pimpl->CreateSubComm(subCommParams, rankIds, subHcclComm->GetCommImpl(), subConfig);
69 : }
70 :
71 14 : CommunicatorImpl* HcclCommunicator::GetCommImpl() { return pimpl.get(); }
72 :
73 0 : void HcclCommunicator::DeInit() const {}
74 :
75 5 : HcclResult HcclCommunicator::LoadOpbasedCollOp(const CollOpParams& opParams, void* stream)
76 : {
77 5 : return pimpl->LoadOpbasedCollOp(opParams, stream);
78 : }
79 :
80 0 : HcclResult HcclCommunicator::AllocCollOpResource(const CollOpParams& opParams, void** addr)
81 : {
82 0 : return pimpl->AllocCollOpResource(opParams, addr);
83 : }
84 :
85 2 : HcclResult HcclCommunicator::CalcCollOffloadOpRes(
86 : const OpType opType, u64 dataSize, HcclDataType dataType, CollOffloadOpResReq& resReq)
87 : {
88 2 : std::lock_guard<std::mutex> lock(serialMutex);
89 2 : auto ret = pimpl->CalcCollOffloadOpRes(opType, dataSize, dataType, resReq);
90 2 : return ret;
91 2 : }
92 :
93 3 : HcclResult HcclCommunicator::SetCollOffloadSlaveStreams(const std::string& opTag, std::vector<void*> slaveStreams)
94 : {
95 3 : std::lock_guard<std::mutex> lock(serialMutex);
96 3 : auto ret = pimpl->SetCollOffloadSlaveStreams(opTag, slaveStreams);
97 3 : return ret;
98 3 : }
99 :
100 : HcclResult
101 3 : HcclCommunicator::SetCollOffloadScratchBuf(const std::string& opTag, void* scratchMemPtr, u64 requiredScratchMemSize)
102 : {
103 3 : std::lock_guard<std::mutex> lock(serialMutex);
104 3 : auto ret = pimpl->SetCollOffloadScratchBuf(opTag, scratchMemPtr, requiredScratchMemSize);
105 3 : return ret;
106 3 : }
107 :
108 1 : HcclResult HcclCommunicator::LoadOffloadCollOp(std::string& opTag, const CollOpParams& opParams, void* stream)
109 : {
110 1 : std::lock_guard<std::mutex> lock(serialMutex);
111 1 : auto ret = pimpl->LoadOffloadCollOp(opTag, opParams, stream);
112 1 : return ret;
113 1 : }
114 :
115 78 : HcclResult HcclCommunicator::GetRankSize(uint32_t* rankSize)
116 : {
117 78 : if (rankSize == nullptr) {
118 0 : HCCL_ERROR("Parameter rank size is nullptr.");
119 0 : return HcclResult::HCCL_E_PARA;
120 : }
121 :
122 78 : *rankSize = pimpl->GetRankSize();
123 :
124 78 : return HcclResult::HCCL_SUCCESS;
125 : }
126 :
127 : HcclResult
128 0 : HcclCommunicator::HcclGetCclBuffer(uintptr_t& cclBufferAddr, size_t& cclBufferSize, HcclMemType& cclBufferMemType)
129 : {
130 0 : auto commImpl = GetCommImpl();
131 0 : if (UNLIKELY(commImpl == nullptr)) {
132 0 : HCCL_ERROR("[HcclCommunicator][%s] commImpl is null.", __func__);
133 0 : return HcclResult::HCCL_E_PTR;
134 : }
135 :
136 : // GetCclBuffer接口不合理,应返回裸指针
137 : // 本次性能整改暂时最小化修改,避免重复分配内存和拷贝
138 0 : const auto& hcclBuffer = commImpl->GetCclBuffer();
139 0 : if (UNLIKELY(hcclBuffer == nullptr)) {
140 0 : cclBufferSize = 0;
141 0 : cclBufferAddr = 0;
142 0 : cclBufferMemType = HcclMemType::HCCL_MEM_TYPE_DEVICE;
143 0 : return HcclResult::HCCL_SUCCESS;
144 : }
145 :
146 0 : cclBufferSize = commImpl->GetBufferSize();
147 0 : cclBufferAddr = hcclBuffer->GetAddr();
148 0 : cclBufferMemType = hcclBuffer->GetMemType();
149 0 : return HCCL_SUCCESS;
150 : }
151 :
152 : // 后续会整改把cclbuffer等资源的申请放到collcomm中
153 3 : HcclResult HcclCommunicator::GetCclBufferSharedPtr(std::shared_ptr<DevBuffer>& cclBuffer)
154 : {
155 3 : auto commImpl = GetCommImpl();
156 3 : if (commImpl == nullptr) {
157 3 : HCCL_ERROR("[HcclCommunicator][%s] commImpl is null.", __func__);
158 1 : return HcclResult::HCCL_E_PTR;
159 : }
160 2 : cclBuffer = commImpl->GetCclBuffer();
161 2 : if (cclBuffer == nullptr) {
162 3 : HCCL_WARNING("[HcclCommunicator][%s] cclBuffer is nullptr, ranksize is %u.", __func__, commImpl->GetRankSize());
163 : }
164 2 : return HcclResult::HCCL_SUCCESS;
165 : }
166 :
167 65 : HcclResult HcclCommunicator::GetRankId(uint32_t& rankId)
168 : {
169 65 : rankId = pimpl->GetMyRank();
170 65 : return HcclResult::HCCL_SUCCESS;
171 : }
172 :
173 1 : HcclResult HcclCommunicator::AllocCommResource(void* mc2Tiling, void** commContext)
174 : {
175 1 : std::lock_guard<std::mutex> lock(serialMutex);
176 1 : auto ret = pimpl->AllocCommResource(mc2Tiling, commContext);
177 1 : return ret;
178 1 : }
179 :
180 0 : HcclResult HcclCommunicator::GetCcuTaskInfo(void* tilingData, void* ccuTaskGroup)
181 : {
182 0 : return pimpl->GetCcuTaskInfo(tilingData, ccuTaskGroup);
183 : }
184 :
185 0 : u32 HcclCommunicator::GetCcuMc2ServerNum() { return pimpl->GetCcuMc2ServerNum(); }
186 :
187 167 : const std::string& HcclCommunicator::GetId() const { return pimpl->GetId(); }
188 :
189 2 : HcclResult HcclCommunicator::Suspend()
190 : {
191 2 : std::lock_guard<std::mutex> lock(serialMutex);
192 2 : auto ret = pimpl->Suspend();
193 2 : return ret;
194 2 : }
195 :
196 1 : HcclResult HcclCommunicator::Clean()
197 : {
198 1 : std::lock_guard<std::mutex> lock(serialMutex);
199 1 : auto ret = pimpl->Clean();
200 1 : return ret;
201 1 : }
202 :
203 4 : HcclResult HcclCommunicator::Resume()
204 : {
205 4 : std::lock_guard<std::mutex> lock(serialMutex);
206 4 : auto ret = pimpl->Resume();
207 4 : return ret;
208 4 : }
209 :
210 6 : bool HcclCommunicator::IsWorldGroup() const { return pimpl->IsWorldGroup(); }
211 :
212 0 : HcclResult HcclCcuTaskKillPreProcess(u32 deviceLogicId)
213 : {
214 : // 有没有使能ccu都尝试执行
215 0 : return CcuSetTaskKill(deviceLogicId);
216 : }
217 :
218 0 : HcclResult HcclCcuTaskKillPostProcess(u32 deviceLogicId) { return CcuSetTaskKillDone(deviceLogicId); }
219 :
220 2 : HcclResult HcclCcuResumePfeTableProcess(u32 deviceLogicId)
221 : {
222 : // 待修改
223 2 : return HcclResult::HCCL_SUCCESS;
224 : }
225 :
226 5 : HcclResult HcclCommunicator::GetSnapShotDynamicBuf(void* buf)
227 : {
228 5 : std::lock_guard<std::mutex> lock(serialMutex);
229 5 : CHK_RET(pimpl->GetSnapShotDynamicBuf(*(static_cast<BinaryStream*>(buf))));
230 5 : return HcclResult::HCCL_SUCCESS;
231 5 : }
232 :
233 1 : HcclResult HcclCommunicator::RecoverComm(void* snapShotComm, u32 step, const char* changeInfo)
234 : {
235 1 : std::lock_guard<std::mutex> lock(serialMutex);
236 2 : return pimpl->RecoverComm(*(static_cast<SnapShotComm*>(snapShotComm)), step, changeInfo);
237 1 : }
238 :
239 : HcclResult
240 1 : HcclCommunicator::RecoverSubComm(const void* snapShotSubComm, std::shared_ptr<HcclCommunicator>& subComm, u32 step)
241 : {
242 1 : const SnapShotSubComm* snapShotSubCommTemp = static_cast<const SnapShotSubComm*>(snapShotSubComm);
243 1 : std::lock_guard<std::mutex> lock(serialMutex);
244 1 : subComm = std::make_shared<Hccl::HcclCommunicator>(snapShotSubCommTemp->commParams);
245 1 : subComm->RegisterAcceStateCallBack(CommunicatorCallback());
246 2 : return pimpl->RecoverSubComm(*snapShotSubCommTemp, subComm->GetCommImpl(), step);
247 1 : }
248 :
249 5 : void* HcclCommunicator::GetStaticBinaryInfo()
250 : {
251 5 : std::lock_guard<std::mutex> lock(serialMutex);
252 10 : return static_cast<void*>(&pimpl->GetStaticBinaryInfo());
253 5 : }
254 :
255 1 : bool HcclCommunicator::IsCommReady() { return pimpl->IsCommReady(); }
256 :
257 272 : void HcclCommunicator::RegistTaskAbortHandler() { TaskAbortHandler::GetInstance().Register(this); }
258 :
259 272 : void HcclCommunicator::UnRegistTaskAbortHandler() { TaskAbortHandler::GetInstance().UnRegister(this); }
260 :
261 7 : HcclResult HcclCommunicator::GetOneSidedService(HcclOneSidedService** oneSidedService)
262 : {
263 21 : HCCL_INFO("HcclCommunicator::GetOneSidedService begin");
264 7 : CHK_RET(pimpl->GetOneSidedService(oneSidedService));
265 21 : HCCL_INFO("HcclCommunicator::GetOneSidedService end");
266 7 : return HCCL_SUCCESS;
267 : }
268 :
269 0 : u32 HcclCommunicator::GetUsedChannelCount(u32 dieId) { return pimpl->GetUsedChannelCount(dieId); }
270 :
271 13 : void HcclCommunicator::RegisterPrintChannelInfoCallback(std::function<void()> callback)
272 : {
273 13 : pimpl->RegisterPrintChannelInfoCallback(callback);
274 13 : }
275 :
276 5 : CommStatus HcclCommunicator::GetCommStatus() const { return pimpl->GetCommStatus(); }
277 :
278 5 : HcclResult HcclCommunicator::CreateCommCclBuf()
279 : {
280 15 : HCCL_INFO("HcclCommunicator::CreateCommCclBuf start");
281 5 : return pimpl->CreateCommCclBuf();
282 : }
283 :
284 1 : HcclResult HcclCommunicator::GetInCclBuf(void*& commInputPtr, u64& commInputSize)
285 : {
286 1 : return pimpl->GetInCclBuf(commInputPtr, commInputSize);
287 : }
288 :
289 1 : HcclResult HcclCommunicator::GetOutCclBuf(void*& commOutputPtr, u64& commOutputSize)
290 : {
291 1 : return pimpl->GetOutCclBuf(commOutputPtr, commOutputSize);
292 : }
293 :
294 1 : HcclResult HcclCommunicator::GetLocalCclBuffer(void** addr, uint64_t* size)
295 : {
296 1 : return pimpl->GetLocalCclBuffer(addr, size);
297 : }
298 :
299 : HcclResult
300 5 : HcclCommunicator::GetDevMemWorkSpace(const std::string& memTag, uint64_t* size, void** addr, bool* newCreated)
301 : {
302 5 : return pimpl->GetDevMemWorkSpace(memTag, size, addr, newCreated);
303 : }
304 :
305 0 : HcclResult HcclCommunicator::GetAicpuOpStreamNotify(rtStream_t* opStream, u8 aicpuNotifyNum, void** aicpuNotify)
306 : {
307 0 : return pimpl->GetAicpuOpStreamNotify(opStream, aicpuNotifyNum, aicpuNotify);
308 : }
309 :
310 1 : HcclResult HcclCommunicator::GetIndirectInputCclBuf(void*& commIndirectInputPtr, u64& commIndirectInputSize)
311 : {
312 1 : return pimpl->GetIndirectInCclBuf(commIndirectInputPtr, commIndirectInputSize);
313 : }
314 :
315 1 : HcclResult HcclCommunicator::GetIndirectOutputCclBuf(void*& commIndirectOutputPtr, u64& commIndirectOutputSize)
316 : {
317 1 : return pimpl->GetIndirectOutCclBuf(commIndirectOutputPtr, commIndirectOutputSize);
318 : }
319 :
320 14 : HcclResult HcclCommunicator::SetAccelerator(HcclAccelerator hcclAccelerator, bool isCcuMsAvailable)
321 : {
322 14 : CHK_RET(pimpl->SetAccelerator(hcclAccelerator, isCcuMsAvailable));
323 14 : return HcclResult::HCCL_SUCCESS;
324 : }
325 :
326 0 : HcclResult HcclCommunicator::SetAccelerator(int32_t accelerator, bool isCcuMsAvailable)
327 : {
328 0 : if (accelerator < static_cast<int32_t>(HcclAccelerator::DEFAULT)
329 0 : || accelerator > static_cast<int32_t>(HcclAccelerator::AICPU)) {
330 0 : HCCL_ERROR(
331 : "[HcclCommunicator][SetAccelerator] Invalid accelerator value [%d], valid range is [0,7]", accelerator);
332 0 : return HCCL_E_NOT_SUPPORT;
333 : }
334 0 : HcclAccelerator hcclAccelerator = static_cast<HcclAccelerator::Value>(accelerator);
335 0 : CHK_RET(SetAccelerator(hcclAccelerator, isCcuMsAvailable));
336 0 : return HcclResult::HCCL_SUCCESS;
337 : }
338 :
339 0 : HcclResult HcclCommunicator::GetAccelerator(int32_t* accelerator) const
340 : {
341 0 : CHK_RET(pimpl->GetAccelerator(accelerator));
342 0 : return HcclResult::HCCL_SUCCESS;
343 : }
344 :
345 1 : bool HcclCommunicator::IsUsingCcuMs() const
346 : {
347 1 : return pimpl->IsCommUsingCcuMs(); // 通信域粒度
348 : }
349 :
350 1 : bool HcclCommunicator::IsUsingCcuSched() const
351 : {
352 1 : return pimpl->IsCommUsingCcuSched(); // 通信域粒度
353 : }
354 :
355 17 : void HcclCommunicator::RegisterAcceStateCallBack(
356 : std::function<HcclResult(const std::string& commId, bool isUsingCcuMs, bool isUsingCcuSched)> callback)
357 : {
358 17 : pimpl->RegisterAcceStateCallBack(callback);
359 17 : }
360 :
361 1 : HcclResult HcclCommunicator::CalcTaskNum(OpType opType, DataType dataType, u64 count, u32& taskNum)
362 : {
363 3 : HCCL_INFO("HcclCommunicator::CalcTaskNum begin");
364 1 : return pimpl->CalcTaskNum(opType, dataType, count, taskNum);
365 : }
366 :
367 2 : HcclResult HcclCommunicator::GetTopoDesc(HcclTopoDescs* topoDescs, uint32_t topoSize)
368 : {
369 2 : return pimpl->GetTopoDesc(topoDescs, topoSize);
370 : }
371 :
372 0 : HcclResult HcclCommunicator::GetDevType(DevType& devType)
373 : {
374 0 : devType = pimpl->GetDevType();
375 0 : HCCL_INFO("HcclCommunicator::GetDevTyp, devtype is %s", devType.Describe().c_str());
376 0 : return HcclResult::HCCL_SUCCESS;
377 : }
378 :
379 1 : HcclResult HcclCommunicator::SetGlobalWorkSpace() const
380 : {
381 3 : HCCL_WARNING("set global work space not support at A5");
382 1 : return HCCL_SUCCESS;
383 : }
384 :
385 : HcclResult
386 57 : HcclCommunicator::ExecAlgSelect(const CollOpParams& opParams, int32_t aivCoreLimit, bool& ifAiv, std::string& algName)
387 : {
388 57 : return pimpl->HcomSelectAlg(opParams, aivCoreLimit, ifAiv, algName);
389 : }
390 :
391 1 : HcclResult HcclCommunicator::GetRankGraphV2(void*& rankGraph)
392 : {
393 1 : CHK_SMART_PTR_NULL(pimpl);
394 1 : shared_ptr<RankGraph> rankGraphShPtr = pimpl->GetRankGraph();
395 1 : CHK_SMART_PTR_NULL(rankGraphShPtr);
396 1 : rankGraph = static_cast<void*>(rankGraphShPtr.get());
397 1 : return HCCL_SUCCESS;
398 1 : }
399 :
400 2 : HcclResult HcclCommunicator::CreateBarrierMemory(void*& sendBuf, void*& recvBuf, uint64_t count)
401 : {
402 2 : return pimpl->CreateBarrierMemory(sendBuf, recvBuf, count);
403 : }
404 :
405 1 : HcclResult HcclCommunicator::SetAivClearEnable(bool aivClearEnable)
406 : {
407 1 : pimpl->SetAivClearEnable(aivClearEnable);
408 1 : return HCCL_SUCCESS;
409 : }
410 :
411 1 : HcclResult HcclCommunicator::SetAivCoreLimit(u32 newAivCoreLimit)
412 : {
413 1 : pimpl->SetAivCoreLimit(newAivCoreLimit);
414 1 : return HCCL_SUCCESS;
415 : }
416 :
417 0 : HcclResult HcclCommunicator::GetNetLayers(uint32_t** netLayers, uint32_t* netLayerNum)
418 : {
419 0 : return pimpl->GetNetLayers(netLayers, netLayerNum);
420 : }
421 :
422 0 : HcclResult HcclCommunicator::GetInstSizeByNetLayer(uint32_t netLayer, uint32_t* rankNum)
423 : {
424 0 : return pimpl->GetInstSizeByNetLayer(netLayer, rankNum);
425 : }
426 :
427 0 : HcclResult HcclCommunicator::GetConfigInCCLbufferSize(uint64_t* cclBufSize)
428 : {
429 0 : *cclBufSize = static_cast<uint64_t>(pimpl->GetBufferSize());
430 0 : return HCCL_SUCCESS;
431 : }
432 0 : HcclResult HcclCommunicator::GetKFCWorkSpace(const char* memTag, uint64_t* size, void** addr, bool* newCreated)
433 : {
434 0 : HCCL_INFO("HcclCommunicator::GetKFCWorkSpace start");
435 0 : CHK_RET(pimpl->CreateWorkspaceBuf(memTag, size, newCreated));
436 0 : shared_ptr<DevBuffer> buff = pimpl->GetKFCWorkSpace(memTag);
437 0 : *addr = reinterpret_cast<void*>(buff.get()->GetAddr());
438 0 : if (*size != static_cast<uint64_t>(buff.get()->GetSize())) {
439 0 : HCCL_ERROR(
440 : "HcclCommunicator::GetKFCWorkSpace, The size of mem is non-consistent. [%u->%u]", *size,
441 : buff.get()->GetSize());
442 0 : return HCCL_E_PARA;
443 : }
444 0 : return HcclResult::HCCL_SUCCESS;
445 0 : }
446 :
447 2 : HcclResult HcclCommunicator::GetInstRanksByNetLayer(uint32_t netLayer, uint32_t** ranks, uint32_t* rankNum)
448 : {
449 2 : return pimpl->GetInstRanksByNetLayer(netLayer, ranks, rankNum);
450 : }
451 :
452 2 : HcclResult HcclCommunicator::GetInstTopoTypeByNetLayer(uint32_t netLayer, uint32_t* topoType)
453 : {
454 2 : return pimpl->GetInstTopoTypeByNetLayer(netLayer, topoType);
455 : }
456 :
457 4 : HcclResult HcclCommunicator::GetInstSizeListByNetLayer(uint32_t netLayer, uint32_t** instSizeList, uint32_t* listSize)
458 : {
459 4 : return pimpl->GetInstSizeListByNetLayer(netLayer, instSizeList, listSize);
460 : }
461 :
462 2 : HcclResult HcclCommunicator::GetLinks(
463 : uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink** linkList, uint32_t* listSize)
464 : {
465 2 : return pimpl->GetLinks(netLayer, srcRank, dstRank, linkList, listSize);
466 : }
467 :
468 2 : HcclResult HcclCommunicator::GetTopoInstsByLayer(uint32_t netLayer, uint32_t** topoInsts, uint32_t* topoInstNum)
469 : {
470 2 : return pimpl->GetTopoInstsByLayer(netLayer, topoInsts, topoInstNum);
471 : }
472 :
473 2 : HcclResult HcclCommunicator::GetTopoType(uint32_t netLayer, uint32_t topoInstId, CommTopo* topoType)
474 : {
475 2 : return pimpl->GetTopoType(netLayer, topoInstId, topoType);
476 : }
477 :
478 : HcclResult
479 2 : HcclCommunicator::GetRanksByTopoInst(uint32_t netLayer, uint32_t topoInstId, uint32_t** ranks, uint32_t* rankNum)
480 : {
481 2 : return pimpl->GetRanksByTopoInst(netLayer, topoInstId, ranks, rankNum);
482 : }
483 :
484 1 : HcclResult HcclCommunicator::CalcNumBlocks(
485 : const CollOpParams& opParams, int32_t aivCoreLimit, std::string& algName, u32& numBlocks)
486 : {
487 1 : return pimpl->CalcNumBlocks(opParams, aivCoreLimit, algName, numBlocks);
488 : }
489 :
490 1 : HcclResult HcclCommunicator::GetAlgExecParam(
491 : const CollOpParams& opParams, bool clearEnable, void*& commContext, u64& len, u32 aivCoreLimit)
492 : {
493 1 : return pimpl->GetAlgExecParam(opParams, clearEnable, commContext, len, aivCoreLimit);
494 : }
495 :
496 1 : HcclResult HcclCommunicator::ClearOpResource(const std::string& opTag) { return pimpl->ClearOpResource(opTag); }
497 :
498 284 : u32 HcclCommunicator::GetDeviceLogicId() const { return pimpl->GetDeviceLogicId(); }
499 :
500 2 : HcclResult HcclCommunicator::GetEndpointNum(uint32_t layer, uint32_t topoInstId, uint32_t* num)
501 : {
502 2 : return pimpl->GetEndpointNum(layer, topoInstId, num);
503 : }
504 :
505 : HcclResult
506 3 : HcclCommunicator::GetEndpointDesc(uint32_t layer, uint32_t topoInstId, uint32_t* descNum, EndpointDesc* endpointDesc)
507 : {
508 3 : return pimpl->GetEndpointDesc(layer, topoInstId, descNum, endpointDesc);
509 : }
510 :
511 1 : HcclResult HcclCommunicator::GetEndpointInfo(
512 : uint32_t rankId, const EndpointDesc* endpointDesc, EndpointAttr endpointAttr, uint32_t infoLen, void* info)
513 : {
514 1 : return pimpl->GetEndpointInfo(rankId, endpointDesc, endpointAttr, infoLen, info);
515 : }
516 :
517 28 : Trace& HcclCommunicator::GetTrace() const { return pimpl->GetTrace(); }
518 :
519 0 : u32 HcclCommunicator::GetRankInParentComm() { return pimpl->GetRankInParentComm(); }
520 :
521 0 : HcclResult HcclCommunicator::Mc2AiCpuStreamAllocAndGetV2(rtStream_t* aiCpuStream)
522 : {
523 0 : return pimpl->Mc2AiCpuStreamAllocAndGetV2(aiCpuStream);
524 : }
525 :
526 4 : HcclResult HcclCommunicator::GetStreamId(u32& streamId)
527 : {
528 4 : streamId = pimpl->GetDpuStreamId();
529 4 : return HCCL_SUCCESS;
530 : }
531 :
532 0 : HcclResult HcclCommunicator::GetRankIpPortMap(RankIpPortMapPtr& rankIpPortMap)
533 : {
534 0 : CHK_RET(pimpl->GetRankIpPortMap(rankIpPortMap));
535 0 : return HCCL_SUCCESS;
536 : }
537 :
538 : } // namespace Hccl
|