Skip to content

Commit 0817939

Browse files
committed
PR fixes
Signed-off-by: Michal Shalev <mshalev@nvidia.com>
1 parent 2e7e14e commit 0817939

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/api/gpu/ucx/nixl_device.cuh

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,15 @@ struct nixlGpuXferReqParams {
6363
*/
6464
__device__ inline nixl_status_t
6565
nixlGpuConvertUcsStatus(ucs_status_t status) {
66-
if (status == UCS_INPROGRESS) {
66+
switch (status) {
67+
case UCS_OK:
68+
return NIXL_SUCCESS;
69+
case UCS_INPROGRESS:
6770
return NIXL_IN_PROG;
71+
default:
72+
printf("UCX returned error: %d\n", status);
73+
return NIXL_ERR_BACKEND;
6874
}
69-
printf("UCX returned error: %d\n", status);
70-
return NIXL_ERR_BACKEND;
7175
}
7276

7377
/**
@@ -80,9 +84,11 @@ nixlGpuConvertUcsStatus(ucs_status_t status) {
8084
* @param size [in] Size in bytes of the memory to be transferred.
8185
* @param channel_id [in] Channel ID to use for the transfer.
8286
* @param is_no_delay [in] Whether to use no-delay mode.
83-
* @param xfer_status [out] Status of the transfer. If not null, use @ref
84-
* nixlGpuGetXferStatus to check for completion.
87+
* @param xfer_status [out] Status of the transfer. If not null and the operation
88+
* returns NIXL_IN_PROG, use @ref nixlGpuGetXferStatus
89+
* to check for completion.
8590
*
91+
* @return NIXL_SUCCESS Operation completed successfully.
8692
* @return NIXL_IN_PROG Operation successfully posted.
8793
* @return NIXL_ERR_BACKEND An error occurred in UCX backend.
8894
*/
@@ -113,9 +119,11 @@ nixlGpuPostSingleWriteXferReq(nixlGpuXferReqH req_hndl,
113119
* @param signal_offset [in] Offset of the signal to be sent.
114120
* @param channel_id [in] Channel ID to use for the transfer.
115121
* @param is_no_delay [in] Whether to use no-delay mode.
116-
* @param xfer_status [out] Status of the transfer. If not null, use @ref
117-
* nixlGpuGetXferStatus to check for completion.
122+
* @param xfer_status [out] Status of the transfer. If not null and the operation
123+
* returns NIXL_IN_PROG, use @ref nixlGpuGetXferStatus
124+
* to check for completion.
118125
*
126+
* @return NIXL_SUCCESS Operation completed successfully.
119127
* @return NIXL_IN_PROG Operation successfully posted.
120128
* @return NIXL_ERR_BACKEND An error occurred in UCX backend.
121129
*/
@@ -151,9 +159,11 @@ nixlGpuPostSignalXferReq(nixlGpuXferReqH req_hndl,
151159
* @param signal_offset [in] Offset of the signal to be sent.
152160
* @param channel_id [in] Channel ID to use for the transfer.
153161
* @param is_no_delay [in] Whether to use no-delay mode.
154-
* @param xfer_status [out] Status of the transfer. If not null, use @ref
155-
* nixlGpuGetXferStatus to check for completion.
162+
* @param xfer_status [out] Status of the transfer. If not null and the operation
163+
* returns NIXL_IN_PROG, use @ref nixlGpuGetXferStatus
164+
* to check for completion.
156165
*
166+
* @return NIXL_SUCCESS Operation completed successfully.
157167
* @return NIXL_IN_PROG Operation successfully posted.
158168
* @return NIXL_ERR_BACKEND An error occurred in UCX backend.
159169
*/
@@ -198,9 +208,11 @@ nixlGpuPostPartialWriteXferReq(nixlGpuXferReqH req_hndl,
198208
* @param signal_offset [in] Offset of the signal to be sent.
199209
* @param channel_id [in] Channel ID to use for the transfer.
200210
* @param is_no_delay [in] Whether to use no-delay mode.
201-
* @param xfer_status [out] Status of the transfer. If not null, use @ref
202-
* nixlGpuGetXferStatus to check for completion.
211+
* @param xfer_status [out] Status of the transfer. If not null and the operation
212+
* returns NIXL_IN_PROG, use @ref nixlGpuGetXferStatus
213+
* to check for completion.
203214
*
215+
* @return NIXL_SUCCESS Operation completed successfully.
204216
* @return NIXL_IN_PROG Operation successfully posted.
205217
* @return NIXL_ERR_BACKEND An error occurred in UCX backend.
206218
*/
@@ -240,15 +252,7 @@ nixlGpuGetXferStatus(nixlGpuXferStatusH &xfer_status) {
240252
const auto status = ucp_device_progress_req<static_cast<ucs_device_level_t>(level)>(
241253
&xfer_status.device_request);
242254

243-
switch (status) {
244-
case UCS_OK:
245-
return NIXL_SUCCESS;
246-
case UCS_INPROGRESS:
247-
return NIXL_IN_PROG;
248-
default:
249-
printf("UCX returned error: %d\n", status);
250-
return NIXL_ERR_BACKEND;
251-
}
255+
return nixlGpuConvertUcsStatus(status);
252256
}
253257

254258
/**

0 commit comments

Comments
 (0)