-
Notifications
You must be signed in to change notification settings - Fork 453
UCT/EFA/SRD: Add pending and control request and response #10604
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
Conversation
Hi, how do you test it? I've tried ucx_iperf on p5e.48xlarge instance
I've tried naive approach, simply ignore unsupported flush, it seems to work.
|
test/gtest/uct/ib/test_srd.cc
Outdated
{ | ||
for (auto i = 0; i < 3; i++) { | ||
m_req[i].func = [](uct_pending_req_t*) { | ||
m_count++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if m_count is accessed only from this lambda, then you can make it local static variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
test/gtest/uct/ib/test_srd.cc
Outdated
|
||
ASSERT_UCS_OK(uct_ep_pending_add(m_e1->ep(0), &m_req[0], 0)); | ||
ASSERT_UCS_OK(uct_ep_pending_add(m_e1->ep(0), &m_req[1], 0)); | ||
uct_ep_pending_purge( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code is repeated 3 times, maybe make a helper function that purges and ASSERT_EQ
void pending_purge(ep, count)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed (was being added in next pr)
src/uct/ib/efa/srd/srd_def.h
Outdated
typedef enum uct_srd_ctl_id { | ||
UCT_SRD_CTL_ID_REQ = UCT_AM_ID_MAX, | ||
UCT_SRD_CTL_ID_RESP = UCT_SRD_CTL_ID_REQ + 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cosmetic:
typedef enum uct_srd_ctl_id { | |
UCT_SRD_CTL_ID_REQ = UCT_AM_ID_MAX, | |
UCT_SRD_CTL_ID_RESP = UCT_SRD_CTL_ID_REQ + 1, | |
typedef enum { | |
UCT_SRD_CTL_ID_REQ = UCT_AM_ID_MAX, | |
UCT_SRD_CTL_ID_RESP, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_log.c
Outdated
if ((hdr->id == UCT_SRD_CTL_ID_REQ) || (hdr->id == UCT_SRD_CTL_ID_RESP)) { | ||
ctl = (uct_srd_ctl_hdr_t*)hdr; | ||
snprintf(p, endp - p, " %s qpn %d ep_uuid %" PRIx64 " ", | ||
(ctl->id == UCT_SRD_CTL_ID_REQ) ? "CTL_REQ" : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it makes sense to implement function "_to_string" for this enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_log.c
Outdated
(ctl->id == UCT_SRD_CTL_ID_RESP) ? "CTL_RESP" : | ||
"UNKNOWN", | ||
uct_ib_unpack_uint24(ctl->qpn), ctl->ep_uuid); | ||
p += strlen(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe increment by value returned from snprintf?
We can also assert on that value (>0 and <max)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, kept strlen() as in non-debug (no assert) we need to add effective size
src/uct/ib/efa/srd/srd_log.c
Outdated
char *p, *endp; | ||
int am_id; | ||
|
||
p = buffer; | ||
endp = buffer + max; | ||
|
||
if ((hdr->id == UCT_SRD_CTL_ID_REQ) || (hdr->id == UCT_SRD_CTL_ID_RESP)) { | ||
ctl = (uct_srd_ctl_hdr_t*)hdr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would propose to split this block into a separate function e.g. _dump_header
, because it's really independent functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, but function is already small
src/uct/ib/efa/srd/srd_iface.c
Outdated
goto out; | ||
} | ||
|
||
ucs_assertv(ctl->id == UCT_SRD_CTL_ID_REQ, "iface=%p id=%u", iface, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also use "_to_string" here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_iface.c
Outdated
ucs_assertv(ctl->id == UCT_SRD_CTL_ID_REQ, "iface=%p id=%u", iface, | ||
ctl->id); | ||
ucs_assertv((sizeof(*ctl) + iface->super.addr_size) == length, | ||
"req size mismatched expected=%zu received=%u", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"req size mismatched expected=%zu received=%u", | |
"req size mismatch expected=%zu received=%u", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_ep.c
Outdated
ep->pending++; | ||
uct_pending_req_arb_group_push(&ep->pending_group, req); | ||
ucs_arbiter_group_schedule(&iface->tx.pending_q, &ep->pending_group); | ||
ucs_trace_data("ep=%p: added pending req=%p psn=%u", ep, req, ep->psn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print iface like in other places?
ucs_trace_data("ep=%p: added pending req=%p psn=%u", ep, req, ep->psn); | |
ucs_trace_data("iface=%p ep=%p: added pending req=%p psn=%u", ep, req, ep->psn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_ep.c
Outdated
uct_srd_iface_t *iface = ucs_derived_of(tl_ep->iface, uct_srd_iface_t); | ||
uct_purge_cb_args_t args = {cb, cb_arg}; | ||
|
||
ucs_trace_func("ep=%p", ep); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it's missing iface and some description, e.g. iface=%p ep=%p: purge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's trace function, added some arguments
src/uct/ib/efa/srd/srd_def.h
Outdated
ucs_list_link_t list; /* Entry in iface tx pending control list */ | ||
struct ibv_ah *ah; | ||
int dest_qpn; | ||
uct_srd_ctl_hdr_t hdr[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: imo, you could also remove it, like with hdr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed all hdr[]
src/uct/ib/efa/srd/srd_ep.h
Outdated
uint64_t ep_uuid; /* Random EP identifier */ | ||
uint32_t dest_qpn; /* Remote QP */ | ||
uint32_t inflight; /* Entries outstanding list */ | ||
int32_t pending; /* Count requests in pending queue */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it be negative?
seems like we do not really need this counter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_iface.h
Outdated
@@ -60,6 +63,7 @@ typedef struct uct_srd_iface { | |||
|
|||
struct { | |||
int32_t available; | |||
int in_pending; /* true if invoked from arbiter dispatch */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: can be for assert only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_ep.c
Outdated
uct_pending_req_t *req = ucs_container_of(elem, uct_pending_req_t, | ||
priv); | ||
|
||
/* Purge all of them, as requests were only added with pending_add */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this comment mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed (some transports add their own pending_req_t internally, srd currently does not)
src/uct/ib/efa/srd/srd_ep.c
Outdated
@@ -183,6 +284,10 @@ static UCS_F_ALWAYS_INLINE ucs_status_t uct_srd_ep_am_short_prepare( | |||
uct_srd_am_short_hdr_t *am = &iface->tx.am_inl_hdr; | |||
uct_srd_send_op_t *send_op; | |||
|
|||
if (uct_srd_ep_skip_pending(ep, iface)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do not we check for resources instead?
Specifically for uct_srd_iface_can_tx(iface) && ep->ah_added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_iface.c
Outdated
ctl_op = ucs_malloc(sizeof(*ctl_op) + sizeof(*ctl_op->hdr) + | ||
iface->super.addr_size, | ||
"uct_srd_ctl_op_t"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indented back line with iface->super.addr_size
src/uct/ib/efa/srd/srd_iface.c
Outdated
@@ -535,8 +779,15 @@ uct_srd_iface_poll_rx(uct_srd_iface_t *iface) | |||
UCT_IB_IFACE_VERBS_FOREACH_RXWQE(&iface->super, i, packet, wc, num_wcs) { | |||
uct_ib_log_recv_completion(&iface->super, &wc[i], packet, | |||
wc[i].byte_len, uct_srd_dump_packet); | |||
uct_srd_iface_process_rx(iface, (uct_srd_hdr_t*)packet, wc[i].byte_len, | |||
(uct_srd_recv_desc_t*)wc[i].wr_id); | |||
if ((*(uint8_t*)packet < UCT_AM_ID_MAX)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd add likely here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
test/gtest/uct/ib/test_srd.cc
Outdated
for (auto count = 10; count > 0; count--) { | ||
short_progress_loop(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we progress until ah_added flag on ep is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_iface.c
Outdated
uct_srd_iface_process_rx(iface, (uct_srd_hdr_t*)packet, wc[i].byte_len, | ||
(uct_srd_recv_desc_t*)wc[i].wr_id); | ||
if ((*(uint8_t*)packet < UCT_AM_ID_MAX)) { | ||
uct_srd_iface_process_rx(iface, (uct_srd_hdr_t*)packet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this cast and one below are redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_iface.c
Outdated
ucs_mpool_put(desc); | ||
return; | ||
|
||
err: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's better to get rid of this goto and just print error in 2 places, but up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying something else
src/uct/ib/efa/srd/srd_iface.c
Outdated
khiter_t iter; | ||
ucs_status_t status; | ||
|
||
iter = kh_get(uct_srd_ep_hash, &iface->ep_hash, ep->ep_uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we put unconditionally and then check the return value:
- already exists/ error - return error, without goto
- then handle sucsess case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_ep.c
Outdated
hdr = (uct_srd_hdr_t *)(desc + 1); | ||
length = pack_cb(hdr + 1, arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: align by =
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see it already aligned
src/uct/ib/efa/srd/srd_iface.c
Outdated
ctl_op->ah = ah; | ||
ctl_op->dest_qpn = dest_qpn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls remove extra whitespaces now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see it already aligned
|
||
ucs_trace_data("iface=%p ep=%p progressing pending request %p", iface, ep, | ||
req); | ||
iface->tx.in_pending = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems it can be done when asserts enabled only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/uct/ib/efa/srd/srd_ep.c
Outdated
if (!uct_srd_ep_can_tx(ep, iface)) { | ||
UCS_STATS_UPDATE_COUNTER(ep->super.stats, UCT_EP_STAT_NO_RES, 1); | ||
return UCS_ERR_NO_RESOURCE; | ||
} | ||
|
||
uct_srd_iface_check_pending(iface, &ep->pending_group); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we combine it to one macro, as it is used in other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure as there is not a single macro used everywhere. maybe we could add to uct_srd_ep_can_tx()
babc1b1
to
bd41d7f
Compare
bd41d7f
to
58e4a0d
Compare
What?
Add pending management and control message exchange to remotely add AH, before posting RMA operations.
How?
Tracking remote AH state on iface or MD could cause issues as there could be multiple MD (protection domain) opened on the same remote HCA, and while locally iface or MD could remain, the remote entities could have been released and reopened with same QP id, making it difficult to identify if sending another control request is needed.
Steps
All posts are anyways heavily reordered so: