UCT: Add outstanding operation extraction support#11580
Conversation
de6901e to
04b656e
Compare
| * Operation type from @ref uct_ep_operation_t (e.g. UCT_EP_OP_AM_SHORT, | ||
| * UCT_EP_OP_PUT_ZCOPY, UCT_EP_OP_FLUSH, etc.). | ||
| */ | ||
| uct_ep_operation_t operation; |
There was a problem hiding this comment.
UCT_EP_OP_INFO_FIELD_OPERATION is missed
| UCT_EP_OP_INFO_FIELD_AM = UCS_BIT(0), /**< am_id, am_hdr* fields */ | ||
| UCT_EP_OP_INFO_FIELD_DATA = UCS_BIT(1), /**< data/length (short/bcopy) */ | ||
| UCT_EP_OP_INFO_FIELD_IOV = UCS_BIT(2), /**< iov/iovcnt (zcopy) */ | ||
| UCT_EP_OP_INFO_FIELD_RMA = UCS_BIT(3), /**< remote_addr, rkey */ | ||
| UCT_EP_OP_INFO_FIELD_ATOMIC = UCS_BIT(4), /**< atomic_op, value, compare */ | ||
| UCT_EP_OP_INFO_FIELD_COMP = UCS_BIT(5), /**< Original uct_completion_t */ | ||
| UCT_EP_OP_INFO_FIELD_FLAGS = UCS_BIT(6), /**< Original flags */ |
There was a problem hiding this comment.
pls keep the same order as fields of struct uct_ep_op_info
| res_count = uct_ib_mlx5_post_send(txwq, ctrl, wqe_size, 1); | ||
| num_bb = txwq->sw_pi - pi; | ||
|
|
||
| if (txwq->msn != NULL) { |
There was a problem hiding this comment.
redundant bcz check on init
| if (opcode != MLX5_OPCODE_NOP) { | ||
| uct_rc_mlx5_txwq_set_msn(txwq, pi, num_bb); | ||
| } else { | ||
| uct_rc_mlx5_txwq_set_msn(txwq, pi, 0); | ||
| } |
There was a problem hiding this comment.
| if (opcode != MLX5_OPCODE_NOP) { | |
| uct_rc_mlx5_txwq_set_msn(txwq, pi, num_bb); | |
| } else { | |
| uct_rc_mlx5_txwq_set_msn(txwq, pi, 0); | |
| } | |
| num_bb = ucs_likely(opcode != MLX5_OPCODE_NOP) ? | |
| (txwq->sw_pi - pi) : 0; | |
| uct_rc_mlx5_txwq_set_msn(txwq, pi, num_bb); |
| attr.field_mask |= UCT_IB_MLX5_EXT_QP_QUERY_ATTR_FIELD_QP_NUM; | ||
| attr.qp_num = ep->tx.wq.super.qp_num; | ||
| #endif | ||
| } |
There was a problem hiding this comment.
else return INVALID_PARAM
| if (attr.field_mask == 0) { | ||
| return UCS_OK; | ||
| } |
There was a problem hiding this comment.
could be checked in advance for ep_attr->field_mask near check at line 38
| continue; | ||
| } | ||
|
|
||
| return plugin->ops.ep_outstanding_extract(ep, params); |
There was a problem hiding this comment.
since we query QP in plugin API then it should be plugin->ops.qp_outstanding_extract
There was a problem hiding this comment.
Currently plugin needs ep ctx, not only the QP: it derives the RC ep, iface, txwq and txqp, then walks the outstanding send queue.
Passing only QP is not sufficient.
There was a problem hiding this comment.
so then it should be EP in both cases
| uct_ib_mlx5_ext_qp_query_func_t qp_query; /**< QP query callback */ | ||
| uct_ib_mlx5_ext_max_put_sgl_zcopy_count_func_t max_put_sgl_zcopy_count; /**< Maximum PUT SGL zero-copy entry count callback */ | ||
| uct_ep_put_sgl_zcopy_func_t ep_put_sgl_zcopy; /**< PUT SGL zero-copy callback */ | ||
| uct_ep_outstanding_extract_func_t ep_outstanding_extract; /**< Outstanding operation extract callback */ |
There was a problem hiding this comment.
need to align qp_query/ep_outstanding_extract APIs: QP or EP?
There was a problem hiding this comment.
Problem is the 2 APIs need different scope of qp/ep info.
| * caller. | ||
| */ | ||
| ucs_status_t | ||
| uct_ep_outstanding_extract(uct_ep_h ep, |
There was a problem hiding this comment.
how about to rename to uct_ep_outstanding_purge? (to align with uct_ep_pending_purge)
There was a problem hiding this comment.
This operation is not similar as uct_ep_pending_purge: it classifies outstanding WQEs, optionally completes already delivered operations, and reports undelivered operations back to the caller for replay. Maybe "extract" describes this behavior more accurately than "purge", WDYT?
There was a problem hiding this comment.
btw, why do we need to extract all the outstanding operations? in terms of IB I would expect to have a converting of failed CQE to WQE and repost it if not delivered. Should not it be enough for reposting failover protocols?
| uct_rc_mlx5_txwq_set_msn(uct_ib_mlx5_txwq_t *txwq, uint16_t pi, uint16_t num_bb) | ||
| { | ||
| unsigned index = pi % txwq->bb_max; | ||
| uct_ib_mlx5_txwq_msn_t *entry = &txwq->msn[index]; |
There was a problem hiding this comment.
can we make msn entry part of uct_rc_iface_send_op to improve mem locality?
There was a problem hiding this comment.
But not every WQE has a send_op associated with it, while extraction needs MSN information for all outstanding WQEs.
There was a problem hiding this comment.
Can you provide an example? Do we need to repost WQEs (after failure) which do not have send_op
Arm RC mlx5 endpoints before peer failure so error handling leaves outstanding sends available for extraction. Suppress user completions while releasing CQ resources, and let endpoint destruction hand the failed QP to asynchronous garbage collection.
Verify that extraction reports posted operations in order and preserves the metadata needed by failover replay.
Use the failover-specific _ft suffix for the completion-backed PUT bcopy entry point and transport operation. Remove the redundant capability bit since availability follows QUERY_TOKEN support.
Organize extracted operation metadata by protocol parameter group, align field-mask ordering with the structure layout, and distinguish AM flags from flush parameters. Also align internal operation initializers touched by outstanding extraction support.
evgeny-leksikov
left a comment
There was a problem hiding this comment.
Please split the PR to API and impl, PR with API can include stubs if <= 500 lines.
| struct { | ||
| uint8_t am_id; /**< AM handler ID */ | ||
| unsigned flags; /**< Flags passed to the AM operation */ | ||
| union { | ||
| uint64_t header; /**< AM short 64-bit header word */ | ||
| const void *header_buffer; /**< AM zcopy header buffer */ | ||
| }; | ||
| size_t header_length; /**< AM zcopy header length */ | ||
| } am; |
There was a problem hiding this comment.
should we have such structures under union backward compatible?
| num_bb = ucs_likely(opcode != MLX5_OPCODE_NOP) ? | ||
| (txwq->sw_pi - pi) : 0; | ||
|
|
||
| if (txwq->wqe_priv != NULL) { |
There was a problem hiding this comment.
redundant check, done in ctor
| uct_rc_mlx5_txwq_set_msn(uct_ib_mlx5_txwq_t *txwq, uint16_t pi, uint16_t num_bb) | ||
| { | ||
| unsigned index = pi % txwq->bb_max; | ||
| uct_ib_mlx5_txwq_msn_t *entry = &txwq->msn[index]; |
There was a problem hiding this comment.
Can you provide an example? Do we need to repost WQEs (after failure) which do not have send_op
What?
Add UCT-level support for failover ops extraction.
Add impl for token query.
Why?
UCP failover needs map tokens to send ops and resend failed ops.
How?
Introduces a callback-based extraction api.