Skip to content

Commit 4b1b8bd

Browse files
authored
Stopgap measure for deprecated libfabric macros (#4690)
* Stopgap measure of deprecated libfabric macros * minimize macros, fix missing, add comment
1 parent 405e464 commit 4b1b8bd

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

source/adios2/toolkit/sst/dp/rdma_dp.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ static pthread_mutex_t fabric_mutex = PTHREAD_MUTEX_INITIALIZER;
6464
pthread_mutex_t wsr_mutex = PTHREAD_MUTEX_INITIALIZER;
6565
pthread_mutex_t ts_mutex = PTHREAD_MUTEX_INITIALIZER;
6666

67+
/*
68+
* Internal version of deprecated APIs.
69+
* These are used internally to avoid compiler warnings.
70+
*/
71+
72+
#define ADIOS_FI_MR_BASIC (1 << 0)
73+
#define ADIOS_FI_LOCAL_MR (1ULL << 55)
74+
6775
/*
6876
* Wrapper for fi_mr_reg() with additional parameters endpoint and mr_mode.
6977
* If mr_mode includes FI_MR_ENDPOINT, the memory region must be bound to the
@@ -400,7 +408,7 @@ static void init_fabric(struct fabric_state *fabric, struct _SstParams *Params,
400408
hints->caps =
401409
FI_MSG | FI_SEND | FI_RECV | FI_REMOTE_READ | FI_REMOTE_WRITE | FI_RMA | FI_READ | FI_WRITE;
402410
hints->mode =
403-
FI_CONTEXT | FI_LOCAL_MR | FI_CONTEXT2 | FI_MSG_PREFIX | FI_ASYNC_IOV | FI_RX_CQ_DATA;
411+
FI_CONTEXT | ADIOS_FI_LOCAL_MR | FI_CONTEXT2 | FI_MSG_PREFIX | FI_ASYNC_IOV | FI_RX_CQ_DATA;
404412
hints->ep_attr->type = FI_EP_RDM;
405413
hints->domain_attr->threading = FI_THREAD_SAFE;
406414

@@ -564,7 +572,7 @@ static void init_fabric(struct fabric_state *fabric, struct _SstParams *Params,
564572
fabric->ctx = NULL;
565573
}
566574

567-
if (info->mode & FI_LOCAL_MR)
575+
if (info->mode & ADIOS_FI_LOCAL_MR)
568576
{
569577
fabric->local_mr_req = 1;
570578
}
@@ -605,7 +613,7 @@ static void init_fabric(struct fabric_state *fabric, struct _SstParams *Params,
605613
* So we propagate the bit value currently contained in the mr_mode
606614
* for these flags.
607615
*/
608-
if (info->domain_attr->mr_mode != FI_MR_BASIC)
616+
if (info->domain_attr->mr_mode != ADIOS_FI_MR_BASIC)
609617
{
610618
info->domain_attr->mr_mode = FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_LOCAL |
611619
(FI_MR_ENDPOINT & info->domain_attr->mr_mode) |
@@ -2507,7 +2515,7 @@ static int RdmaGetPriority(CP_Services Svcs, void *CP_Stream, struct _SstParams
25072515
hints->caps =
25082516
FI_MSG | FI_SEND | FI_RECV | FI_REMOTE_READ | FI_REMOTE_WRITE | FI_RMA | FI_READ | FI_WRITE;
25092517
hints->mode =
2510-
FI_CONTEXT | FI_LOCAL_MR | FI_CONTEXT2 | FI_MSG_PREFIX | FI_ASYNC_IOV | FI_RX_CQ_DATA;
2518+
FI_CONTEXT | ADIOS_FI_LOCAL_MR | FI_CONTEXT2 | FI_MSG_PREFIX | FI_ASYNC_IOV | FI_RX_CQ_DATA;
25112519
hints->ep_attr->type = FI_EP_RDM;
25122520

25132521
char const *vni_env_str = getenv("SLINGSHOT_VNIS");
@@ -2530,14 +2538,31 @@ static int RdmaGetPriority(CP_Services Svcs, void *CP_Stream, struct _SstParams
25302538
}
25312539
else
25322540
{
2541+
/*
2542+
* Oct 23, 2025 - [email protected]
2543+
*
2544+
* For non-CXI providers, we are currently relying upon
2545+
* libfabric version 1.5 behavior, which includes using macros
2546+
* like FI_MR_BASIC and FI_LOCAL_MR that are deprecated in
2547+
* libfabric 2.x. However, at the time of this writing, those
2548+
* bitpositions are still examined in some libfabric
2549+
* providers, so we use our own macros (without the deprecated
2550+
* spec) to avoid compiler warnings. At some point when these
2551+
* macros are no longer used in any supported provider this
2552+
* can be removed and cleaned up. Of the supported providers
2553+
* "gni" has disappeared from libfabric 2.x. "cxi" support is
2554+
* newly written and shouldn't require these macros. "psm2"
2555+
* still references those bit positions, but those machines
2556+
* may be disappearing.
2557+
*/
25332558
Svcs->verbose(CP_Stream, DPSummaryVerbose,
25342559
"RDMA Dataplane trying to check for an available non-CXI "
25352560
"provider since environment variable SLINGSHOT_VNIS is "
25362561
"not defined.\n");
25372562

25382563
fi_version = FI_VERSION(1, 5);
25392564

2540-
hints->domain_attr->mr_mode = FI_MR_BASIC;
2565+
hints->domain_attr->mr_mode = ADIOS_FI_MR_BASIC;
25412566
hints->domain_attr->control_progress = FI_PROGRESS_AUTO;
25422567
// data progress unspecified, both are fine
25432568
// hints->domain_attr->data_progress = FI_PROGRESS_AUTO;

0 commit comments

Comments
 (0)