From 6e1ec374709db189a5b8ca73950c876bce37a079 Mon Sep 17 00:00:00 2001 From: snordmann Date: Thu, 9 Jan 2025 16:45:43 +0200 Subject: [PATCH 1/4] TL/MLX5: fix fences in WQEs --- src/components/tl/mlx5/tl_mlx5_wqe.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/tl/mlx5/tl_mlx5_wqe.c b/src/components/tl/mlx5/tl_mlx5_wqe.c index cf4d590658..cee82fd1f8 100644 --- a/src/components/tl/mlx5/tl_mlx5_wqe.c +++ b/src/components/tl/mlx5/tl_mlx5_wqe.c @@ -57,7 +57,7 @@ ucc_status_t ucc_tl_mlx5_post_transpose(struct ibv_qp *qp, uint32_t src_mr_lkey, uint32_t n_ds = 4; struct ibv_qp_ex * qp_ex = ibv_qp_to_qp_ex(qp); struct mlx5dv_qp_ex * mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); - int fm_ce_se = 0; + int fm_ce_se = MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE; char wqe_desc[n_ds * DS_SIZE]; struct mlx5_wqe_ctrl_seg *ctrl; struct mlx5_wqe_data_seg *data; @@ -153,8 +153,7 @@ ucc_status_t ucc_tl_mlx5_post_umr(struct ibv_qp * qp, sizeof(struct mlx5_wqe_mkey_context_seg) + sizeof(struct mlx5_wqe_umr_pointer_seg)) / DS_SIZE; - uint8_t fm_ce_se = - MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE | MLX5_WQE_CTRL_CQ_UPDATE; + uint8_t fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; struct ibv_qp_ex * qp_ex = ibv_qp_to_qp_ex(qp); struct mlx5dv_qp_ex * mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); struct mlx5_wqe_ctrl_seg * ctrl; @@ -275,7 +274,7 @@ ucc_status_t ucc_tl_mlx5_post_wait_on_data(struct ibv_qp *qp, uint64_t value, uint32_t n_ds = 3; //CTRL + Wait on Data of Size 2 struct ibv_qp_ex * qp_ex = ibv_qp_to_qp_ex(qp); struct mlx5dv_qp_ex *mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); - uint8_t fm_ce_se = MLX5_WQE_CTRL_FENCE | MLX5_WQE_CTRL_CQ_UPDATE; + uint8_t fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; char wqe_desc[n_ds * DS_SIZE]; struct mlx5_wqe_ctrl_seg *ctrl; wait_on_data_seg_t * wseg; From a84a08a408a19c38e038f197742c9f27663eba70 Mon Sep 17 00:00:00 2001 From: snordmann Date: Thu, 9 Jan 2025 16:49:04 +0200 Subject: [PATCH 2/4] CODESTYLE: align --- src/components/tl/mlx5/tl_mlx5_wqe.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/tl/mlx5/tl_mlx5_wqe.c b/src/components/tl/mlx5/tl_mlx5_wqe.c index cee82fd1f8..0794b6df22 100644 --- a/src/components/tl/mlx5/tl_mlx5_wqe.c +++ b/src/components/tl/mlx5/tl_mlx5_wqe.c @@ -153,13 +153,14 @@ ucc_status_t ucc_tl_mlx5_post_umr(struct ibv_qp * qp, sizeof(struct mlx5_wqe_mkey_context_seg) + sizeof(struct mlx5_wqe_umr_pointer_seg)) / DS_SIZE; - uint8_t fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; - struct ibv_qp_ex * qp_ex = ibv_qp_to_qp_ex(qp); - struct mlx5dv_qp_ex * mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); - struct mlx5_wqe_ctrl_seg * ctrl; - struct mlx5_wqe_umr_ctrl_seg * umr_ctrl_seg; + uint8_t fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; + struct ibv_qp_ex *qp_ex = ibv_qp_to_qp_ex(qp); + struct mlx5dv_qp_ex *mqp = + mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); + struct mlx5_wqe_ctrl_seg *ctrl; + struct mlx5_wqe_umr_ctrl_seg *umr_ctrl_seg; struct mlx5_wqe_mkey_context_seg *mk_seg; - struct mlx5_wqe_umr_pointer_seg * pseg; + struct mlx5_wqe_umr_pointer_seg *pseg; char wqe_desc[n_ds * DS_SIZE]; int xlat_size; @@ -269,12 +270,12 @@ ucc_status_t ucc_tl_mlx5_post_wait_on_data(struct ibv_qp *qp, uint64_t value, void *task_ptr) { - uint32_t opcode = MLX5_OPCODE_WAIT; - uint32_t opmode = 0x1; //wait on data - uint32_t n_ds = 3; //CTRL + Wait on Data of Size 2 - struct ibv_qp_ex * qp_ex = ibv_qp_to_qp_ex(qp); - struct mlx5dv_qp_ex *mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); - uint8_t fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; + uint32_t opcode = MLX5_OPCODE_WAIT; + uint32_t opmode = 0x1; //wait on data + uint32_t n_ds = 3; //CTRL + Wait on Data of Size 2 + struct ibv_qp_ex *qp_ex = ibv_qp_to_qp_ex(qp); + struct mlx5dv_qp_ex *mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); + uint8_t fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE; char wqe_desc[n_ds * DS_SIZE]; struct mlx5_wqe_ctrl_seg *ctrl; wait_on_data_seg_t * wseg; From c226e9f8c50337685f2ada03775fdb82ccb51789 Mon Sep 17 00:00:00 2001 From: snordmann Date: Fri, 10 Jan 2025 14:40:36 +0200 Subject: [PATCH 3/4] TL/MLX5: further WQE flags revision --- src/components/tl/mlx5/alltoall/alltoall_inline.h | 2 +- src/components/tl/mlx5/tl_mlx5_wqe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tl/mlx5/alltoall/alltoall_inline.h b/src/components/tl/mlx5/alltoall/alltoall_inline.h index 02d82acb35..a1d081685f 100644 --- a/src/components/tl/mlx5/alltoall/alltoall_inline.h +++ b/src/components/tl/mlx5/alltoall/alltoall_inline.h @@ -73,7 +73,7 @@ static inline ucc_status_t send_atomic(ucc_tl_mlx5_alltoall_t *a2a, struct mlx5dv_qp_ex *qp_dv; qp_ex = tl_mlx5_get_qp_ex(a2a, rank); - qp_ex->wr_flags = 0; + qp_ex->wr_flags = IBV_SEND_FENCE; ibv_wr_atomic_fetch_add(qp_ex, rkey, (uintptr_t)remote_addr, 1ULL); if (a2a->is_dc) { qp_dv = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); diff --git a/src/components/tl/mlx5/tl_mlx5_wqe.c b/src/components/tl/mlx5/tl_mlx5_wqe.c index 0794b6df22..d0ece52902 100644 --- a/src/components/tl/mlx5/tl_mlx5_wqe.c +++ b/src/components/tl/mlx5/tl_mlx5_wqe.c @@ -57,7 +57,7 @@ ucc_status_t ucc_tl_mlx5_post_transpose(struct ibv_qp *qp, uint32_t src_mr_lkey, uint32_t n_ds = 4; struct ibv_qp_ex * qp_ex = ibv_qp_to_qp_ex(qp); struct mlx5dv_qp_ex * mqp = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex); - int fm_ce_se = MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE; + int fm_ce_se = 0; char wqe_desc[n_ds * DS_SIZE]; struct mlx5_wqe_ctrl_seg *ctrl; struct mlx5_wqe_data_seg *data; From 7f9f604ba9f515d55f1f80f99f49e645f966e0cb Mon Sep 17 00:00:00 2001 From: snordmann Date: Wed, 15 Jan 2025 13:07:25 +0200 Subject: [PATCH 4/4] TL/MLX5: remove unnecessary fence on atomic WQE --- src/components/tl/mlx5/alltoall/alltoall_inline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/tl/mlx5/alltoall/alltoall_inline.h b/src/components/tl/mlx5/alltoall/alltoall_inline.h index a1d081685f..02d82acb35 100644 --- a/src/components/tl/mlx5/alltoall/alltoall_inline.h +++ b/src/components/tl/mlx5/alltoall/alltoall_inline.h @@ -73,7 +73,7 @@ static inline ucc_status_t send_atomic(ucc_tl_mlx5_alltoall_t *a2a, struct mlx5dv_qp_ex *qp_dv; qp_ex = tl_mlx5_get_qp_ex(a2a, rank); - qp_ex->wr_flags = IBV_SEND_FENCE; + qp_ex->wr_flags = 0; ibv_wr_atomic_fetch_add(qp_ex, rkey, (uintptr_t)remote_addr, 1ULL); if (a2a->is_dc) { qp_dv = mlx5dv_qp_ex_from_ibv_qp_ex(qp_ex);