Skip to content

Commit e2efaf1

Browse files
committed
btl/openib: update experimental verbs support
This update adds an additional check (if supported) to see if 8-byte atomics are supported by the hardware. If 8-byte atomics are not supported the atomics support is disabled. This commit also includes some cleanup. Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from open-mpi/ompi@bb8e347)
1 parent e727ba3 commit e2efaf1

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

config/opal_check_openfabrics.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@ AC_DEFUN([OPAL_CHECK_EXP_VERBS],[
397397
[have_struct_ibv_exp_send_wr=0
398398
AC_MSG_RESULT([no])])
399399
400-
AC_DEFINE_UNQUOTED([HAVE_EXP_VERBS], [$have_struct_ibv_exp_send_wr], [Expanded verbs])
401-
AC_CHECK_DECLS([IBV_EXP_ATOMIC_HCA_REPLY_BE, IBV_EXP_QP_CREATE_ATOMIC_BE_REPLY, ibv_exp_create_qp], [], [], [#include <infiniband/verbs_exp.h>])
402-
AC_CHECK_HEADERS([infiniband/verbs_exp.h])
400+
AC_DEFINE_UNQUOTED([HAVE_EXP_VERBS], [$have_struct_ibv_exp_send_wr], [Experimental verbs])
401+
AC_CHECK_DECLS([IBV_EXP_ATOMIC_HCA_REPLY_BE, IBV_EXP_QP_CREATE_ATOMIC_BE_REPLY, ibv_exp_create_qp, ibv_exp_query_device],
402+
[], [], [#include <infiniband/verbs_exp.h>])
403403
AS_IF([test '$have_struct_ibv_exp_send_wr' = 1], [$1], [$2])
404404
OPAL_VAR_SCOPE_POP
405405
])dnl

opal/mca/btl/openib/btl_openib.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,11 @@ typedef struct mca_btl_openib_device_t {
371371
#endif
372372
opal_mutex_t device_lock; /* device level lock */
373373
struct ibv_context *ib_dev_context;
374+
#if HAVE_DECL_IBV_EXP_QUERY_DEVICE
375+
struct ibv_exp_device_attr ib_dev_attr;
376+
#else
374377
struct ibv_device_attr ib_dev_attr;
378+
#endif
375379
struct ibv_pd *ib_pd;
376380
struct ibv_cq *ib_cq[2];
377381
uint32_t cq_size[2];

opal/mca/btl/openib/btl_openib_component.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,16 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device,
824824
#if HAVE_DECL_IBV_ATOMIC_HCA
825825
openib_btl->atomic_ops_be = false;
826826

827+
#if HAVE_DECL_IBV_EXP_QUERY_DEVICE
828+
/* check that 8-byte atomics are supported */
829+
if (!(device->dev_attr.ext_atom.log_atomic_arg_sizes & (1<<3ull))) {
830+
openib_btl->super.btl_flags &= ~MCA_BTL_FLAGS_ATOMIC_FOPS;
831+
openib_btl->super.btl_atomic_flags = 0;
832+
openib_btl->super.btl_atomic_fop = NULL;
833+
openib_btl->super.btl_atomic_cswap = NULL;
834+
}
835+
#endif
836+
827837
switch (openib_btl->device->ib_dev_attr.atomic_cap) {
828838
case IBV_ATOMIC_GLOB:
829839
openib_btl->super.btl_flags |= MCA_BTL_ATOMIC_SUPPORTS_GLOB;
@@ -1643,12 +1653,19 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
16431653
ibv_get_device_name(device->ib_dev), strerror(errno)));
16441654
goto error;
16451655
}
1646-
1656+
#if HAVE_DECL_IBV_EXP_QUERY_DEVICE
1657+
if(ibv_exp_query_device(device->ib_dev_context, &device->ib_dev_attr)){
1658+
BTL_ERROR(("error obtaining device attributes for %s errno says %s",
1659+
ibv_get_device_name(device->ib_dev), strerror(errno)));
1660+
goto error;
1661+
}
1662+
#else
16471663
if(ibv_query_device(device->ib_dev_context, &device->ib_dev_attr)){
16481664
BTL_ERROR(("error obtaining device attributes for %s errno says %s",
16491665
ibv_get_device_name(device->ib_dev), strerror(errno)));
16501666
goto error;
16511667
}
1668+
#endif
16521669
/* If mca_btl_if_include/exclude were specified, get usable ports */
16531670
allowed_ports = (int*)malloc(device->ib_dev_attr.phys_port_cnt * sizeof(int));
16541671
if (NULL == allowed_ports) {

opal/mca/btl/openib/connect/btl_openib_connect_udcm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
#include <sys/types.h>
5757
#include <fcntl.h>
5858
#include <infiniband/verbs.h>
59-
#ifdef HAVE_INFINIBAND_VERBS_EXP_H
60-
#include <infiniband/verbs_exp.h>
61-
#endif
6259
#include <signal.h>
6360

6461
#include <pthread.h>
@@ -1341,7 +1338,7 @@ static int udcm_rc_qp_create_one(udcm_module_t *m, mca_btl_base_endpoint_t* lcl_
13411338
init_attr.pd = m->btl->device->ib_pd;
13421339

13431340
init_attr.comp_mask |= IBV_EXP_QP_INIT_ATTR_ATOMICS_ARG;
1344-
init_attr.max_atomic_arg = 8;
1341+
init_attr.max_atomic_arg = sizeof (int64_t);
13451342

13461343
#if HAVE_DECL_IBV_EXP_ATOMIC_HCA_REPLY_BE
13471344
if (IBV_EXP_ATOMIC_HCA_REPLY_BE == m->btl->device->ib_dev_attr.atomic_cap) {

0 commit comments

Comments
 (0)