Skip to content

Commit 2311331

Browse files
authored
Merge pull request #11584 from mjkoop/ofi-isend
mtl/ofi: Use fi_tinject if possible in isend
2 parents fdf50d0 + a9ffcf8 commit 2311331

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
@@ -1165,6 +1165,46 @@ ompi_mtl_ofi_isend_generic(struct mca_mtl_base_module_t *mtl,
11651165
return ompi_ret;
11661166
}
11671167

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

0 commit comments

Comments
 (0)