Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 "order_launch_thread_mgr.h"
12 : #include "exception_util.h"
13 : #include "acl/acl_rt.h"
14 : #include "orion_adapter_rts.h"
15 : #include "coll_comm.h"
16 : #include "hcclCommOp.h"
17 : #include "sal_pub.h"
18 : #include "dlprof_function.h"
19 : #include "hcomm_c_adpt.h"
20 :
21 : namespace hccl {
22 :
23 : constexpr u32 ORDER_THREAD_NOTIFY_NUM = 1;
24 :
25 22 : static u32 GetAicpuBlockNum(s32 deviceLogicId)
26 : {
27 22 : int64_t coreNum = 0;
28 22 : aclError ret = aclrtGetDeviceInfo(static_cast<uint32_t>(deviceLogicId), ACL_DEV_ATTR_AICPU_CORE_NUM, &coreNum);
29 22 : HCCL_INFO(
30 : "[GetAicpuBlockNum] deviceLogicId[%d], aclrtGetDeviceInfo ret[%d], coreNum[%lld]", deviceLogicId, ret, coreNum);
31 22 : if (ret != ACL_SUCCESS || coreNum <= 0) {
32 5 : HCCL_WARNING(
33 : "[GetAicpuBlockNum] aclrtGetDeviceInfo failed, ret[%d], coreNum[%lld], use default 1", ret, coreNum);
34 5 : return 1U;
35 : }
36 17 : HCCL_INFO("[GetAicpuBlockNum] success, aicpuCoreNum[%u]", static_cast<u32>(coreNum));
37 17 : return static_cast<u32>(coreNum);
38 : }
39 :
40 : /* ============================ OrderLaunchContextRes ============================ */
41 :
42 12 : void OrderLaunchContextRes::DestroyResources()
43 : {
44 12 : if (opbaseThread != 0) {
45 3 : HcommResult ret = HcommThreadFree(&opbaseThread, 1);
46 3 : if (ret != HCCL_SUCCESS) {
47 3 : HCCL_WARNING(
48 : "[OrderLaunchContextRes] HcommThreadFree opbaseThread[0x%llx] failed, ret[%d]", opbaseThread, ret);
49 : }
50 3 : opbaseThread = 0;
51 : }
52 12 : if (aclgraphThread != 0) {
53 2 : HcommResult ret = HcommThreadFree(&aclgraphThread, 1);
54 2 : if (ret != HCCL_SUCCESS) {
55 2 : HCCL_WARNING(
56 : "[OrderLaunchContextRes] HcommThreadFree aclgraphThread[0x%llx] failed, ret[%d]", aclgraphThread, ret);
57 : }
58 2 : aclgraphThread = 0;
59 : }
60 12 : resValid = false;
61 12 : HCCL_INFO("[OrderLaunchContextRes] resources destroyed, context[0x%llx]", context);
62 12 : }
63 :
64 : /* ============================ OrderLaunchThreadMgr ============================ */
65 :
66 621 : OrderLaunchThreadMgr::OrderLaunchThreadMgr() {}
67 :
68 621 : OrderLaunchThreadMgr::~OrderLaunchThreadMgr()
69 : {
70 621 : std::unique_lock<std::mutex> lock(mutex_);
71 621 : Destroy();
72 621 : }
73 :
74 621 : void OrderLaunchThreadMgr::Destroy()
75 : {
76 633 : for (auto& entry : contextResMap_) {
77 12 : entry.second.DestroyResources();
78 : }
79 621 : contextResMap_.clear();
80 621 : contextGroupsMap_.clear();
81 621 : groupCtxMap_.clear();
82 :
83 628 : for (auto& entry : hcomAttachedThreadMap_) {
84 7 : if (entry.second != 0) {
85 7 : HcommResult ret = HcommThreadFreeWithStream(&entry.second, 1);
86 7 : if (ret != HCCL_SUCCESS) {
87 0 : HCCL_WARNING(
88 : "[OrderLaunchThreadMgr] HcommThreadFreeWithStream hcomAttachedThread[0x%llx] failed, ret[%d]",
89 : entry.second, ret);
90 : }
91 7 : entry.second = 0;
92 : }
93 : }
94 621 : hcomAttachedThreadMap_.clear();
95 621 : groupGraphMap_.clear();
96 :
97 624 : for (auto& entry : groupDeviceThreadMap_) {
98 3 : if (entry.second != 0) {
99 3 : HcommResult ret = HcommThreadFree(&entry.second, 1);
100 3 : if (ret != HCCL_SUCCESS) {
101 3 : HCCL_WARNING(
102 : "[OrderLaunchThreadMgr] HcommThreadFree deviceOrderThread[0x%llx] failed, ret[%d], group[%s]",
103 : entry.second, ret, entry.first.c_str());
104 : }
105 3 : entry.second = 0;
106 : }
107 : }
108 621 : groupDeviceThreadMap_.clear();
109 621 : }
110 :
111 192 : HcclResult OrderLaunchThreadMgr::RegisterOrderLaunch(const std::string& group)
112 : {
113 192 : std::unique_lock<std::mutex> lock(mutex_);
114 192 : if (groupCtxMap_.find(group) != groupCtxMap_.end()) {
115 3 : HCCL_WARNING("%s skip, group[%s] has already been registered", __func__, group.c_str());
116 3 : return HCCL_SUCCESS;
117 : }
118 189 : groupCtxMap_.insert({group, UINT64_MAX});
119 189 : HCCL_INFO("%s success, group[%s]", __func__, group.c_str());
120 189 : return HCCL_SUCCESS;
121 192 : }
122 :
123 165 : HcclResult OrderLaunchThreadMgr::UnRegisterOrderLaunch(const std::string& group)
124 : {
125 165 : std::unique_lock<std::mutex> lock(mutex_);
126 165 : auto it = groupCtxMap_.find(group);
127 165 : if (it == groupCtxMap_.end()) {
128 9 : HCCL_WARNING("%s skip, group[%s] has not been registered", __func__, group.c_str());
129 9 : return HCCL_SUCCESS;
130 : }
131 :
132 156 : u64 context = it->second;
133 156 : HCCL_INFO("[OrderLaunchThreadMgr][%s] group[%s] context[0x%llx]", __func__, group.c_str(), context);
134 :
135 156 : auto ctxIt = contextGroupsMap_.find(context);
136 156 : if (ctxIt != contextGroupsMap_.end()) {
137 0 : ctxIt->second.erase(group);
138 0 : if (ctxIt->second.empty()) {
139 0 : contextGroupsMap_.erase(ctxIt);
140 0 : auto resIt = contextResMap_.find(context);
141 0 : if (resIt != contextResMap_.end()) {
142 0 : resIt->second.DestroyResources();
143 0 : contextResMap_.erase(resIt);
144 : }
145 0 : HCCL_INFO("%s contextGroupsMap_ erase context[0x%llx]", __func__, context);
146 : }
147 : }
148 :
149 156 : groupCtxMap_.erase(it);
150 :
151 156 : auto devIt = groupDeviceThreadMap_.find(group);
152 156 : if (devIt != groupDeviceThreadMap_.end() && devIt->second != 0) {
153 0 : HcommResult ret = HcommThreadFree(&devIt->second, 1);
154 0 : if (ret != HCCL_SUCCESS) {
155 0 : HCCL_WARNING(
156 : "[OrderLaunchThreadMgr][%s] HcommThreadFree deviceOrderThread[0x%llx] failed, ret[%d], group[%s]",
157 : __func__, devIt->second, ret, group.c_str());
158 : }
159 0 : groupDeviceThreadMap_.erase(devIt);
160 : }
161 :
162 156 : HCCL_INFO("%s success, group[%s]", __func__, group.c_str());
163 156 : return HCCL_SUCCESS;
164 165 : }
165 :
166 38 : HcclResult OrderLaunchThreadMgr::GetCurrentContext(u64& currentContext)
167 : {
168 38 : aclrtContext rtCtx = nullptr;
169 38 : aclError ret = aclrtGetCurrentContext(&rtCtx);
170 38 : CHK_PRT_RET(
171 : ret != ACL_SUCCESS, HCCL_ERROR("[%s]aclrtGetCurrentContext failed, ret[%d]", __func__, ret), HCCL_E_RUNTIME);
172 37 : currentContext = reinterpret_cast<u64>(rtCtx);
173 37 : CHK_PRT_RET(
174 : currentContext == UINT64_MAX, HCCL_ERROR("[%s]GetCurrentContext failed, context is INVALID_U64", __func__),
175 : HCCL_E_RUNTIME);
176 37 : return HCCL_SUCCESS;
177 : }
178 :
179 19 : HcclResult OrderLaunchThreadMgr::EnsureContextRes(u64 context)
180 : {
181 19 : if (contextResMap_.find(context) == contextResMap_.end()) {
182 12 : contextResMap_.emplace(context, OrderLaunchContextRes());
183 12 : HCCL_INFO(
184 : "[OrderLaunchThreadMgr][%s] created new OrderLaunchContextRes for context[0x%llx]", __func__, context);
185 : }
186 19 : return HCCL_SUCCESS;
187 : }
188 :
189 10 : HcclResult OrderLaunchThreadMgr::SetAttachedStream(const std::string& group, u32 graphId, void* stream)
190 : {
191 10 : CHK_PRT_RET(stream == nullptr, HCCL_ERROR("[%s] stream is nullptr, graphId[%u]", __func__, graphId), HCCL_E_PTR);
192 :
193 9 : std::unique_lock<std::mutex> lock(mutex_);
194 :
195 9 : ThreadHandle thread = 0;
196 9 : HcommResult ret = HcommThreadAllocWithStream(COMM_ENGINE_CPU_TS, stream, ORDER_THREAD_NOTIFY_NUM, &thread);
197 9 : CHK_PRT_RET(
198 : ret != HCCL_SUCCESS,
199 : HCCL_ERROR("[%s] HcommThreadAllocWithStream failed, ret[%d], graphId[%u]", __func__, ret, graphId),
200 : static_cast<HcclResult>(ret));
201 :
202 8 : hcomAttachedThreadMap_[graphId] = thread;
203 8 : groupGraphMap_[group] = graphId;
204 8 : HCCL_INFO(
205 : "%s success, group[%s], graphId[%u], stream[%p], thread[0x%llx]", __func__, group.c_str(), graphId, stream,
206 : thread);
207 8 : return HCCL_SUCCESS;
208 9 : }
209 :
210 37 : void OrderLaunchThreadMgr::UpdateGroupContextMapping(const std::string& group, u64 currentContext)
211 : {
212 37 : auto groupIt = groupCtxMap_.find(group);
213 37 : if (groupIt != groupCtxMap_.end() && groupIt->second != currentContext) {
214 16 : HCCL_INFO(
215 : "[OrderLaunchThreadMgr][%s] group[%s] context updated: [0x%llx] -> [0x%llx]", __func__, group.c_str(),
216 : groupIt->second, currentContext);
217 16 : if (groupIt->second != UINT64_MAX) {
218 0 : auto oldCtxIt = contextGroupsMap_.find(groupIt->second);
219 0 : if (oldCtxIt != contextGroupsMap_.end()) {
220 0 : oldCtxIt->second.erase(group);
221 0 : if (oldCtxIt->second.empty()) {
222 0 : contextGroupsMap_.erase(oldCtxIt);
223 : }
224 : }
225 : }
226 16 : groupIt->second = currentContext;
227 16 : contextGroupsMap_[currentContext].insert(group);
228 21 : } else if (groupIt == groupCtxMap_.end()) {
229 20 : groupCtxMap_[group] = currentContext;
230 20 : contextGroupsMap_[currentContext].insert(group);
231 : }
232 37 : }
233 :
234 37 : bool OrderLaunchThreadMgr::IsOrderLaunchDisabled(u64 currentContext)
235 : {
236 37 : if (blockNum_ == 0U) {
237 22 : blockNum_ = GetAicpuBlockNum(static_cast<s32>(Hccl::HrtGetDevice()));
238 : }
239 37 : if (blockNum_ == 0U) {
240 0 : return false;
241 : }
242 37 : auto ctxGroupsIt = contextGroupsMap_.find(currentContext);
243 37 : u32 groupCount = (ctxGroupsIt != contextGroupsMap_.end()) ? static_cast<u32>(ctxGroupsIt->second.size()) : 0U;
244 37 : HCCL_INFO(
245 : "[OrderLaunchThreadMgr][%s] blockNum[%u] groupCount[%u] context[0x%llx]", __func__, blockNum_, groupCount,
246 : currentContext);
247 37 : return groupCount <= blockNum_;
248 : }
249 :
250 20 : HcclResult OrderLaunchThreadMgr::EnsureOrderThread(
251 : OrderThreadMode mode, const std::string& group, uint32_t notifyNumPerThread, ThreadHandle& thread)
252 : {
253 20 : std::unique_lock<std::mutex> lock(mutex_);
254 20 : thread = 0;
255 :
256 20 : u64 currentContext = UINT64_MAX;
257 20 : CHK_RET(GetCurrentContext(currentContext));
258 19 : CHK_RET(EnsureContextRes(currentContext));
259 :
260 19 : auto& ctxRes = contextResMap_[currentContext];
261 :
262 19 : UpdateGroupContextMapping(group, currentContext);
263 :
264 19 : if (IsOrderLaunchDisabled(currentContext)) {
265 12 : HCCL_INFO(
266 : "[OrderLaunchThreadMgr][%s] order launch disabled, group[%s], context[0x%llx]", __func__, group.c_str(),
267 : currentContext);
268 12 : thread = 0;
269 12 : return HCCL_SUCCESS;
270 : }
271 :
272 7 : ThreadHandle& targetThread = (mode == OrderThreadMode::ACLGRAPH) ? ctxRes.aclgraphThread : ctxRes.opbaseThread;
273 :
274 7 : if (targetThread == 0) {
275 6 : HCCL_INFO(
276 : "[OrderLaunchThreadMgr][%s] creating new order thread, context[0x%llx], mode[%u], notifyNumPerThread[%u]",
277 : __func__, currentContext, static_cast<u8>(mode), notifyNumPerThread);
278 :
279 6 : HcommResult ret = HcommThreadAlloc(COMM_ENGINE_CPU_TS, 1, ¬ifyNumPerThread, &targetThread);
280 6 : CHK_PRT_RET(
281 : ret != HCCL_SUCCESS,
282 : HCCL_ERROR("[%s] HcommThreadAlloc failed, ret[%d], mode[%u]", __func__, ret, static_cast<u8>(mode)),
283 : static_cast<HcclResult>(ret));
284 :
285 5 : ctxRes.resValid = true;
286 5 : HCCL_INFO(
287 : "[OrderLaunchThreadMgr] Created new order thread[0x%llx], context[0x%llx], mode[%u]", targetThread,
288 : currentContext, static_cast<u8>(mode));
289 : } else {
290 1 : HCCL_INFO(
291 : "[OrderLaunchThreadMgr][%s] order thread already exists, context[0x%llx], thread[0x%llx]", __func__,
292 : currentContext, targetThread);
293 : }
294 :
295 6 : thread = targetThread;
296 6 : return HCCL_SUCCESS;
297 20 : }
298 :
299 12 : HcclResult OrderLaunchThreadMgr::EnsureDeviceOrderThread(
300 : const std::string& group, uint32_t notifyNumPerThread, ThreadHandle& thread)
301 : {
302 12 : std::unique_lock<std::mutex> lock(mutex_);
303 12 : thread = 0;
304 :
305 12 : u64 currentContext = UINT64_MAX;
306 12 : CHK_RET(GetCurrentContext(currentContext));
307 12 : UpdateGroupContextMapping(group, currentContext);
308 12 : if (IsOrderLaunchDisabled(currentContext)) {
309 8 : HCCL_INFO(
310 : "[OrderLaunchThreadMgr][%s] order launch disabled, group[%s], context[0x%llx]", __func__, group.c_str(),
311 : currentContext);
312 8 : thread = 0;
313 8 : return HCCL_SUCCESS;
314 : }
315 :
316 4 : auto it = groupDeviceThreadMap_.find(group);
317 4 : if (it != groupDeviceThreadMap_.end() && it->second != 0) {
318 0 : thread = it->second;
319 0 : HCCL_INFO(
320 : "[OrderLaunchThreadMgr][%s] reuse device order thread[0x%llx], group[%s]", __func__, thread, group.c_str());
321 0 : return HCCL_SUCCESS;
322 : }
323 :
324 4 : HCCL_INFO(
325 : "[OrderLaunchThreadMgr][%s] creating new device order thread, group[%s], notifyNumPerThread[%u]", __func__,
326 : group.c_str(), notifyNumPerThread);
327 :
328 4 : ThreadHandle targetThread = 0;
329 4 : HcommResult ret = HcommThreadAlloc(COMM_ENGINE_AICPU_TS, 1, ¬ifyNumPerThread, &targetThread);
330 4 : CHK_PRT_RET(
331 : ret != HCCL_SUCCESS,
332 : HCCL_ERROR("[%s] HcommThreadAlloc failed, ret[%d], group[%s]", __func__, ret, group.c_str()),
333 : static_cast<HcclResult>(ret));
334 :
335 3 : thread = targetThread;
336 3 : groupDeviceThreadMap_[group] = targetThread;
337 3 : HCCL_INFO("[OrderLaunchThreadMgr] Created new device order thread[0x%llx], group[%s]", targetThread, group.c_str());
338 3 : return HCCL_SUCCESS;
339 12 : }
340 :
341 6 : ThreadHandle OrderLaunchThreadMgr::GetHcomAttachedThreadByGroup(const std::string& group)
342 : {
343 6 : std::unique_lock<std::mutex> lock(mutex_);
344 :
345 6 : u64 currentContext = UINT64_MAX;
346 6 : if (GetCurrentContext(currentContext) != HCCL_SUCCESS) {
347 0 : HCCL_WARNING("[%s] GetCurrentContext failed, group[%s]", __func__, group.c_str());
348 0 : return 0;
349 : }
350 6 : UpdateGroupContextMapping(group, currentContext);
351 6 : if (IsOrderLaunchDisabled(currentContext)) {
352 3 : HCCL_INFO(
353 : "[OrderLaunchThreadMgr][%s] order launch disabled, group[%s], context[0x%llx]", __func__, group.c_str(),
354 : currentContext);
355 3 : return 0;
356 : }
357 :
358 3 : auto graphIt = groupGraphMap_.find(group);
359 3 : if (graphIt == groupGraphMap_.end()) {
360 1 : HCCL_WARNING(
361 : "[%s] graphId not found for group[%s], please call HcomSetAttachedStream first", __func__, group.c_str());
362 1 : return 0;
363 : }
364 2 : u32 graphId = graphIt->second;
365 :
366 2 : auto attachedThreadIt = hcomAttachedThreadMap_.find(graphId);
367 2 : if (attachedThreadIt == hcomAttachedThreadMap_.end() || attachedThreadIt->second == 0) {
368 0 : HCCL_ERROR(
369 : "[%s] hcomThread not found for group[%s], graphId[%u], please call HcomSetAttachedStream first", __func__,
370 : group.c_str(), graphId);
371 0 : return 0;
372 : }
373 2 : HCCL_INFO(
374 : "[%s] success, group[%s], graphId[%u], thread[0x%llx]", __func__, group.c_str(), graphId,
375 : attachedThreadIt->second);
376 2 : return attachedThreadIt->second;
377 6 : }
378 :
379 0 : HcclResult OrderLaunchThreadMgr::RegisterThreadToComm(CollComm* collComm, ThreadHandle thread)
380 : {
381 0 : CommEngineResMgr* engineResMgr = collComm->GetCommEngineResMgr();
382 0 : if (engineResMgr != nullptr) {
383 0 : CHK_RET(engineResMgr->RegisterOrderLaunchThread(thread));
384 : }
385 0 : return HCCL_SUCCESS;
386 : }
387 :
388 0 : HcclResult OrderLaunchThreadMgr::RegisterDfx(
389 : CollComm* collComm, HcclDedicatedThreadType useType, ThreadHandle thread, u64 beginTime, const std::string& commId)
390 : {
391 0 : if (useType == HCCL_DED_THREAD_TYPE_AICPU_ORDER_LAUNCH_DEVICE) {
392 0 : HcclCommDfx* hcclCommDfx = collComm->GetHcclCommDfx();
393 0 : if (hcclCommDfx != nullptr) {
394 0 : const std::string kernelName = "RunAicpuThreadInit";
395 0 : CHK_RET(hcclCommDfx->ReportKernel(beginTime, commId, kernelName, SalGetTid(), false));
396 0 : HCCL_INFO("[%s] DEVICE order launch thread ReportKernel done, comm[%s]", __func__, commId.c_str());
397 0 : }
398 : } else {
399 : std::function<HcclResult(u32, u32, const Hccl::TaskParam&, u64)> dfxCallback
400 0 : = [](u32 streamId, u32 taskId, const Hccl::TaskParam& taskParam, u64 handle) {
401 : (void)streamId;
402 : (void)taskId;
403 : (void)taskParam;
404 : (void)handle;
405 0 : return HCCL_SUCCESS;
406 0 : };
407 0 : int ret = HcommThreadRegisterDfx(thread, dfxCallback);
408 0 : if (ret != 0) {
409 0 : HCCL_WARNING("[%s] HcommThreadRegisterDfx failed, ret[%d], thread[0x%llx]", __func__, ret, thread);
410 : }
411 0 : }
412 0 : return HCCL_SUCCESS;
413 : }
414 :
415 6 : HcclResult OrderLaunchThreadMgr::OrderLaunchThreadAcquire(
416 : HcclDedicatedThreadType useType, CollComm* collComm, const std::string& group, uint32_t notifyNumPerThread,
417 : ThreadHandle& thread)
418 : {
419 6 : thread = 0;
420 :
421 6 : HCCL_INFO(
422 : "[%s] begin, useType[%d], group[%s], notifyNumPerThread[%u]", __func__, static_cast<s32>(useType),
423 : group.c_str(), notifyNumPerThread);
424 :
425 6 : u64 beginTime = Hccl::DlProfFunction::GetInstance().dlMsprofSysCycleTime();
426 :
427 6 : switch (useType) {
428 1 : case HCCL_DED_THREAD_TYPE_AICPU_ORDER_LAUNCH_OPBASE: {
429 1 : HcclResult ret = EnsureOrderThread(OrderThreadMode::OPBASE, group, notifyNumPerThread, thread);
430 1 : CHK_PRT_RET(
431 : ret != HCCL_SUCCESS, HCCL_ERROR("[%s] EnsureOrderThread OPBASE failed, ret[%d]", __func__, ret), ret);
432 1 : break;
433 : }
434 1 : case HCCL_DED_THREAD_TYPE_AICPU_ORDER_LAUNCH_ACLGRAPH: {
435 1 : HcclResult ret = EnsureOrderThread(OrderThreadMode::ACLGRAPH, group, notifyNumPerThread, thread);
436 1 : CHK_PRT_RET(
437 : ret != HCCL_SUCCESS, HCCL_ERROR("[%s] EnsureOrderThread ACLGRAPH failed, ret[%d]", __func__, ret), ret);
438 1 : break;
439 : }
440 2 : case HCCL_DED_THREAD_TYPE_AICPU_ORDER_LAUNCH_GE: {
441 2 : ThreadHandle th = GetHcomAttachedThreadByGroup(group);
442 2 : thread = th;
443 2 : CHK_PRT_RET(
444 : th == 0,
445 : HCCL_WARNING(
446 : "[%s] GetHcomAttachedThreadByGroup failed, group[%s], please call HcomSetAttachedStream first",
447 : __func__, group.c_str()),
448 : HCCL_SUCCESS);
449 1 : break;
450 : }
451 1 : case HCCL_DED_THREAD_TYPE_AICPU_ORDER_LAUNCH_DEVICE: {
452 1 : HcclResult ret = EnsureDeviceOrderThread(group, notifyNumPerThread, thread);
453 1 : CHK_PRT_RET(
454 : ret != HCCL_SUCCESS, HCCL_ERROR("[%s] EnsureDeviceOrderThread failed, ret[%d]", __func__, ret), ret);
455 1 : break;
456 : }
457 1 : default:
458 1 : HCCL_ERROR("[%s] invalid useType[%d] for order launch", __func__, static_cast<s32>(useType));
459 1 : return HCCL_E_PARA;
460 : }
461 :
462 4 : if (thread != 0 && collComm != nullptr && useType != HCCL_DED_THREAD_TYPE_AICPU_ORDER_LAUNCH_DEVICE) {
463 0 : CHK_RET(RegisterThreadToComm(collComm, thread));
464 0 : CHK_RET(RegisterDfx(collComm, useType, thread, beginTime, group));
465 : }
466 :
467 4 : HCCL_INFO("[%s] success, useType[%d], thread[0x%llx]", __func__, static_cast<s32>(useType), thread);
468 4 : return HCCL_SUCCESS;
469 : }
470 :
471 : } // namespace hccl
|