Skip to content

Commit a9ffcf8

Browse files
committed
mtl/ofi: Use fi_tinject if possible in isend
Optimization to attempt to use fi_tinject for messages within isend to reduce the overhead when a message can be immediately buffered and sent. Signed-off-by: Matt Koop <[email protected]>
1 parent 3d5e1e6 commit a9ffcf8

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

ompi/mca/mtl/ofi/mtl_ofi.h

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* reserved.
55
* Copyright (c) 2019-2022 Triad National Security, LLC. All rights
66
* reserved.
7-
* Copyright (c) 2018-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
7+
* Copyright (c) 2018-2023 Amazon.com, Inc. or its affiliates. All Rights reserved.
88
* reserved.
99
* Copyright (c) 2021 Cisco Systems, Inc. All rights reserved
1010
* Copyright (c) 2021 The University of Tennessee and The University
@@ -1168,6 +1168,46 @@ ompi_mtl_ofi_isend_generic(struct mca_mtl_base_module_t *mtl,
11681168
return ompi_ret;
11691169
}
11701170

1171+
1172+
/** Inject does not currently support device memory
1173+
* https://github.com/ofiwg/libfabric/issues/5861
1174+
*/
1175+
if (!(convertor->flags & CONVERTOR_ACCELERATOR)
1176+
&& (ompi_mtl_ofi.max_inject_size >= length)) {
1177+
if (ofi_cq_data) {
1178+
ret = fi_tinjectdata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep,
1179+
start,
1180+
length,
1181+
comm->c_my_rank,
1182+
sep_peer_fiaddr,
1183+
match_bits);
1184+
} else {
1185+
ret = fi_tinject(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep,
1186+
start,
1187+
length,
1188+
sep_peer_fiaddr,
1189+
match_bits);
1190+
}
1191+
1192+
if(OPAL_LIKELY(ret == 0)) {
1193+
ofi_req->event_callback(NULL, ofi_req);
1194+
return ofi_req->status.MPI_ERROR;
1195+
} else if(ret != -FI_EAGAIN) {
1196+
MTL_OFI_LOG_FI_ERR(ret,
1197+
ofi_cq_data ? "fi_tinjectdata failed"
1198+
: "fi_tinject failed");
1199+
if (ack_req) {
1200+
fi_cancel((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, &ack_req->ctx);
1201+
free(ack_req);
1202+
}
1203+
ofi_req->status.MPI_ERROR = ompi_mtl_ofi_get_error(ret);
1204+
ofi_req->event_callback(NULL, ofi_req);
1205+
return ofi_req->status.MPI_ERROR;
1206+
}
1207+
/* otherwise fall back to the standard fi_tsend path */
1208+
}
1209+
1210+
11711211
if (ofi_cq_data) {
11721212
MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep,
11731213
start,

0 commit comments

Comments
 (0)