Repository navigation
UCT/IB/MLX5/RC: Implement get_sgl_zcopy #11763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fcb6b31
UCT/IB/MLX5/RC: Implement get_sgl_zcopy
michal-shalev eaec28f
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev 757166d
UCT/IB/MLX5: Append GET SGL zcopy ext ops at end of ops struct
michal-shalev 3646f89
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev 4d5ae2a
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev 92955a6
UCT/IB/MLX5/RC: Deduplicate put/get SGL zcopy WQE post path
michal-shalev 134b4d6
UCT/IB/MLX5/RC: Mark SGL zcopy total unused when stats are disabled
michal-shalev b6274b4
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev 46dbc61
UCT/IB/RC: Fix GET SGL zcopy completion under Valgrind
michal-shalev b11793e
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev 74725df
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev cff41ff
UCT/IB/RC: Rename send op iovec allocation helper
michal-shalev f9abeec
UCT/IB/MLX5/RC: Split SGL zcopy stride check from count check
michal-shalev 52669a6
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev a1b2237
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev 15c927f
UCT/IB/MLX5/RC: Add get SGL zcopy completion handler
michal-shalev 85cd978
UCT/IB/MLX5/RC: Do not handle get SGL in FT purge until supported
michal-shalev 82e924d
Merge branch 'master' into uct-mlx5-rc-sgl-get
michal-shalev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ | |
|
|
||
|
|
||
| static UCS_F_ALWAYS_INLINE size_t | ||
| uct_rc_mlx5_base_put_sgl_zcopy_max_count(uct_rc_mlx5_iface_common_t *iface) | ||
| uct_rc_mlx5_base_sgl_zcopy_max_count(uct_rc_mlx5_iface_common_t *iface) | ||
| { | ||
| size_t max_count; | ||
|
|
||
|
|
@@ -37,6 +37,29 @@ uct_rc_mlx5_base_put_sgl_zcopy_max_count(uct_rc_mlx5_iface_common_t *iface) | |
| return max_count; | ||
| } | ||
|
|
||
| static UCS_F_ALWAYS_INLINE ucs_status_t | ||
| uct_rc_mlx5_base_ep_sgl_zcopy_check(uct_rc_mlx5_iface_common_t *iface, | ||
| uct_rc_mlx5_base_ep_t *ep, | ||
| const size_t *lengths, size_t count, | ||
| size_t min_length, size_t max_length, | ||
| const char *name) | ||
| { | ||
| size_t i; | ||
|
|
||
| ucs_assert(ep->super.flags & UCT_RC_EP_FLAG_CONNECTED); | ||
| ucs_assert(count > 0); | ||
|
|
||
| for (i = 0; i < count; i++) { | ||
| UCT_CHECK_LENGTH(lengths[i], min_length, max_length, name); | ||
| } | ||
|
|
||
| UCT_RC_CHECK_CQE_VALUE_RET(&iface->super, &ep->super, UCS_ERR_NO_RESOURCE, | ||
| count - 1); | ||
| UCT_RC_CHECK_NUM_RDMA_READ_RET(&iface->super, UCS_ERR_NO_RESOURCE); | ||
| UCT_RC_CHECK_TXQP_VALUE_RET(&iface->super, &ep->super, UCS_ERR_NO_RESOURCE, | ||
| count - 1); | ||
| return UCS_OK; | ||
| } | ||
|
|
||
| static UCS_F_ALWAYS_INLINE void | ||
| uct_rc_mlx5_ep_fence_put(uct_rc_mlx5_iface_common_t *iface, uct_ib_mlx5_txwq_t *txwq, | ||
|
|
@@ -481,6 +504,110 @@ uct_rc_mlx5_txwq_update_psn(uct_ib_mlx5_txwq_t *txwq, int qp_type, | |
| } | ||
| } | ||
|
|
||
| static UCS_F_ALWAYS_INLINE size_t | ||
| uct_rc_mlx5_base_ep_sgl_zcopy_post(uct_rc_mlx5_base_ep_t *ep, | ||
| void * const *buffers, const size_t *lengths, | ||
| uct_mem_h const *memhs, | ||
| const uint64_t *remote_addrs, | ||
| uct_rkey_t const *rkeys, size_t count, | ||
| uint8_t opcode, uint8_t fence_flag, | ||
| int resolve_atomic_rkey, | ||
| uct_rc_send_handler_t handler, | ||
| uint16_t op_flags, int comp_always, | ||
| uct_completion_t *comp) | ||
| { | ||
| uct_ib_mlx5_txwq_t *txwq = &ep->tx.wq; | ||
| size_t total = 0; | ||
| struct mlx5_wqe_ctrl_seg *ctrl = NULL; | ||
| uint32_t num_packets = 0; | ||
| const size_t non_data_wqe_size = sizeof(struct mlx5_wqe_ctrl_seg) + | ||
| sizeof(struct mlx5_wqe_raddr_seg); | ||
| const size_t data_wqe_size = non_data_wqe_size + | ||
| sizeof(struct mlx5_wqe_data_seg); | ||
| uct_rc_mlx5_iface_common_t *iface; | ||
| struct mlx5_wqe_raddr_seg *raddr; | ||
| struct mlx5_wqe_data_seg *dptr; | ||
| size_t wqe_size, i; | ||
| uint8_t fm_ce_se; | ||
| uint16_t pi, res_count; | ||
| uint64_t addr; | ||
| uct_rkey_t rkey; | ||
| void *curr; | ||
|
|
||
| ucs_assert(count > 0); | ||
|
|
||
| pi = txwq->sw_pi; | ||
|
|
||
| ucs_assert(!(txwq->flags & UCT_IB_MLX5_TXWQ_FLAG_FAILED)); | ||
| ucs_assert(ucs_div_round_up(data_wqe_size, MLX5_SEND_WQE_BB) == 1); | ||
|
|
||
| curr = txwq->curr; | ||
|
|
||
| for (i = 0; i < count; i++) { | ||
| fm_ce_se = ((i == 0) ? fence_flag : 0) | | ||
| ((i == count - 1) ? MLX5_WQE_CTRL_CQ_UPDATE : 0); | ||
| ctrl = curr; | ||
|
|
||
| addr = remote_addrs[i]; | ||
| if (resolve_atomic_rkey) { | ||
| rkey = uct_ib_resolve_atomic_rkey(rkeys[i], | ||
| ep->super.atomic_mr_offset, | ||
| &addr); | ||
| } else { | ||
| rkey = uct_ib_md_direct_rkey(rkeys[i]); | ||
| } | ||
|
|
||
| raddr = uct_ib_mlx5_txwq_wrap_none(txwq, ctrl + 1); | ||
| uct_ib_mlx5_ep_set_rdma_seg(raddr, addr, rkey); | ||
|
|
||
| if (ucs_unlikely(lengths[i] == 0)) { | ||
| wqe_size = non_data_wqe_size; | ||
| num_packets += 1; | ||
| } else { | ||
| dptr = uct_ib_mlx5_txwq_wrap_none(txwq, raddr + 1); | ||
| uct_ib_mlx5_set_data_seg(dptr, buffers[i], lengths[i], | ||
| uct_ib_memh_get_lkey(memhs[i])); | ||
| wqe_size = data_wqe_size; | ||
| num_packets += uct_rc_mlx5_num_packets(txwq, lengths[i]); | ||
| } | ||
|
|
||
| uct_ib_mlx5_set_ctrl_seg(ctrl, pi, opcode, 0, txwq->super.qp_num, | ||
| fm_ce_se, 0, wqe_size); | ||
|
|
||
| curr = UCS_PTR_BYTE_OFFSET(ctrl, MLX5_SEND_WQE_BB); | ||
| curr = uct_ib_mlx5_txwq_wrap_exact(txwq, curr); | ||
| pi++; | ||
| total += lengths[i]; | ||
| } | ||
|
|
||
| res_count = pi - 1 - txwq->prev_sw_pi; | ||
| txwq->prev_sw_pi += res_count; | ||
| txwq->sw_pi = pi; | ||
| txwq->curr = curr; | ||
| txwq->sig_pi = txwq->prev_sw_pi; | ||
|
|
||
| iface = ucs_derived_of(ep->super.super.super.iface, | ||
| uct_rc_mlx5_iface_common_t); | ||
| uct_rc_txqp_posted(&ep->super.txqp, &iface->super, res_count, 1); | ||
| uct_ib_mlx5_txwq_ring_doorbell(txwq, ctrl, txwq->sw_pi, 1); | ||
| uct_rc_mlx5_txwq_add_psn(txwq, IBV_QPT_RC, num_packets); | ||
|
|
||
| if (comp_always) { | ||
This comment was marked as resolved.
Sorry, something went wrong.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| /* Always create a send op, so that outstanding purge can identify the | ||
| * operation by its completion handler. */ | ||
| uct_rc_txqp_add_send_comp_sgl_always( | ||
| &iface->super, &ep->super.txqp, handler, comp, txwq->sig_pi, | ||
| UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY | op_flags, buffers, lengths, | ||
| count, total); | ||
| } else { | ||
| uct_rc_txqp_add_send_comp_sgl( | ||
| &iface->super, &ep->super.txqp, handler, comp, txwq->sig_pi, | ||
| UCT_RC_IFACE_SEND_OP_FLAG_ZCOPY | op_flags, buffers, lengths, | ||
| count, total); | ||
| } | ||
| return total; | ||
| } | ||
|
|
||
| static UCS_F_ALWAYS_INLINE void | ||
| uct_rc_mlx5_common_post_send(uct_rc_mlx5_iface_common_t *iface, int qp_type, | ||
| uct_rc_txqp_t *txqp, uct_ib_mlx5_txwq_t *txwq, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.