1515 * Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
1616 *
1717 * Copyright (c) 2018-2021 Amazon.com, Inc. or its affiliates. All Rights reserved.
18- * Copyright (c) 2020-2022 Triad National Security, LLC. All rights
18+ * Copyright (c) 2020-2023 Triad National Security, LLC. All rights
1919 * reserved.
2020 * $COPYRIGHT$
2121 *
@@ -106,7 +106,11 @@ static int validate_info(struct fi_info *info, uint64_t required_caps, char **in
106106 mr_mode = info -> domain_attr -> mr_mode ;
107107
108108 if (!(mr_mode == FI_MR_BASIC || mr_mode == FI_MR_SCALABLE
109+ #if defined(FI_MR_HMEM )
109110 || (mr_mode & ~(FI_MR_VIRT_ADDR | FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_ENDPOINT | FI_MR_HMEM )) == 0 )) {
111+ #else
112+ || (mr_mode & ~(FI_MR_VIRT_ADDR | FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_ENDPOINT )) == 0 )) {
113+ #endif
110114 BTL_VERBOSE (("unsupported MR mode" ));
111115 return OPAL_ERROR ;
112116 }
@@ -339,27 +343,32 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init(int *num_btl_modules,
339343
340344 mca_btl_ofi_component .module_count = 0 ;
341345
346+ #if defined(FI_HMEM )
342347 /* Request device transfer capabilities, separate from required_caps */
343348 hints .caps |= FI_HMEM ;
344349 hints .domain_attr -> mr_mode |= FI_MR_HMEM ;
345350no_hmem :
351+ #endif
346352
347353 /* Do the query. The earliest version that supports FI_HMEM hints is 1.9 */
348354 rc = fi_getinfo (FI_VERSION (1 , 9 ), NULL , NULL , 0 , & hints , & info_list );
349355 if (0 != rc ) {
356+ #if defined(FI_HMEM )
350357 if (hints .caps & FI_HMEM ) {
351358 /* Try again without FI_HMEM hints */
352359 hints .caps &= ~FI_HMEM ;
353360 hints .domain_attr -> mr_mode &= ~FI_MR_HMEM ;
354361 goto no_hmem ;
355362 }
363+ #endif
356364 BTL_VERBOSE (("fi_getinfo failed with code %d: %s" , rc , fi_strerror (- rc )));
357365 if (NULL != include_list ) {
358366 opal_argv_free (include_list );
359367 }
360368 return NULL ;
361369 }
362370
371+ #if defined(FI_HMEM )
363372 /* If we get to this point with FI_HMEM hint set, we want it to be a
364373 * required capability
365374 */
@@ -375,6 +384,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init(int *num_btl_modules,
375384 }
376385 required_caps |= FI_HMEM ;
377386 }
387+ #endif
378388
379389 /* count the number of resources/ */
380390 info = info_list ;
@@ -604,9 +614,11 @@ static int mca_btl_ofi_init_device(struct fi_info *info)
604614 module -> use_fi_mr_bind = false;
605615 module -> bypass_cache = false;
606616
617+ #if defined(FI_HMEM )
607618 if (ofi_info -> caps & FI_HMEM ) {
608619 module -> super .btl_flags |= MCA_BTL_FLAGS_ACCELERATOR_RDMA ;
609620 }
621+ #endif
610622
611623 if (ofi_info -> domain_attr -> mr_mode == FI_MR_BASIC
612624 || ofi_info -> domain_attr -> mr_mode & FI_MR_VIRT_ADDR ) {
0 commit comments