Skip to content

Commit edf3634

Browse files
committed
mtl/ofi: Use FI_MR_HMEM for explicit reg check
Rather than use the CXI provider name to disable explicit hmem registration, use the FI_MR_HMEM flag. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 937429f commit edf3634

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

ompi/mca/mtl/ofi/mtl_ofi_component.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2014-2021 Cisco Systems, Inc. All rights reserved
66
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
77
* reserved.
8-
* Copyright (c) 2018-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
8+
* Copyright (c) 2018-2025 Amazon.com, Inc. or its affiliates. All Rights reserved.
99
* Copyright (c) 2020-2023 Triad National Security, LLC. All rights
1010
* reserved.
1111
* $COPYRIGHT$
@@ -823,20 +823,17 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
823823
}
824824
} else {
825825
*accelerator_support = true;
826-
ompi_mtl_ofi.hmem_needs_reg = true;
827-
/*
828-
* Workaround for the fact that the CXI provider actually doesn't need for accelerator memory to be registered
829-
* for local buffers, but if one does do so using fi_mr_regattr, one actually needs to manage the
830-
* requested_key field in the fi_mr_attr attr argument, and the OFI MTL doesn't track which requested_keys
831-
* have already been registered. So just set a flag to disable local registration. Note the OFI BTL doesn't
832-
* have a problem here since it uses fi_mr_regattr only within the context of an rcache, and manages the
833-
* requested_key field in this way.
834-
*/
835-
if ((NULL != strstr(prov->fabric_attr->prov_name, "cxi")) ||
836-
(NULL != strstr(prov->fabric_attr->prov_name, "CXI")) ) {
837-
ompi_mtl_ofi.hmem_needs_reg = false;
838-
}
839826

827+
/* Only explicitly register domain buffers if the provider requires it.
828+
For example, CXI does not require it but EFA does require it. */
829+
if ((prov->domain_attr->mr_mode & FI_MR_HMEM) != 0) {
830+
ompi_mtl_ofi.hmem_needs_reg = true;
831+
opal_output_verbose(50, opal_common_ofi.output,
832+
"Support for device buffers enabled with explicit registration");
833+
} else {
834+
opal_output_verbose(50, opal_common_ofi.output,
835+
"Support for device buffers enabled with implicit registration");
836+
}
840837
}
841838
#else
842839
opal_output_verbose(50, opal_common_ofi.output,

0 commit comments

Comments
 (0)