Skip to content

Commit f4e3e2b

Browse files
authored
Merge pull request #3677 from hoopoepg/topic/add-support-max-inline-v1.5
UD/RC VERBS: added support of max_inline==0 - v1.5
2 parents b03b274 + 5cfec83 commit f4e3e2b

File tree

19 files changed

+221
-39
lines changed

19 files changed

+221
-39
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#
99

1010
## 1.5.2 (TBD)
11+
Features:
12+
- Added support for OmniPath (using Verbs)
13+
1114
Bugfixes:
1215
- Fix segfault when libuct.so is reloaded - issue #3558
1316
- Fix ucx_info crash when printing configuration alias

contrib/test_jenkins.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ echo "==== Running on $(hostname), worker $worker / $nworkers ===="
7575
module_load() {
7676
set +x
7777
module=$1
78-
if [ -n "$(module avail $module 2>&1)" ]
78+
m_avail="$(module avail $module 2>&1)" || true
79+
80+
if module avail -t 2>&1 | grep -q "^$module\$"
7981
then
8082
module load $module
8183
set -x

src/uct/ib/base/ib_device.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ static size_t uct_ib_device_get_ib_gid_index(uct_ib_md_t *md)
414414
}
415415
}
416416

417+
static int uct_ib_device_is_iwarp(uct_ib_device_t *dev)
418+
{
419+
return dev->ibv_context->device->transport_type == IBV_TRANSPORT_IWARP;
420+
}
421+
417422
ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
418423
unsigned flags)
419424
{
@@ -433,6 +438,12 @@ ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
433438
return UCS_ERR_UNREACHABLE;
434439
}
435440

441+
if (uct_ib_device_is_iwarp(dev)) {
442+
/* TODO: enable it when support is ready */
443+
ucs_debug("iWarp device %s is not supported", uct_ib_device_name(dev));
444+
return UCS_ERR_UNSUPPORTED;
445+
}
446+
436447
if (!uct_ib_device_is_port_ib(dev, port_num) && (flags & UCT_IB_DEVICE_FLAG_LINK_IB)) {
437448
ucs_debug("%s:%d is not IB link layer", uct_ib_device_name(dev),
438449
port_num);

src/uct/ib/base/ib_iface.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,4 +546,10 @@ struct ibv_pd *uct_ib_iface_qp_pd(uct_ib_iface_t *iface)
546546
return pd;
547547
}
548548

549+
static UCS_F_ALWAYS_INLINE
550+
size_t uct_ib_iface_hdr_size(size_t max_inline, size_t min_size)
551+
{
552+
return (size_t)ucs_max((ssize_t)(max_inline - min_size), 0);
553+
}
554+
549555
#endif

src/uct/ib/rc/base/rc_iface.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,15 @@ ucs_status_t uct_rc_iface_query(uct_rc_iface_t *iface,
214214
iface_attr->iface_addr_len = 0;
215215
iface_attr->ep_addr_len = sizeof(uct_rc_ep_address_t);
216216
iface_attr->max_conn_priv = 0;
217-
iface_attr->cap.flags = UCT_IFACE_FLAG_AM_SHORT |
218-
UCT_IFACE_FLAG_AM_BCOPY |
219-
UCT_IFACE_FLAG_AM_ZCOPY |
220-
UCT_IFACE_FLAG_PUT_SHORT |
221-
UCT_IFACE_FLAG_PUT_BCOPY |
222-
UCT_IFACE_FLAG_PUT_ZCOPY |
223-
UCT_IFACE_FLAG_GET_BCOPY |
224-
UCT_IFACE_FLAG_GET_ZCOPY |
225-
UCT_IFACE_FLAG_PENDING |
226-
UCT_IFACE_FLAG_CONNECT_TO_EP |
227-
UCT_IFACE_FLAG_CB_SYNC |
217+
iface_attr->cap.flags = UCT_IFACE_FLAG_AM_BCOPY |
218+
UCT_IFACE_FLAG_AM_ZCOPY |
219+
UCT_IFACE_FLAG_PUT_BCOPY |
220+
UCT_IFACE_FLAG_PUT_ZCOPY |
221+
UCT_IFACE_FLAG_GET_BCOPY |
222+
UCT_IFACE_FLAG_GET_ZCOPY |
223+
UCT_IFACE_FLAG_PENDING |
224+
UCT_IFACE_FLAG_CONNECT_TO_EP |
225+
UCT_IFACE_FLAG_CB_SYNC |
228226
UCT_IFACE_FLAG_EVENT_SEND_COMP |
229227
UCT_IFACE_FLAG_EVENT_RECV;
230228

@@ -278,7 +276,7 @@ ucs_status_t uct_rc_iface_query(uct_rc_iface_t *iface,
278276
iface_attr->cap.get.max_iov = uct_ib_iface_get_max_iov(&iface->super);
279277

280278
/* AM */
281-
iface_attr->cap.am.max_short = max_inline - sizeof(uct_rc_hdr_t);
279+
iface_attr->cap.am.max_short = uct_ib_iface_hdr_size(max_inline, sizeof(uct_rc_hdr_t));
282280
iface_attr->cap.am.max_bcopy = iface->super.config.seg_size - sizeof(uct_rc_hdr_t);
283281
iface_attr->cap.am.min_zcopy = 0;
284282
iface_attr->cap.am.max_zcopy = iface->super.config.seg_size - sizeof(uct_rc_hdr_t);
@@ -291,6 +289,14 @@ ucs_status_t uct_rc_iface_query(uct_rc_iface_t *iface,
291289
/* Tag Offload */
292290
uct_rc_iface_tag_query(iface, iface_attr, max_inline, tag_max_iov);
293291

292+
if (iface_attr->cap.am.max_short) {
293+
iface_attr->cap.flags |= UCT_IFACE_FLAG_AM_SHORT;
294+
}
295+
296+
if (iface_attr->cap.put.max_short) {
297+
iface_attr->cap.flags |= UCT_IFACE_FLAG_PUT_SHORT;
298+
}
299+
294300
return UCS_OK;
295301
}
296302

src/uct/ib/rc/verbs/rc_verbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ typedef struct uct_rc_verbs_iface {
4141
struct ibv_send_wr inl_am_wr;
4242
struct ibv_send_wr inl_rwrite_wr;
4343
uct_rc_verbs_iface_common_t verbs_common;
44+
uct_rc_iface_send_desc_t *fc_desc; /* used when max_inline is zero */
4445
struct {
4546
unsigned tx_max_wr;
4647
} config;

src/uct/ib/rc/verbs/rc_verbs_ep.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,27 +537,39 @@ ucs_status_t uct_rc_verbs_ep_fc_ctrl(uct_ep_t *tl_ep, unsigned op,
537537
uct_rc_verbs_iface_t *iface = ucs_derived_of(tl_ep->iface,
538538
uct_rc_verbs_iface_t);
539539
uct_rc_verbs_ep_t *ep = ucs_derived_of(tl_ep, uct_rc_verbs_ep_t);
540-
uct_rc_hdr_t *hdr = &iface->verbs_common.am_inl_hdr.rc_hdr;
540+
uct_rc_hdr_t *hdr;
541+
struct ibv_sge sge;
542+
int flags;
543+
544+
if (!iface->fc_desc) {
545+
hdr = &iface->verbs_common.am_inl_hdr.rc_hdr;
546+
flags = IBV_SEND_INLINE;
547+
hdr->am_id = UCT_RC_EP_FC_PURE_GRANT;
548+
fc_wr.sg_list = iface->verbs_common.inl_sge;
549+
iface->verbs_common.inl_sge[0].addr = (uintptr_t)hdr;
550+
iface->verbs_common.inl_sge[0].length = sizeof(*hdr);
551+
} else {
552+
hdr = (uct_rc_hdr_t*)(iface->fc_desc + 1);
553+
sge.addr = (uintptr_t)hdr;
554+
sge.length = sizeof(*hdr);
555+
sge.lkey = iface->fc_desc->lkey;
556+
fc_wr.sg_list = &sge;
557+
flags = 0;
558+
}
541559

542560
/* In RC only PURE grant is sent as a separate message. Other FC
543561
* messages are bundled with AM. */
544562
ucs_assert(op == UCT_RC_EP_FC_PURE_GRANT);
545563

546564
/* Do not check FC WND here to avoid head-to-head deadlock.
547565
* Credits grant should be sent regardless of FC wnd state. */
548-
ucs_assert(sizeof(*hdr) <= iface->verbs_common.config.max_inline);
549566
UCT_RC_CHECK_RES(&iface->super, &ep->super);
550567

551-
hdr->am_id = UCT_RC_EP_FC_PURE_GRANT;
552-
fc_wr.sg_list = iface->verbs_common.inl_sge;
553568
fc_wr.opcode = IBV_WR_SEND;
554569
fc_wr.next = NULL;
555570
fc_wr.num_sge = 1;
556571

557-
iface->verbs_common.inl_sge[0].addr = (uintptr_t)hdr;
558-
iface->verbs_common.inl_sge[0].length = sizeof(*hdr);
559-
560-
uct_rc_verbs_ep_post_send(iface, ep, &fc_wr, IBV_SEND_INLINE, INT_MAX);
572+
uct_rc_verbs_ep_post_send(iface, ep, &fc_wr, flags, INT_MAX);
561573
return UCS_OK;
562574
}
563575

src/uct/ib/rc/verbs/rc_verbs_iface.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ static UCS_CLASS_INIT_FUNC(uct_rc_verbs_iface_t, uct_md_h md, uct_worker_h worke
225225
uct_ib_iface_init_attr_t init_attr = {};
226226
struct ibv_qp_cap cap;
227227
struct ibv_qp *qp;
228+
uct_rc_hdr_t *hdr;
228229

229230
init_attr.res_domain_key = UCT_IB_IFACE_NULL_RES_DOMAIN_KEY;
230231
init_attr.tm_cap_bit = IBV_EXP_TM_CAP_RC;
@@ -270,6 +271,14 @@ static UCS_CLASS_INIT_FUNC(uct_rc_verbs_iface_t, uct_md_h md, uct_worker_h worke
270271
self->verbs_common.config.max_inline = cap.max_inline_data;
271272
uct_ib_iface_set_max_iov(&self->super.super, cap.max_send_sge);
272273

274+
if (self->verbs_common.config.max_inline < sizeof(*hdr)) {
275+
self->fc_desc = ucs_mpool_get(&self->verbs_common.short_desc_mp);
276+
ucs_assert_always(self->fc_desc != NULL);
277+
hdr = (uct_rc_hdr_t*)(self->fc_desc + 1);
278+
hdr->am_id = UCT_RC_EP_FC_PURE_GRANT;
279+
} else {
280+
self->fc_desc = NULL;
281+
}
273282

274283
return UCS_OK;
275284

@@ -283,6 +292,9 @@ static UCS_CLASS_INIT_FUNC(uct_rc_verbs_iface_t, uct_md_h md, uct_worker_h worke
283292

284293
static UCS_CLASS_CLEANUP_FUNC(uct_rc_verbs_iface_t)
285294
{
295+
if (self->fc_desc != NULL) {
296+
ucs_mpool_put(self->fc_desc);
297+
}
286298
uct_base_iface_progress_disable(&self->super.super.super.super,
287299
UCT_PROGRESS_SEND | UCT_PROGRESS_RECV);
288300
uct_rc_verbs_iface_common_cleanup(&self->verbs_common);

src/uct/ib/rdmacm/rdmacm_md.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ static int uct_rdmacm_is_addr_route_resolved(struct rdma_cm_id *cm_id,
8989
return 0;
9090
}
9191

92+
if (cm_id->verbs->device->transport_type == IBV_TRANSPORT_IWARP) {
93+
ucs_debug("%s: iWarp support is not implemented",
94+
ucs_sockaddr_str(addr, ip_port_str, UCS_SOCKADDR_STRING_LEN));
95+
return 0;
96+
}
97+
9298
if (rdma_resolve_route(cm_id, timeout_ms)) {
9399
ucs_debug("rdma_resolve_route(addr = %s) failed: %m",
94100
ucs_sockaddr_str(addr, ip_port_str, UCS_SOCKADDR_STRING_LEN));

src/uct/ib/ud/base/ud_ep.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,12 @@ static void uct_ud_ep_do_pending_ctl(uct_ud_ep_t *ep, uct_ud_iface_t *iface)
10031003
skb = uct_ud_ep_resend(ep);
10041004
} else if (uct_ud_ep_ctl_op_check(ep, UCT_UD_EP_OP_ACK)) {
10051005
if (uct_ud_ep_is_connected(ep)) {
1006-
skb = ucs_unaligned_ptr(&iface->tx.skb_inl.super);
1006+
if (iface->config.max_inline >= sizeof(uct_ud_neth_t)) {
1007+
skb = ucs_unaligned_ptr(&iface->tx.skb_inl.super);
1008+
} else {
1009+
skb = uct_ud_iface_resend_skb_get(iface);
1010+
skb->len = sizeof(uct_ud_neth_t);
1011+
}
10071012
uct_ud_neth_ctl_ack(ep, skb->neth);
10081013
} else {
10091014
/* Do not send ACKs if not connected yet. It may happen if
@@ -1013,7 +1018,12 @@ static void uct_ud_ep_do_pending_ctl(uct_ud_ep_t *ep, uct_ud_iface_t *iface)
10131018
}
10141019
uct_ud_ep_ctl_op_del(ep, UCT_UD_EP_OP_ACK);
10151020
} else if (uct_ud_ep_ctl_op_check(ep, UCT_UD_EP_OP_ACK_REQ)) {
1016-
skb = ucs_unaligned_ptr(&iface->tx.skb_inl.super);
1021+
if (iface->config.max_inline >= sizeof(uct_ud_neth_t)) {
1022+
skb = ucs_unaligned_ptr(&iface->tx.skb_inl.super);
1023+
} else {
1024+
skb = uct_ud_iface_resend_skb_get(iface);
1025+
skb->len = sizeof(uct_ud_neth_t);
1026+
}
10171027
uct_ud_neth_ctl_ack_req(ep, skb->neth);
10181028
uct_ud_ep_ctl_op_del(ep, UCT_UD_EP_OP_ACK_REQ);
10191029
} else if (uct_ud_ep_ctl_op_isany(ep)) {

0 commit comments

Comments
 (0)