Skip to content

Commit

Permalink
fix(tree): add fallthrough switch markers (#585)
Browse files Browse the repository at this point in the history
* fix(tree): add fallthrough switch markers

Signed-off-by: Nicholas Sielicki <[email protected]>
  • Loading branch information
aws-nslick authored Sep 27, 2024
1 parent a06ae92 commit ff446b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/nccl_ofi_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ static inline int handle_bounce_recv(nccl_net_ofi_rdma_device_t *device, int rai
* header type. So cast to a control message and lookup the
* type from there. */
nccl_ofi_rdma_msg_type_t msg_type =
eager ? NCCL_OFI_RDMA_MSG_EAGER : ((nccl_net_ofi_rdma_ctrl_msg_t *)&bounce_fl_item->bounce_msg)->type;
eager ? (nccl_ofi_rdma_msg_type_t)NCCL_OFI_RDMA_MSG_EAGER : ((nccl_net_ofi_rdma_ctrl_msg_t *)&bounce_fl_item->bounce_msg)->type;

switch (msg_type) {
case NCCL_OFI_RDMA_MSG_CONN:
Expand Down Expand Up @@ -4546,10 +4546,12 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,

l_comm->stage = COMM_RECV_CONN;

/* fall through */
case COMM_RECV_CONN:

l_comm->stage = COMM_CONN_REQ_PENDING;

/* fall through */
case COMM_CONN_REQ_PENDING:
/* COMM_CONN_REQ_PENDING: Wait until connect message has been
* received. Then, prepare for sending connect accept message,
Expand Down Expand Up @@ -4624,6 +4626,7 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,

l_comm->stage = COMM_SEND_CONN;

/* fall through */
case COMM_SEND_CONN:

/* COMM_SEND_CONN: Send connect response message to remote */
Expand All @@ -4637,6 +4640,7 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,

l_comm->stage = COMM_CONN_RESP_REQ_PENDING;

/* fall through */
case COMM_CONN_RESP_REQ_PENDING:
/* COMM_CONN_RESP_REQ_PENDING: Wait until connect
* response message has been delivered. Afterwards,
Expand Down Expand Up @@ -4670,6 +4674,7 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,
break;

case COMM_CONNECTED:
/* fall through */
default:
NCCL_OFI_WARN("Invalid state of receive communicator object: %d",
l_comm->stage);
Expand Down Expand Up @@ -6219,6 +6224,7 @@ static int connect(nccl_net_ofi_ep_t *base_ep,
}

comm_state->stage = COMM_SEND_CONN;
/* fall through */

case COMM_SEND_CONN:

Expand All @@ -6234,6 +6240,7 @@ static int connect(nccl_net_ofi_ep_t *base_ep,
}

comm_state->stage = COMM_CONN_REQ_PENDING;
/* fall through */

case COMM_CONN_REQ_PENDING:
/* COMM_CONN_REQ_PENDING: Wait until connect message
Expand Down Expand Up @@ -6265,13 +6272,15 @@ static int connect(nccl_net_ofi_ep_t *base_ep,
req = NULL;

comm_state->stage = COMM_RECV_CONN;
/* fall through */

case COMM_RECV_CONN:
/* COMM_RECV_CONN: Receive connect response message from remote */

assert(s_comm && s_comm->num_rails > 0);

comm_state->stage = COMM_CONN_RESP_REQ_PENDING;
/* fall through */

case COMM_CONN_RESP_REQ_PENDING:

Expand Down
10 changes: 10 additions & 0 deletions src/nccl_ofi_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,7 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,
}

comm_state->stage = COMM_RECV_CONN;
/* fall through */

case COMM_RECV_CONN:

Expand Down Expand Up @@ -1452,6 +1453,7 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,

comm_state->stage = COMM_CONN_REQ_PENDING;

/* fall through */
case COMM_CONN_REQ_PENDING:

/* Progress NCCL OFI engine so that connection is accepted */
Expand Down Expand Up @@ -1485,8 +1487,11 @@ static int accept(nccl_net_ofi_listen_comm_t *listen_comm,
break;

case COMM_SEND_CONN:
/* fall through */
case COMM_CONN_RESP_REQ_PENDING:
/* fall through */
case COMM_CONNECTED:
/* fall through */
default:
NCCL_OFI_WARN("Invalid state of receive communicator object: %d",
stage);
Expand Down Expand Up @@ -2063,6 +2068,7 @@ static int connect(nccl_net_ofi_ep_t *base_ep,

comm_state->stage = COMM_SEND_CONN;

/* fall through */
case COMM_SEND_CONN:
/* Send "connect" message to remote EP */
rc = send_connect_message(s_comm, device, ep, req);
Expand All @@ -2079,6 +2085,7 @@ static int connect(nccl_net_ofi_ep_t *base_ep,
}

comm_state->stage = COMM_CONN_REQ_PENDING;
/* fall through */

case COMM_CONN_REQ_PENDING:
if (s_comm->conn_info->connect_to_self == 1) {
Expand Down Expand Up @@ -2111,8 +2118,11 @@ static int connect(nccl_net_ofi_ep_t *base_ep,
break;

case COMM_RECV_CONN:
/* fall through */
case COMM_CONN_RESP_REQ_PENDING:
/* fall through */
case COMM_CONNECTED:
/* fall through */
default:
NCCL_OFI_WARN("Invalid state of send communicator object: %d", stage);
return -EINVAL;
Expand Down

0 comments on commit ff446b7

Please sign in to comment.