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 "framework/aicpu_hccl_process.h"
12 : #include "coll_comm_aicpu_kernel_adpt.h"
13 : #include "aicpu_thread_process.h"
14 :
15 : extern "C" {
16 1 : __attribute__((visibility("default"))) uint32_t RunAicpuIndOpThreadInit(void* args)
17 : {
18 1 : CHK_PTR_NULL(args);
19 1 : uint64_t devAddr = *reinterpret_cast<uint64_t*>(args);
20 1 : ThreadMgrAicpuParam* param = reinterpret_cast<ThreadMgrAicpuParam*>(devAddr);
21 : DevType devType;
22 1 : CHK_RET(hrtGetDeviceType(devType));
23 1 : if (devType == DevType::DEV_TYPE_950 || devType == DevType::DEV_TYPE_960) {
24 1 : HCCL_INFO(
25 : "[RunAicpuIndOpThreadInit] group[%s], threadNum[%u], deviceType[%u]", param->hcomId, param->threadNum,
26 : devType);
27 1 : return CollCommAicpuKernelAdptInitThreads(param);
28 : }
29 0 : return AicpuHcclProcess::AicpuIndOpThreadInit(param);
30 : }
31 :
32 1 : __attribute__((visibility("default"))) uint32_t RunAicpuIndOpNotify(void* args)
33 : {
34 1 : CHK_PTR_NULL(args);
35 1 : uint64_t devAddr = *reinterpret_cast<uint64_t*>(args);
36 1 : NotifyMgrAicpuParam* param = reinterpret_cast<NotifyMgrAicpuParam*>(devAddr);
37 : DevType devType;
38 1 : CHK_RET(hrtGetDeviceType(devType));
39 1 : if (devType == DevType::DEV_TYPE_950 || devType == DevType::DEV_TYPE_960) {
40 1 : HCCL_INFO(
41 : "[RunAicpuIndOpNotify] group[%s], notifyNum[%u], deviceType[%u]", param->hcomId, param->notifyNum, devType);
42 1 : return CollCommAicpuKernelAdptInitNotify(param);
43 : }
44 0 : return AicpuHcclProcess::AicpuIndOpNotifyInit(param);
45 : }
46 :
47 1 : __attribute__((visibility("default"))) uint32_t RunAicpuThreadInit(void* args)
48 : {
49 1 : CHK_PTR_NULL(args);
50 1 : uint64_t devAddr = *reinterpret_cast<uint64_t*>(args);
51 1 : ThreadMgrAicpuParam* param = reinterpret_cast<ThreadMgrAicpuParam*>(devAddr);
52 1 : HCCL_INFO(
53 : "[RunAicpuThreadInit] threadNum[%u], deviceLogicId[%d], deviceType[%u]", param->threadNum, param->deviceLogicId,
54 : param->deviceType);
55 1 : return AicpuThreadProcess::AicpuThreadInit(param);
56 : }
57 :
58 1 : __attribute__((visibility("default"))) uint32_t RunAicpuThreadDestroy(void* args)
59 : {
60 1 : CHK_PTR_NULL(args);
61 1 : uint64_t devAddr = *reinterpret_cast<uint64_t*>(args);
62 1 : ThreadMgrAicpuParam* param = reinterpret_cast<ThreadMgrAicpuParam*>(devAddr);
63 1 : HCCL_INFO("[RunAicpuThreadDestroy] threadNum[%u]", param->threadNum);
64 1 : return AicpuThreadProcess::AicpuThreadDestroy(param);
65 : }
66 :
67 1 : __attribute__((visibility("default"))) uint32_t RunAicpuThreadSupplementNotify(void* args)
68 : {
69 1 : CHK_PTR_NULL(args);
70 1 : uint64_t devAddr = *reinterpret_cast<uint64_t*>(args);
71 1 : ThreadMgrAicpuParam* param = reinterpret_cast<ThreadMgrAicpuParam*>(devAddr);
72 1 : HCCL_INFO(
73 : "[RunAicpuThreadSupplementNotify] threadNum[%u], deviceLogicId[%d], deviceType[%u]", param->threadNum,
74 : param->deviceLogicId, param->deviceType);
75 1 : return AicpuThreadProcess::AicpuThreadSupplementNotify(param);
76 : }
77 : }
|