Skip to content

Commit

Permalink
fix(tree): add fallthrough switch markers (aws#585)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Sielicki <[email protected]>
  • Loading branch information
aws-nslick committed Sep 27, 2024
1 parent e3e053b commit 4cbe6c5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/nccl_ofi_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -4531,10 +4531,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 @@ -4609,6 +4611,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 @@ -4622,6 +4625,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 @@ -4655,6 +4659,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 @@ -6201,6 +6206,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 @@ -6216,6 +6222,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 @@ -6247,13 +6254,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 @@ -1410,6 +1410,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 @@ -1437,6 +1438,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 @@ -1470,8 +1472,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 @@ -2047,6 +2052,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 @@ -2063,6 +2069,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 @@ -2095,8 +2102,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 4cbe6c5

Please sign in to comment.