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 "coll_comm_aicpu_kernel.h"
12 : #include "aicpu_init_param.h"
13 : #include "coll_comm_aicpu_mgr.h"
14 : #include "framework/aicpu_hccl_process.h"
15 : #include "log.h"
16 :
17 : extern "C" {
18 1 : __attribute__((visibility("default"))) uint32_t RunAicpuCommInit(void* args)
19 : {
20 1 : CHK_PRT_RET(args == nullptr, HCCL_ERROR("[%s]args is null.", __func__), HCCL_E_PARA);
21 :
22 1 : CommAicpuParam* commAicpuParam = reinterpret_cast<CommAicpuParam*>(args);
23 1 : DevType devType = static_cast<DevType>(commAicpuParam->deviceType);
24 1 : if (devType == DevType::DEV_TYPE_950 || devType == DevType::DEV_TYPE_960) {
25 1 : HCCL_INFO(
26 : "[RunAicpuCommInit] group[%s], deviceLogicId[%u], devicePhyId[%u], deviceType[%u]", commAicpuParam->hcomId,
27 : commAicpuParam->deviceLogicId, commAicpuParam->devicePhyId, commAicpuParam->deviceType);
28 1 : return CollCommAicpuMgr::GetInstance().InitComm(commAicpuParam);
29 : }
30 0 : return AicpuHcclProcess::AicpuIndOpCommInit(commAicpuParam);
31 : }
32 :
33 0 : __attribute__((visibility("default"))) uint32_t RunAicpuDfxInitV2(void* args)
34 : {
35 0 : HCCL_RUN_INFO("RunAicpuDfxInitV2 start.");
36 0 : CHK_PRT_RET(args == nullptr, HCCL_ERROR("[%s]args is null.", __func__), HCCL_E_PTR);
37 : struct InitTask {
38 : u64 context;
39 : char commTag[256];
40 : };
41 0 : InitTask* ctxArgs = reinterpret_cast<InitTask*>(args);
42 0 : CHK_PRT_RET(ctxArgs == nullptr, HCCL_ERROR("[%s]ctxArgs is null.", __func__), HCCL_E_PTR);
43 0 : HcclDfxOpInfo* dfxOpInfo = reinterpret_cast<HcclDfxOpInfo*>(ctxArgs->context);
44 0 : CollCommAicpu* currentComm = CollCommAicpuMgr::GetInstance().GetCurrentComm();
45 0 : CHK_PTR_NULL(currentComm);
46 0 : return currentComm->InitDfxOpInfo(dfxOpInfo);
47 : }
48 : }
|