Skip to content

OFI/MTL: bypass HMEM mem reg for CXI provider #11076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ompi/mca/mtl/ofi/mtl_ofi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2019-2021 Triad National Security, LLC. All rights
* Copyright (c) 2019-2022 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2018-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
* reserved.
Expand Down Expand Up @@ -306,7 +306,7 @@ int ompi_mtl_ofi_register_buffer(struct opal_convertor_t *convertor,
return OMPI_SUCCESS;
}

if (convertor->flags & CONVERTOR_ACCELERATOR) {
if ((convertor->flags & CONVERTOR_ACCELERATOR) && ompi_mtl_ofi.hmem_needs_reg) {
/* Register buffer */
int ret;
struct fi_mr_attr attr = {0};
Expand Down
13 changes: 13 additions & 0 deletions ompi/mca/mtl/ofi/mtl_ofi_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,19 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
*accelerator_support = false;
} else {
*accelerator_support = true;
ompi_mtl_ofi.hmem_needs_reg = true;
/*
* Workaround for the fact that the CXI provider actually doesn't need for accelerator memory to be registered
* for local buffers, but if one does do so using fi_mr_regattr, one actually needs to manage the
* requested_key field in the fi_mr_attr attr argument, and the OFI MTL doesn't track which requested_keys
* have already been registered. So just set a flag to disable local registration. Note the OFI BTL doesn't
* have a problem here since it uses fi_mr_regattr only within the context of an rcache, and manages the
* requested_key field in this way.
*/
if (!strncasecmp(prov->fabric_attr->prov_name, "cxi", 3)) {
ompi_mtl_ofi.hmem_needs_reg = false;
}

}

/**
Expand Down
3 changes: 3 additions & 0 deletions ompi/mca/mtl/ofi/mtl_ofi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved
*
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2022 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -97,6 +99,7 @@ typedef struct mca_mtl_ofi_module_t {

bool is_initialized;
bool has_posted_initial_buffer;
bool hmem_needs_reg;

} mca_mtl_ofi_module_t;

Expand Down