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 : /*
12 : * 该特性代码不涉及开源
13 : */
14 :
15 : #include "interface_hccl.h"
16 : #include "typical_param_check.h"
17 : #include "hccl_common.h"
18 : #include "externalinput.h"
19 : #include "rdma_resource_manager.h"
20 : #include "typical_mr_manager.h"
21 : #include "typical_sync_mem.h"
22 : #include "typical_window_mem.h"
23 : #include "typical_qp_manager.h"
24 : #include "send_recv_executor.h"
25 : #include "adapter_rts.h"
26 :
27 : using namespace hccl;
28 : constexpr u32 DEVISOR_VALUE_FOUR = 4;
29 : constexpr u32 MAX_WQE_PER_DOORBELL = 300;
30 : constexpr u32 QP_QUEUE_DEPTH_MAX = 32768;
31 : constexpr u32 QP_QUEUE_DEPTH_MIN = 128;
32 : #define HCCN_RESV_MEM_TYPE_PDCCL (0)
33 :
34 0 : struct MrInfoT AscendMrInfo2MrInfo(AscendMrInfo* ascendMrInfo)
35 : {
36 0 : struct MrInfoT innerMrInfo = {};
37 0 : innerMrInfo.addr = reinterpret_cast<void*>(ascendMrInfo->addr);
38 0 : innerMrInfo.size = ascendMrInfo->size;
39 0 : innerMrInfo.lkey = ascendMrInfo->key;
40 0 : return innerMrInfo;
41 : }
42 :
43 30 : HcclResult hcclCreateAscendQP(AscendQPInfo* ascendQPInfo)
44 : {
45 30 : s32 deviceLogicId = 0;
46 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
47 30 : CHK_PTR_NULL(ascendQPInfo);
48 30 : struct TypicalQp qpInfo = {};
49 30 : CHK_RET(TypicalQpManager::GetInstance().CreateQp(qpInfo));
50 30 : ascendQPInfo->qpn = qpInfo.qpn;
51 30 : ascendQPInfo->gidIdx = qpInfo.gidIdx;
52 510 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
53 480 : ascendQPInfo->gid[i] = qpInfo.gid[i];
54 : }
55 30 : ascendQPInfo->psn = qpInfo.psn;
56 30 : HCCL_INFO("hcclCreateAscendQP success! qpn %u, gid index %u, psn %u", ascendQPInfo->qpn,
57 : ascendQPInfo->gidIdx, ascendQPInfo->psn);
58 :
59 30 : return HCCL_SUCCESS;
60 : }
61 :
62 76 : HcclResult CheckDepth(uint32_t depth)
63 : {
64 76 : if (depth >= QP_QUEUE_DEPTH_MIN && ((depth & (depth - 1)) == 0) && depth <= QP_QUEUE_DEPTH_MAX) {
65 61 : return HCCL_SUCCESS;
66 : }
67 15 : HCCL_ERROR("[CheckDepth]depth[%u] is invalid, depth should be power of 2 and in [%u, %u]",
68 : depth, QP_QUEUE_DEPTH_MIN, QP_QUEUE_DEPTH_MAX);
69 15 : return HCCL_E_PARA;
70 : }
71 :
72 22 : HcclResult hcclCreateAscendQPWithAttr(AscendQPInfo* ascendQPInfo)
73 : {
74 22 : s32 deviceLogicId = 0;
75 22 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
76 22 : CHK_PTR_NULL(ascendQPInfo);
77 22 : CHK_RET(CheckDepth(ascendQPInfo->sq_depth));
78 19 : CHK_RET(CheckDepth(ascendQPInfo->scq_depth));
79 16 : CHK_RET(CheckDepth(ascendQPInfo->rq_depth));
80 13 : CHK_RET(CheckDepth(ascendQPInfo->rcq_depth));
81 : struct TypicalQp qpInfo;
82 10 : QpConfigInfo qpConfigInfo{ascendQPInfo->sq_depth, ascendQPInfo->rq_depth, ascendQPInfo->scq_depth, ascendQPInfo->rcq_depth, 0, 0};
83 : u32 poolId;
84 10 : if (HCCL_SUCCESS == RdmaResourceManager::GetInstance().GetResvMemPoolIdByType(HCCN_RESV_MEM_TYPE_PDCCL, poolId)) {
85 0 : qpConfigInfo.use_resv_mem = 1;
86 0 : qpConfigInfo.resv_mem_pool_id = poolId;
87 : }
88 10 : CHK_RET(TypicalQpManager::GetInstance().CreateQp(qpInfo, qpConfigInfo));
89 9 : ascendQPInfo->qpn = qpInfo.qpn;
90 9 : ascendQPInfo->gidIdx = qpInfo.gidIdx;
91 153 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
92 144 : ascendQPInfo->gid[i] = qpInfo.gid[i];
93 : }
94 9 : ascendQPInfo->psn = qpInfo.psn;
95 9 : HCCL_INFO("hcclCreateAscendQP success! qpn[%u], gid index[%u], psn[%u], sq_depth[%u], rq_depth[%u], scq_depth[%u], rcq_depth[%u] ", ascendQPInfo->qpn,
96 : ascendQPInfo->gidIdx, ascendQPInfo->psn, ascendQPInfo->sq_depth, ascendQPInfo->rq_depth, ascendQPInfo->scq_depth, ascendQPInfo->rcq_depth);
97 :
98 9 : return HCCL_SUCCESS;
99 : }
100 :
101 5 : HcclResult hcclCreateAscendCQWithAttr(AscendCQInfo* ascendCQInfo)
102 : {
103 5 : CHK_PTR_NULL(ascendCQInfo);
104 4 : if (ascendCQInfo->cqDepth == 0) {
105 0 : ascendCQInfo->cqDepth = HOST_SQ_CQ_DEPTH;
106 : }
107 4 : CHK_RET(CheckDepth(ascendCQInfo->cqDepth));
108 :
109 1 : s32 deviceLogicId = 0;
110 1 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
111 1 : CHK_RET(TypicalQpManager::GetInstance().CreateCq(*ascendCQInfo));
112 1 : HCCL_INFO("hcclCreateAscendCQWithAttr success! cqn[%u], cqDepth[%u]",
113 : ascendCQInfo->cqn, ascendCQInfo->cqDepth);
114 1 : return HCCL_SUCCESS;
115 : }
116 :
117 3 : HcclResult hcclDestroyAscendCQ(AscendCQInfo* ascendCQInfo)
118 : {
119 3 : CHK_PTR_NULL(ascendCQInfo);
120 2 : s32 deviceLogicId = 0;
121 2 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
122 2 : CHK_RET(TypicalQpManager::GetInstance().DestroyCq(ascendCQInfo->cqn));
123 1 : HCCL_INFO("hcclDestroyAscendCQ success! cqn[%u]", ascendCQInfo->cqn);
124 1 : return HCCL_SUCCESS;
125 : }
126 :
127 5 : HcclResult hcclPollAscendCQ(AscendCQInfo* cqInfo, uint32_t num, uint32_t *polledNum, struct AscendWc *wc)
128 : {
129 5 : CHK_PTR_NULL(cqInfo);
130 4 : CHK_PTR_NULL(polledNum);
131 3 : CHK_PTR_NULL(wc);
132 :
133 2 : s32 deviceLogicId = 0;
134 2 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
135 2 : void* cqHandle = nullptr;
136 2 : CHK_RET(TypicalQpManager::GetInstance().GetCqHandle(cqInfo->cqn, cqHandle));
137 :
138 2 : s32 ret = HrtRaPollTypicalCq(cqHandle, num, (void*)wc);
139 2 : if (ret < 0) {
140 1 : HCCL_ERROR("[hcclPollAscendCQ] Poll typical cq failed, cqn[%u], ret[%d]", cqInfo->cqn, ret);
141 1 : return HCCL_E_INTERNAL;
142 : }
143 1 : *polledNum = (uint32_t)ret;
144 1 : return HCCL_SUCCESS;
145 : }
146 :
147 6 : HcclResult hcclCreateAscendQPWithCQWithAttr(AscendCQInfo* ascendSendCQInfo, AscendCQInfo* ascendRecvCQInfo,
148 : AscendVerbsQPInfo* ascendQPInfo)
149 : {
150 6 : s32 deviceLogicId = 0;
151 6 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
152 6 : CHK_PTR_NULL(ascendSendCQInfo);
153 5 : CHK_PTR_NULL(ascendRecvCQInfo);
154 4 : CHK_PTR_NULL(ascendQPInfo);
155 :
156 3 : CHK_RET(TypicalQpManager::GetInstance().ValidateCq(ascendSendCQInfo->cqn));
157 2 : CHK_RET(TypicalQpManager::GetInstance().ValidateCq(ascendRecvCQInfo->cqn));
158 :
159 2 : struct TypicalQp qpInfo { 0 };
160 2 : QpConfigWithCQInfo qpConfigInfo { 0 };
161 2 : qpConfigInfo.sendCqn = ascendSendCQInfo->cqn;
162 2 : qpConfigInfo.recvCqn = ascendRecvCQInfo->cqn;
163 :
164 2 : if (ascendQPInfo->cap.maxSendWr == 0) {
165 1 : qpConfigInfo.sq_depth = DEFAULT_OPBASE_MAX_SEND_WR;
166 : } else {
167 1 : CHK_RET(CheckDepth(ascendQPInfo->cap.maxSendWr));
168 1 : qpConfigInfo.sq_depth = ascendQPInfo->cap.maxSendWr;
169 : }
170 2 : if (ascendQPInfo->cap.maxRecvWr == 0) {
171 1 : qpConfigInfo.rq_depth = DEFAULT_MAX_RECV_WR;
172 : } else {
173 1 : CHK_RET(CheckDepth(ascendQPInfo->cap.maxRecvWr));
174 1 : qpConfigInfo.rq_depth = ascendQPInfo->cap.maxRecvWr;
175 : }
176 :
177 2 : CHK_RET(TypicalQpManager::GetInstance().GetCqDepth(ascendSendCQInfo->cqn, qpConfigInfo.scq_depth));
178 2 : CHK_RET(TypicalQpManager::GetInstance().GetCqDepth(ascendRecvCQInfo->cqn, qpConfigInfo.rcq_depth));
179 :
180 2 : if (ascendQPInfo->qp_type == 0) {
181 1 : ascendQPInfo->qp_type = ASCEND_QPT_RC;
182 : }
183 :
184 2 : qpConfigInfo.sq_sig_all = ascendQPInfo->sqSigAll;
185 :
186 2 : if (ascendQPInfo->cap.maxSendSge == 0) {
187 1 : qpConfigInfo.max_send_sge = DEFAULT_MAX_SEND_SGE;
188 : } else {
189 1 : qpConfigInfo.max_send_sge = ascendQPInfo->cap.maxSendSge;
190 : }
191 2 : if (ascendQPInfo->cap.maxRecvSge == 0) {
192 1 : qpConfigInfo.max_recv_sge = DEFAULT_MAX_RECV_SGE;
193 : } else {
194 1 : qpConfigInfo.max_recv_sge = ascendQPInfo->cap.maxRecvSge;
195 : }
196 2 : if (ascendQPInfo->cap.maxInlineData == 0) {
197 1 : qpConfigInfo.max_inline_data = DEFAULT_MAX_INLINE_DATA;
198 : } else {
199 1 : qpConfigInfo.max_inline_data = ascendQPInfo->cap.maxInlineData;
200 : }
201 :
202 : u32 poolId;
203 2 : if (HCCL_SUCCESS == RdmaResourceManager::GetInstance().GetResvMemPoolIdByType(HCCN_RESV_MEM_TYPE_PDCCL, poolId)) {
204 0 : qpConfigInfo.use_resv_mem = 1;
205 0 : qpConfigInfo.resv_mem_pool_id = poolId;
206 : }
207 2 : CHK_RET(TypicalQpManager::GetInstance().CreateQpWithCQ(qpInfo, qpConfigInfo));
208 2 : ascendQPInfo->qpn = qpInfo.qpn;
209 2 : ascendQPInfo->gidIdx = qpInfo.gidIdx;
210 34 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
211 32 : ascendQPInfo->gid[i] = qpInfo.gid[i];
212 : }
213 2 : ascendQPInfo->psn = qpInfo.psn;
214 2 : HCCL_INFO("hcclCreateAscendQPWithCQWithAttr success! qpn[%u], gid index[%u], psn[%u], sendCqn[%u], recvCqn[%u]",
215 : ascendQPInfo->qpn, ascendQPInfo->gidIdx, ascendQPInfo->psn, ascendSendCQInfo->cqn, ascendRecvCQInfo->cqn);
216 :
217 2 : return HCCL_SUCCESS;
218 : }
219 :
220 3 : HcclResult hcclDestroyAscendVerbsQP(AscendVerbsQPInfo* ascendQPVerbsInfo)
221 : {
222 3 : s32 deviceLogicId = 0;
223 3 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
224 3 : CHK_PTR_NULL(ascendQPVerbsInfo);
225 : struct TypicalQp qpInfo;
226 2 : qpInfo.qpn = ascendQPVerbsInfo->qpn;
227 2 : qpInfo.gidIdx = ascendQPVerbsInfo->gidIdx;
228 34 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
229 32 : qpInfo.gid[i] = ascendQPVerbsInfo->gid[i];
230 : }
231 2 : qpInfo.psn = ascendQPVerbsInfo->psn;
232 2 : CHK_RET(TypicalQpManager::GetInstance().DestroyQpWithoutCQ(qpInfo));
233 1 : HCCL_INFO("hcclDestroyAscendVerbsQP success! qpn[%u]", ascendQPVerbsInfo->qpn);
234 1 : return HCCL_SUCCESS;
235 : }
236 :
237 0 : HcclResult hcclModifyAscendQP(AscendQPInfo* localQPInfo, AscendQPInfo* remoteQPInfo)
238 : {
239 0 : s32 deviceLogicId = 0;
240 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
241 : AscendQPQos qpQos;
242 0 : qpQos.sl = GetExternalInputRdmaServerLevel();
243 0 : qpQos.tc = GetExternalInputRdmaTrafficClass();
244 0 : CHK_RET(hcclModifyAscendQPEx(localQPInfo, remoteQPInfo, &qpQos));
245 0 : return HCCL_SUCCESS;
246 : }
247 :
248 30 : HcclResult hcclModifyAscendQPEx(AscendQPInfo* localQPInfo, AscendQPInfo* remoteQPInfo, AscendQPQos* qpQos)
249 : {
250 30 : s32 deviceLogicId = 0;
251 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
252 30 : CHK_PTR_NULL(localQPInfo);
253 30 : CHK_PTR_NULL(remoteQPInfo);
254 30 : CHK_PTR_NULL(qpQos);
255 30 : CHK_PRT_RET((qpQos->sl > HCCL_RDMA_SL_MAX),
256 : HCCL_ERROR("[hcclModifyAscendQPEx]The value of sl[%u] is invalid. except: [%u, %u].",
257 : qpQos->sl, HCCL_RDMA_SL_MIN, HCCL_RDMA_SL_MAX), HCCL_E_PARA);
258 30 : CHK_PRT_RET((qpQos->tc > HCCL_RDMA_TC_MAX),
259 : HCCL_ERROR("[hcclModifyAscendQPEx]The value of tc[%u] is invalid. except: [%u, %u].",
260 : qpQos->tc, HCCL_RDMA_TC_MIN, HCCL_RDMA_TC_MAX), HCCL_E_PARA);
261 :
262 : // 设置的RDMATrafficClass需要是4的整数倍, 否则报错
263 30 : CHK_PRT_RET(qpQos->tc % DEVISOR_VALUE_FOUR != 0,
264 : HCCL_ERROR("[hcclModifyAscendQPEx]The value of tc[%u] is not a multiple of 4.",
265 : qpQos->tc), HCCL_E_PARA);
266 :
267 : struct TypicalQp localQp;
268 30 : localQp.qpn = localQPInfo->qpn;
269 30 : localQp.gidIdx = localQPInfo->gidIdx;
270 510 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
271 480 : localQp.gid[i] = localQPInfo->gid[i];
272 : }
273 30 : localQp.psn = localQPInfo->psn;
274 30 : localQp.sl = qpQos->sl;
275 30 : localQp.tc = qpQos->tc;
276 :
277 30 : struct TypicalQp remoteQp = {};
278 30 : remoteQp.qpn = remoteQPInfo->qpn;
279 30 : remoteQp.gidIdx = remoteQPInfo->gidIdx;
280 510 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
281 480 : remoteQp.gid[i] = remoteQPInfo->gid[i];
282 : }
283 30 : remoteQp.psn = remoteQPInfo->psn;
284 30 : CHK_RET(TypicalQpManager::GetInstance().ModifyQp(localQp, remoteQp));
285 30 : return HCCL_SUCCESS;
286 : }
287 :
288 2 : HcclResult hcclModifyAscendVerbsQP(AscendVerbsQPInfo* localQPInfo, AscendVerbsQPInfo* remoteQPInfo)
289 : {
290 2 : s32 deviceLogicId = 0;
291 2 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
292 : AscendQPQos qpQos;
293 1 : qpQos.sl = GetExternalInputRdmaServerLevel();
294 1 : qpQos.tc = GetExternalInputRdmaTrafficClass();
295 1 : CHK_RET(hcclModifyAscendVerbsQPEx(localQPInfo, remoteQPInfo, &qpQos));
296 1 : return HCCL_SUCCESS;
297 : }
298 :
299 9 : HcclResult hcclModifyAscendVerbsQPEx(AscendVerbsQPInfo* localQPVerbsInfo, AscendVerbsQPInfo* remoteQPVerbsInfo, AscendQPQos* qpQos)
300 : {
301 9 : s32 deviceLogicId = 0;
302 9 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
303 9 : CHK_PTR_NULL(localQPVerbsInfo);
304 8 : CHK_PTR_NULL(remoteQPVerbsInfo);
305 7 : CHK_PTR_NULL(qpQos);
306 6 : CHK_PRT_RET((qpQos->sl > HCCL_RDMA_SL_MAX),
307 : HCCL_ERROR("[hcclModifyAscendVerbsQPEx]The value of sl[%u] is invalid. except: [%u, %u].",
308 : qpQos->sl, HCCL_RDMA_SL_MIN, HCCL_RDMA_SL_MAX), HCCL_E_PARA);
309 5 : CHK_PRT_RET((qpQos->tc > HCCL_RDMA_TC_MAX),
310 : HCCL_ERROR("[hcclModifyAscendVerbsQPEx]The value of tc[%u] is invalid. except: [%u, %u].",
311 : qpQos->tc, HCCL_RDMA_TC_MIN, HCCL_RDMA_TC_MAX), HCCL_E_PARA);
312 :
313 4 : CHK_PRT_RET(qpQos->tc % DEVISOR_VALUE_FOUR != 0,
314 : HCCL_ERROR("[hcclModifyAscendVerbsQPEx]The value of tc[%u] is not a multiple of 4.",
315 : qpQos->tc), HCCL_E_PARA);
316 :
317 : struct TypicalQp localQp;
318 3 : localQp.qpn = localQPVerbsInfo->qpn;
319 3 : localQp.gidIdx = localQPVerbsInfo->gidIdx;
320 51 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
321 48 : localQp.gid[i] = localQPVerbsInfo->gid[i];
322 : }
323 3 : localQp.psn = localQPVerbsInfo->psn;
324 3 : localQp.sl = qpQos->sl;
325 3 : localQp.tc = qpQos->tc;
326 :
327 3 : struct TypicalQp remoteQp = {};
328 3 : remoteQp.qpn = remoteQPVerbsInfo->qpn;
329 3 : remoteQp.gidIdx = remoteQPVerbsInfo->gidIdx;
330 51 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
331 48 : remoteQp.gid[i] = remoteQPVerbsInfo->gid[i];
332 : }
333 3 : remoteQp.psn = remoteQPVerbsInfo->psn;
334 3 : CHK_RET(TypicalQpManager::GetInstance().ModifyVerbsQp(localQp, remoteQp));
335 2 : return HCCL_SUCCESS;
336 : }
337 :
338 30 : HcclResult hcclDestroyAscendQP(AscendQPInfo* ascendQPInfo)
339 : {
340 30 : s32 deviceLogicId = 0;
341 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
342 30 : CHK_PTR_NULL(ascendQPInfo);
343 : struct TypicalQp qpInfo;
344 30 : qpInfo.qpn = ascendQPInfo->qpn;
345 30 : qpInfo.gidIdx = ascendQPInfo->gidIdx;
346 510 : for (uint32_t i = 0; i < GID_LENGTH; i++) {
347 480 : qpInfo.gid[i] = ascendQPInfo->gid[i];
348 : }
349 30 : qpInfo.psn = ascendQPInfo->psn;
350 30 : CHK_RET(TypicalQpManager::GetInstance().DestroyQp(qpInfo));
351 30 : return HCCL_SUCCESS;
352 : }
353 :
354 30 : HcclResult hcclAllocWindowMem(void **ptr, size_t len)
355 : {
356 30 : s32 deviceLogicId = 0;
357 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
358 30 : return TypicalWindowMem::GetInstance().AllocWindowMem(ptr, len);
359 : }
360 :
361 30 : HcclResult hcclFreeWindowMem(void *ptr)
362 : {
363 30 : s32 deviceLogicId = 0;
364 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
365 30 : return TypicalWindowMem::GetInstance().FreeWindowMem(ptr);
366 : }
367 :
368 90 : HcclResult hcclAllocSyncMem(int32_t **ptr)
369 : {
370 90 : s32 deviceLogicId = 0;
371 90 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
372 90 : return TypicalSyncMem::GetInstance().AllocSyncMem(ptr);
373 : }
374 :
375 90 : HcclResult hcclFreeSyncMem(int32_t *ptr)
376 : {
377 90 : s32 deviceLogicId = 0;
378 90 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
379 90 : return TypicalSyncMem::GetInstance().FreeSyncMem(ptr);
380 : }
381 :
382 30 : HcclResult hcclRegisterMem(AscendMrInfo* memInfo)
383 : {
384 30 : s32 deviceLogicId = 0;
385 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
386 30 : CHK_PTR_NULL(memInfo);
387 30 : MrInfoT mrInfo = {};
388 30 : mrInfo.addr = reinterpret_cast<void *>(static_cast<uintptr_t>(memInfo->addr));
389 30 : mrInfo.size = memInfo->size;
390 30 : mrInfo.access = RA_ACCESS_REMOTE_WRITE | RA_ACCESS_LOCAL_WRITE | RA_ACCESS_REMOTE_READ;
391 30 : CHK_RET(TypicalMrManager::GetInstance().RegisterMem(mrInfo));
392 30 : memInfo->key = mrInfo.lkey;
393 30 : HCCL_RUN_INFO("[hcclRegisterMem] Register WindowMem addr[%p], size[%llu], key[%u].", mrInfo.addr, mrInfo.size, mrInfo.lkey);
394 30 : return HCCL_SUCCESS;
395 : }
396 :
397 30 : HcclResult hcclDeRegisterMem(AscendMrInfo* memInfo)
398 : {
399 30 : s32 deviceLogicId = 0;
400 30 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
401 30 : CHK_PTR_NULL(memInfo);
402 30 : MrInfoT mrInfo = {};
403 30 : mrInfo.addr = reinterpret_cast<void *>(static_cast<uintptr_t>(memInfo->addr));
404 30 : mrInfo.size = memInfo->size;
405 30 : mrInfo.access = RA_ACCESS_REMOTE_WRITE | RA_ACCESS_LOCAL_WRITE | RA_ACCESS_REMOTE_READ;
406 30 : mrInfo.lkey = memInfo->key;
407 30 : CHK_RET(TypicalMrManager::GetInstance().DeRegisterMem(mrInfo));
408 30 : HCCL_RUN_INFO("[hcclDeRegisterMem] DeRegister WindowMem addr[%p], size[%llu], key[%u].", mrInfo.addr, mrInfo.size, mrInfo.lkey);
409 30 : return HCCL_SUCCESS;
410 : }
411 :
412 3 : HcclResult hcclRdmaMemRegister(AscendMrAttr* memInfo)
413 : {
414 3 : s32 deviceLogicId = 0;
415 3 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
416 3 : CHK_PTR_NULL(memInfo);
417 2 : MrInfoT mrInfo = {};
418 2 : mrInfo.addr = reinterpret_cast<void *>(static_cast<uintptr_t>(memInfo->addr));
419 2 : mrInfo.size = memInfo->size;
420 2 : mrInfo.access = RA_ACCESS_REMOTE_WRITE | RA_ACCESS_LOCAL_WRITE | RA_ACCESS_REMOTE_READ;
421 2 : CHK_RET(TypicalMrManager::GetInstance().RegisterMem(mrInfo));
422 1 : memInfo->lkey = mrInfo.lkey;
423 1 : memInfo->rkey = mrInfo.rkey;
424 1 : HCCL_RUN_INFO("[hcclRdmaMemRegister] Register MR addr[%p], size[%llu], lkey[%u], rkey[%u].",
425 : mrInfo.addr, mrInfo.size, mrInfo.lkey, mrInfo.rkey);
426 1 : return HCCL_SUCCESS;
427 : }
428 :
429 3 : HcclResult hcclRdmaMemDeRegister(AscendMrAttr* memInfo)
430 : {
431 3 : s32 deviceLogicId = 0;
432 3 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
433 3 : CHK_PTR_NULL(memInfo);
434 2 : MrInfoT mrInfo = {};
435 2 : mrInfo.addr = reinterpret_cast<void *>(static_cast<uintptr_t>(memInfo->addr));
436 2 : mrInfo.size = memInfo->size;
437 2 : mrInfo.access = RA_ACCESS_REMOTE_WRITE | RA_ACCESS_LOCAL_WRITE | RA_ACCESS_REMOTE_READ;
438 2 : mrInfo.lkey = memInfo->lkey;
439 2 : CHK_RET(TypicalMrManager::GetInstance().DeRegisterMem(mrInfo));
440 1 : HCCL_RUN_INFO("[hcclRdmaMemDeRegister] DeRegister MR addr[%p], size[%llu], lkey[%u].",
441 : mrInfo.addr, mrInfo.size, mrInfo.lkey);
442 1 : return HCCL_SUCCESS;
443 : }
444 :
445 8 : HcclResult hcclAscendPostSend(AscendVerbsQPInfo* qpInfo, struct AscendSendWr *sendWr, aclrtStream stream, struct AscendSendWr **badWr)
446 : {
447 8 : s32 deviceLogicId = 0;
448 8 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
449 8 : CHK_PTR_NULL(qpInfo);
450 7 : CHK_PTR_NULL(sendWr);
451 6 : CHK_PTR_NULL(badWr);
452 5 : CHK_PTR_NULL(stream);
453 :
454 : QpHandle qpHandle;
455 4 : CHK_RET(TypicalQpManager::GetInstance().GetVerbsQpHandleByQpn(qpInfo->qpn, qpHandle));
456 :
457 4 : constexpr u32 MAX_SGLIST_VERBS = 16;
458 4 : struct AscendSendWr *curWr = sendWr;
459 8 : while (curWr != nullptr) {
460 7 : CHK_PRT_RET(static_cast<u32>(curWr->numSge) > MAX_SGLIST_VERBS,
461 : HCCL_ERROR("[hcclAscendPostSend] numSge[%d] exceeds MAX_SGLIST_VERBS[%u]", curWr->numSge, MAX_SGLIST_VERBS),
462 : HCCL_E_PARA);
463 5 : CHK_PTR_NULL(curWr->sgList);
464 :
465 : struct SgList sgeList[MAX_SGLIST_VERBS];
466 8 : for (int i = 0; i < curWr->numSge; i++) {
467 4 : sgeList[i].addr = curWr->sgList[i].addr;
468 4 : sgeList[i].len = curWr->sgList[i].len;
469 4 : sgeList[i].lkey = curWr->sgList[i].lkey;
470 : }
471 :
472 4 : struct SendWrVerbs wr = {};
473 4 : struct SendWrRsp opRsp = {};
474 4 : wr.wrId = curWr->wrId;
475 4 : wr.sgList = sgeList;
476 4 : wr.numSge = curWr->numSge;
477 4 : wr.remoteAddr = curWr->wr.rdma.remoteAddr;
478 4 : wr.rkey = curWr->wr.rdma.rkey;
479 4 : wr.opcode = static_cast<uint32_t>(curWr->opcode);
480 4 : wr.sendFlags = static_cast<int>(curWr->sendFlags);
481 4 : wr.immData = curWr->immData;
482 :
483 4 : CHK_RET(HrtRaSendWrVerbs(qpHandle, &wr, &opRsp));
484 :
485 4 : if (curWr->next == nullptr) {
486 2 : CHK_RET(hrtRDMADBSend(opRsp.db.dbIndex, opRsp.db.dbInfo, stream));
487 : }
488 :
489 4 : curWr = curWr->next;
490 : }
491 :
492 2 : *badWr = nullptr;
493 2 : return HCCL_SUCCESS;
494 : }
495 :
496 8 : HcclResult hcclAscendPostRecv(AscendVerbsQPInfo* qpInfo, struct AscendRecvWr *recvWr, aclrtStream stream, struct AscendRecvWr **badWr)
497 : {
498 8 : s32 deviceLogicId = 0;
499 8 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
500 8 : CHK_PTR_NULL(qpInfo);
501 7 : CHK_PTR_NULL(recvWr);
502 6 : CHK_PTR_NULL(badWr);
503 5 : CHK_PTR_NULL(stream);
504 :
505 : QpHandle qpHandle;
506 4 : CHK_RET(TypicalQpManager::GetInstance().GetVerbsQpHandleByQpn(qpInfo->qpn, qpHandle));
507 :
508 4 : constexpr u32 MAX_SGLIST_RECV = 16;
509 4 : struct AscendRecvWr *curWr = recvWr;
510 8 : while (curWr != nullptr) {
511 7 : CHK_PRT_RET(static_cast<u32>(curWr->numSge) > MAX_SGLIST_RECV,
512 : HCCL_ERROR("[hcclAscendPostRecv] numSge[%d] exceeds MAX_SGLIST_RECV[%u]", curWr->numSge, MAX_SGLIST_RECV),
513 : HCCL_E_PARA);
514 5 : CHK_PTR_NULL(curWr->sgList);
515 :
516 : struct SgList sgeList[MAX_SGLIST_RECV];
517 8 : for (int i = 0; i < curWr->numSge; i++) {
518 4 : sgeList[i].addr = curWr->sgList[i].addr;
519 4 : sgeList[i].len = curWr->sgList[i].len;
520 4 : sgeList[i].lkey = curWr->sgList[i].lkey;
521 : }
522 :
523 4 : struct RecvWrVerbs wr = {};
524 4 : wr.wrId = curWr->wrId;
525 4 : wr.sgList = sgeList;
526 4 : wr.numSge = curWr->numSge;
527 :
528 4 : CHK_RET(HrtRaRecvWrVerbs(qpHandle, &wr));
529 :
530 4 : curWr = curWr->next;
531 : }
532 :
533 2 : *badWr = nullptr;
534 2 : return HCCL_SUCCESS;
535 : }
536 :
537 0 : HcclResult HcclSendByAscendQP(void* sendBuf, uint64_t count, HcclDataType dataType,
538 : AscendSendRecvInfo* sendRecvInfo, aclrtStream stream)
539 : {
540 0 : s32 deviceLogicId = 0;
541 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
542 0 : CHK_RET(CheckParam(sendBuf, count, dataType, stream));
543 0 : CHK_RET(CheckSendRecvInfo(sendRecvInfo));
544 : QpHandle qpHandle;
545 0 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvInfo->localQPinfo->qpn, qpHandle));
546 0 : SendRecvExecutor executor(stream, qpHandle, AscendMrInfo2MrInfo(sendRecvInfo->localWindowMem),
547 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteWindowMem),
548 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemPrepare),
549 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemDone),
550 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemAck),
551 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemPrepare),
552 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemDone),
553 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemAck),
554 0 : sendRecvInfo->immData);
555 0 : CHK_RET(executor.Init());
556 0 : CHK_RET(executor.Send(sendBuf, count, dataType));
557 0 : return HCCL_SUCCESS;
558 0 : }
559 :
560 0 : HcclResult HcclRecvByAscendQP(void* recvBuf, uint64_t count, HcclDataType dataType,
561 : AscendSendRecvInfo* sendRecvInfo, aclrtStream stream)
562 : {
563 0 : s32 deviceLogicId = 0;
564 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
565 0 : CHK_RET(CheckParam(recvBuf, count, dataType, stream));
566 0 : CHK_RET(CheckSendRecvInfo(sendRecvInfo));
567 : QpHandle qpHandle;
568 0 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvInfo->localQPinfo->qpn, qpHandle));
569 0 : SendRecvExecutor executor(stream, qpHandle, AscendMrInfo2MrInfo(sendRecvInfo->localWindowMem),
570 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteWindowMem),
571 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemPrepare),
572 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemDone),
573 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemAck),
574 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemPrepare),
575 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemDone),
576 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemAck),
577 0 : sendRecvInfo->immData);
578 0 : CHK_RET(executor.Init());
579 0 : CHK_RET(executor.Receive(recvBuf, count, dataType));
580 0 : return HCCL_SUCCESS;
581 0 : }
582 :
583 :
584 32 : HcclResult hcclAscendRdmaInit()
585 : {
586 32 : s32 deviceLogicId = 0;
587 32 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
588 32 : CHK_RET(RdmaResourceManager::GetInstance().Init());
589 32 : return HCCL_SUCCESS;
590 : }
591 3 : HcclResult hcclAscendRdmaInitV2()
592 : {
593 3 : s32 deviceLogicId = 0;
594 3 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
595 2 : RdmaResourceManager::GetInstance().SetDisableLiteThread(true);
596 2 : CHK_RET(RdmaResourceManager::GetInstance().Init());
597 1 : return HCCL_SUCCESS;
598 : }
599 32 : HcclResult hcclAscendRdmaDeInit()
600 : {
601 32 : s32 deviceLogicId = 0;
602 32 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
603 32 : CHK_RET(RdmaResourceManager::GetInstance().DeInit());
604 32 : return HCCL_SUCCESS;
605 : }
606 :
607 0 : HcclResult HcclGetCqeErrInfoList(struct HcclErrCqeInfo *infoList, uint32_t *num)
608 : {
609 0 : s32 deviceLogicId = 0;
610 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
611 0 : CHK_PTR_NULL(infoList);
612 0 : CHK_PTR_NULL(num);
613 0 : u32 arrLen = *num;
614 0 : struct CqeErrInfo errCqeList[arrLen];
615 0 : CHK_RET(RdmaResourceManager::GetInstance().GetCqeErrInfo(errCqeList, num));
616 :
617 0 : CHK_PRT_RET(*num > arrLen, HCCL_ERROR("[HcclGetCqeErrInfoList] GetCqeErrInfo num[%u] is larger than "
618 : "infoList user given[%u].", num, arrLen), HCCL_E_INTERNAL);
619 0 : for (u32 i = 0; i < *num; i++) {
620 0 : infoList[i].status = errCqeList[i].status;
621 0 : infoList[i].qpn = errCqeList[i].qpn;
622 0 : infoList[i].time = errCqeList[i].time;
623 0 : time_t tmpt = static_cast<time_t>(errCqeList[i].time.tv_sec);
624 : struct tm errTime;
625 0 : localtime_r(&tmpt, &errTime);
626 0 : HCCL_INFO("[HcclGetCqeErrInfoList] Err Cqe status[%d], qpn[%d], time[%04u-%02d-%02d %02d:%0d:%02d.%06u]",
627 : errCqeList[i].status, errCqeList[i].qpn, errTime.tm_year + TIME_FROM_1900,
628 : errTime.tm_mon + 1,
629 : errTime.tm_mday,
630 : errTime.tm_hour,
631 : errTime.tm_min,
632 : errTime.tm_sec,
633 : static_cast<u32>(errCqeList[i].time.tv_usec));
634 : }
635 0 : return HCCL_SUCCESS;
636 0 : }
637 :
638 0 : HcclResult HcclGetCqeErrInfoListByQpn(uint32_t qpn, struct HcclErrCqeInfo *infoList, uint32_t *num)
639 : {
640 0 : s32 deviceLogicId = 0;
641 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
642 0 : CHK_PTR_NULL(infoList);
643 0 : CHK_PTR_NULL(num);
644 0 : CHK_RET(RdmaResourceManager::GetInstance().GetCqeErrInfoByQpn(qpn, infoList, num));
645 0 : return HCCL_SUCCESS;
646 : }
647 :
648 0 : HcclResult HcclPutByAscendQP(void* putBuf, uint64_t count, HcclDataType dataType,
649 : AscendSendRecvInfo* sendRecvInfo, aclrtStream stream)
650 : {
651 0 : CHK_PTR_NULL(stream);
652 0 : s32 deviceLogicId = 0;
653 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
654 0 : CHK_RET(CheckParam(putBuf, count, dataType, stream));
655 : QpHandle qpHandle;
656 0 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvInfo->localQPinfo->qpn, qpHandle));
657 0 : SendRecvExecutor executor(stream, qpHandle, AscendMrInfo2MrInfo(sendRecvInfo->localWindowMem),
658 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteWindowMem),
659 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemPrepare),
660 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemDone),
661 0 : AscendMrInfo2MrInfo(sendRecvInfo->localSyncMemAck),
662 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemPrepare),
663 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemDone),
664 0 : AscendMrInfo2MrInfo(sendRecvInfo->remoteSyncMemAck),
665 0 : sendRecvInfo->immData);
666 0 : CHK_RET(executor.Init());
667 0 : CHK_RET(executor.Put(putBuf, count, dataType));
668 0 : return HCCL_SUCCESS;
669 0 : }
670 :
671 19 : HcclResult HcclBatchPutMRByAscendQP(unsigned int num, AscendMrInfo* putMRList, AscendMrInfo* remoteMRList,
672 : AscendSendRecvLinkInfo* sendRecvLinkInfo, aclrtStream stream)
673 : {
674 19 : s32 deviceLogicId = 0;
675 19 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
676 19 : CHK_PRT_RET(num == 0, HCCL_INFO("[HcclBatchPutMRByAscendQP] mr list len is 0. No need to send data."), HCCL_SUCCESS);
677 19 : CHK_PTR_NULL(putMRList);
678 19 : CHK_PTR_NULL(remoteMRList);
679 19 : CHK_PTR_NULL(sendRecvLinkInfo);
680 19 : CHK_PTR_NULL(stream);
681 19 : CHK_RET(CheckSendRecvLinkInfo(sendRecvLinkInfo));
682 19 : CHK_PRT_RET(sendRecvLinkInfo->wqePerDoorbell == 0 || sendRecvLinkInfo->wqePerDoorbell > MAX_WQE_PER_DOORBELL,
683 : HCCL_ERROR("[HcclBatchPutMRByAscendQP] The value of wqePerDoorbell is exceed 300 or equal to 0."),
684 : HCCL_E_PARA);
685 : QpHandle qpHandle;
686 19 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvLinkInfo->localQPinfo->qpn, qpHandle));
687 :
688 19 : SendRecvExecutor executor(stream, qpHandle, sendRecvLinkInfo);
689 19 : CHK_RET(executor.Init());
690 19 : CHK_RET(executor.BatchPutMR(num, putMRList, remoteMRList));
691 :
692 19 : return HCCL_SUCCESS;
693 19 : }
694 :
695 :
696 19 : HcclResult HcclWaitPutMRByAscendQP(AscendSendRecvLinkInfo* sendRecvLinkInfo, aclrtStream stream)
697 : {
698 19 : s32 deviceLogicId = 0;
699 19 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
700 19 : CHK_PTR_NULL(sendRecvLinkInfo);
701 19 : CHK_PTR_NULL(stream);
702 19 : CHK_PTR_NULL(sendRecvLinkInfo->remoteSyncMemAck);
703 19 : CHK_PTR_NULL(sendRecvLinkInfo->localSyncMemDone);
704 : QpHandle qpHandle;
705 19 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvLinkInfo->localQPinfo->qpn, qpHandle));
706 :
707 19 : SendRecvExecutor executor(stream, qpHandle, sendRecvLinkInfo->localSyncMemDone, sendRecvLinkInfo->remoteSyncMemAck);
708 19 : CHK_RET(executor.WaitPutInit());
709 19 : CHK_RET(executor.WaitPutMR());
710 19 : return HCCL_SUCCESS;
711 19 : }
712 :
713 0 : HcclResult HcclWaitPutMRDoWait(AscendSendRecvLinkInfo* sendRecvLinkInfo, aclrtStream stream)
714 : {
715 0 : s32 deviceLogicId = 0;
716 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
717 0 : CHK_PTR_NULL(sendRecvLinkInfo);
718 0 : CHK_PTR_NULL(stream);
719 0 : CHK_PTR_NULL(sendRecvLinkInfo->remoteSyncMemAck);
720 0 : CHK_PTR_NULL(sendRecvLinkInfo->localSyncMemDone);
721 : QpHandle qpHandle;
722 0 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvLinkInfo->localQPinfo->qpn, qpHandle));
723 :
724 0 : SendRecvExecutor executor(stream, qpHandle, sendRecvLinkInfo->localSyncMemDone, sendRecvLinkInfo->remoteSyncMemAck);
725 0 : CHK_RET(executor.WaitPutInit());
726 0 : CHK_RET(executor.WaitPutMROnlyWait());
727 0 : return HCCL_SUCCESS;
728 0 : }
729 :
730 0 : HcclResult HcclWaitPutMRDoRecord(AscendSendRecvLinkInfo* sendRecvLinkInfo, aclrtStream stream)
731 : {
732 0 : s32 deviceLogicId = 0;
733 0 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
734 0 : CHK_PTR_NULL(sendRecvLinkInfo);
735 0 : CHK_PTR_NULL(stream);
736 0 : CHK_PTR_NULL(sendRecvLinkInfo->remoteSyncMemAck);
737 0 : CHK_PTR_NULL(sendRecvLinkInfo->localSyncMemDone);
738 : QpHandle qpHandle;
739 0 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendRecvLinkInfo->localQPinfo->qpn, qpHandle));
740 :
741 0 : SendRecvExecutor executor(stream, qpHandle, sendRecvLinkInfo->localSyncMemDone, sendRecvLinkInfo->remoteSyncMemAck);
742 0 : CHK_RET(executor.WaitPutInit());
743 0 : CHK_RET(executor.WaitPutMROnlyRecord());
744 0 : return HCCL_SUCCESS;
745 0 : }
746 :
747 90 : HcclResult hcclGetSyncMemRegKey(AscendMrInfo* memInfo)
748 : {
749 90 : s32 deviceLogicId = 0;
750 90 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
751 90 : CHK_PTR_NULL(memInfo);
752 90 : struct MrInfoT mrInfo{};
753 90 : CHK_RET(RdmaResourceManager::GetInstance().GetNotifyMrInfo(mrInfo));
754 90 : memInfo->key = mrInfo.lkey;
755 90 : HCCL_RUN_INFO("[hcclGetSyncMemRegKey] SyncMem addr[%p], size[%llu], key[%u].", memInfo->addr, memInfo->size, memInfo->key);
756 90 : return HCCL_SUCCESS;
757 : }
758 :
759 11 : HcclResult HcclOneSideBatchPutByAscendQP(unsigned int num, AscendMrInfo* putMRList, AscendMrInfo* remoteMRList,
760 : AscendSendLinkInfo* sendlinkInfo, aclrtStream stream)
761 : {
762 11 : s32 deviceLogicId = 0;
763 11 : CHK_RET(hrtGetDeviceRefresh(&deviceLogicId));
764 11 : CHK_PRT_RET(num == 0, HCCL_INFO("[HcclOneSideBatchPutByAscendQP] mr list len is 0. No need to send data."), HCCL_SUCCESS);
765 11 : CHK_PTR_NULL(putMRList);
766 11 : CHK_PTR_NULL(remoteMRList);
767 11 : CHK_PTR_NULL(sendlinkInfo);
768 11 : CHK_PTR_NULL(stream);
769 11 : CHK_RET(CheckSendLinkInfo(sendlinkInfo));
770 10 : CHK_PRT_RET(sendlinkInfo->wqePerDoorbell == 0 || sendlinkInfo->wqePerDoorbell > MAX_WQE_PER_DOORBELL,
771 : HCCL_ERROR("[HcclOneSideBatchPutByAscendQP] The value of wqePerDoorbell is exceed 300 or equal to 0."),
772 : HCCL_E_PARA);
773 : QpHandle qpHandle;
774 10 : CHK_RET(TypicalQpManager::GetInstance().GetQpHandleByQpn(sendlinkInfo->localQPinfo->qpn, qpHandle));
775 :
776 10 : SendRecvExecutor executor(stream, qpHandle, sendlinkInfo);
777 10 : CHK_RET(executor.OneSideBatchPutMR(num, putMRList, remoteMRList));
778 :
779 10 : return HCCL_SUCCESS;
780 10 : }
|