Skip to content

Commit

Permalink
Don't queue zero-length request into pending
Browse files Browse the repository at this point in the history
  • Loading branch information
tvegas1 committed May 24, 2024
1 parent 5754087 commit 9fb6ced
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/ucx_uct_rd_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,25 @@ static void nccl_uct_rd_send_ats(nccl_uct_rd_req_t *req) {
static void nccl_uct_rd_pending_add(nccl_uct_rd_comm_t *comm,
nccl_uct_mem_t *src, nccl_uct_mem_t *dst) {
nccl_uct_rd_req_t *req = dst->req;
unsigned i = comm->pending.last++;
nccl_uct_get_param_t *param;

param = &comm->pending.param[i & NCCL_UCT_PENDING_MASK];

assert(src->size <= dst->size);
assert((comm->pending.first & NCCL_UCT_PENDING_MASK) !=
(comm->pending.last & NCCL_UCT_PENDING_MASK));
assert(req->rts_count < NCCL_UCX_UCT_MAX_RECVS);

req->sizes[dst->index] = src->size;
req->remote_req[req->rts_count++] = src->req; /* src->req is a cookie */

if (src->size == 0) {
req->completion.count--;
return;
}

param = &comm->pending.param[comm->pending.last & NCCL_UCT_PENDING_MASK];
comm->pending.last++;

assert((comm->pending.first & NCCL_UCT_PENDING_MASK) !=
(comm->pending.last & NCCL_UCT_PENDING_MASK));

param->iov.buffer = dst->data;
param->iov.length = src->size;
param->iov.memh = dst->u.uct_memh->memh;
Expand All @@ -116,24 +122,19 @@ static void nccl_uct_rd_pending_add(nccl_uct_rd_comm_t *comm,
param->req = req;
}

static inline void nccl_uct_rd_pending_drain(nccl_uct_rd_comm_t *comm) {
static void nccl_uct_rd_pending_drain(nccl_uct_rd_comm_t *comm) {
ucs_status_t status;
nccl_uct_get_param_t *param;

for (; comm->pending.first != comm->pending.last; comm->pending.first++) {
param = &comm->pending.param[comm->pending.first & NCCL_UCT_PENDING_MASK];

if (param->iov.length == 0) {
status = uct_ep_get_zcopy(comm->base.uct_ep->ep, &param->iov, 1, param->rva,
param->rkey, &param->req->completion);
if (status == UCS_OK) {
param->req->completion.count--;
} else {
status = uct_ep_get_zcopy(comm->base.uct_ep->ep, &param->iov, 1,
param->rva, param->rkey,
&param->req->completion);
if (status == UCS_OK) {
param->req->completion.count--;
} else if (status != UCS_INPROGRESS) {
break;
}
} else if (status != UCS_INPROGRESS) {
break;
}

if (param->req->completion.count == 1) {
Expand Down

0 comments on commit 9fb6ced

Please sign in to comment.