Skip to content

Commit

Permalink
prov/verbs: Add support for IBV_ACCESS_RELAXED_ORDERING
Browse files Browse the repository at this point in the history
IBV_ACCESS_RELAXED_ORDERING allows the system to reorder
Send/Write/Atomic operations to improve performance.

The patch enables IBV_ACCESS_RELAXED_ORDERING if the application
exports FI_VERBS_RELAXED_ORDERING=1.

Signed-off-by: Sylvain Didelot <sdidelot@ddn.com>
  • Loading branch information
sydidelot committed Dec 18, 2023
1 parent 9d85679 commit 8db96bd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions man/fi_verbs.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ The verbs provider checks for the following environment variables.
testing the functionality of the dmabuf_peer_mem hooking provider and the
corresponding kernel driver. (default: yes)

*FI_VERBS_RELAXED_ORDERING*
: If supported, allow the system to reorder Send/Write/Atomic operations
to improve performance (default: no)

### Variables specific to MSG endpoints

*FI_VERBS_IFACE*
Expand Down
10 changes: 10 additions & 0 deletions prov/verbs/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ AC_DEFUN([FI_VERBS_CONFIGURE],[
AC_DEFINE_UNQUOTED([VERBS_HAVE_DMABUF_MR],[$VERBS_HAVE_DMABUF_MR],
[Whether infiniband/verbs.h has ibv_reg_dmabuf_mr() support or not])
#See if we have rdma-core IBV_ACCESS_RELAXED_ORDERING mr support
VERBS_HAVE_RELAXED_ORDERING_MR=0
AS_IF([test $verbs_ibverbs_happy -eq 1],[
AC_CHECK_DECL([IBV_ACCESS_RELAXED_ORDERING],
[VERBS_HAVE_RELAXED_ORDERING_MR=1],[],
[#include <infiniband/verbs.h>])
])
AC_DEFINE_UNQUOTED([VERBS_HAVE_RELAXED_ORDERING_MR],[$VERBS_HAVE_RELAXED_ORDERING_MR],
[Whether infiniband/verbs.h has IBV_ACCESS_RELAXED_ORDERING support or not])
CPPFLAGS=$fi_verbs_configure_save_CPPFLAGS
# Technically, verbs_ibverbs_CPPFLAGS and
Expand Down
6 changes: 6 additions & 0 deletions prov/verbs/src/verbs_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,12 @@ int vrb_read_params(void)
VRB_INFO(FI_LOG_CORE, "dmabuf support is %s\n",
vrb_gl_data.dmabuf_support ? "enabled" : "disabled");

if (vrb_get_param_bool("relaxed_ordering", "Enable relaxed ordering.",
(int *)&vrb_gl_data.relaxed_ordering)) {
VRB_WARN(FI_LOG_CORE, "Invalid value of relaxed_ordering\n");
return -FI_EINVAL;
}

/* MSG-specific parameter */
if (vrb_get_param_str("iface", "The prefix or the full name of the "
"network interface associated with the verbs "
Expand Down
3 changes: 3 additions & 0 deletions prov/verbs/src/verbs_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ vrb_mr_ofi2ibv_access(uint64_t ofi_access, struct vrb_domain *domain)
IBV_ACCESS_REMOTE_WRITE |
IBV_ACCESS_REMOTE_ATOMIC;

if (vrb_gl_data.relaxed_ordering)
ibv_access |= VRB_ACCESS_RELAXED_ORDERING;

return ibv_access;
}

Expand Down
7 changes: 7 additions & 0 deletions prov/verbs/src/verbs_ofi.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ extern struct vrb_gl_data {

bool peer_mem_support;
bool dmabuf_support;
bool relaxed_ordering;
} vrb_gl_data;

struct verbs_addr {
Expand Down Expand Up @@ -438,6 +439,12 @@ int vrb_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
struct fid_cq **cq, void *context);
int vrb_cq_trywait(struct vrb_cq *cq);

#if VERBS_HAVE_RELAXED_ORDERING_MR
#define VRB_ACCESS_RELAXED_ORDERING IBV_ACCESS_RELAXED_ORDERING
#else
#define VRB_ACCESS_RELAXED_ORDERING 0
#endif

struct vrb_mem_desc {
struct fid_mr mr_fid;
struct ibv_mr *mr;
Expand Down

0 comments on commit 8db96bd

Please sign in to comment.