Skip to content

Commit d5e65c4

Browse files
authored
Merge pull request #2052 from alex-mikheev/topic/spml_ikrit_zcopy_fix
OSHMEM: spml ikrit: fixes zero copy
2 parents 3b968ec + 439456a commit d5e65c4

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

oshmem/mca/spml/ikrit/spml_ikrit.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -902,12 +902,8 @@ int mca_spml_ikrit_get(void *src_addr, size_t size, void *dst_addr, int src)
902902
return OSHMEM_ERROR;
903903
}
904904

905-
#if MXM_API < MXM_VERSION(2,0)
906-
sreq.base.flags = MXM_REQ_FLAG_BLOCKING;
907-
#else
908-
sreq.flags = MXM_REQ_SEND_FLAG_BLOCKING;
909-
#endif
910905
sreq.base.completed_cb = NULL;
906+
sreq.flags = 0;
911907

912908
SPML_IKRIT_MXM_POST_SEND(sreq);
913909

@@ -1161,7 +1157,11 @@ static inline int mca_spml_ikrit_put_internal(void* dst_addr,
11611157
put_req->mxm_req.opcode = MXM_REQ_OP_PUT;
11621158
}
11631159
if (!zcopy) {
1164-
put_req->mxm_req.flags |= MXM_REQ_SEND_FLAG_BLOCKING;
1160+
if (size < mca_spml_ikrit.put_zcopy_threshold) {
1161+
put_req->mxm_req.flags |= MXM_REQ_SEND_FLAG_BLOCKING;
1162+
} else {
1163+
put_req->mxm_req.opcode = MXM_REQ_OP_PUT_SYNC;
1164+
}
11651165
}
11661166
#endif
11671167

oshmem/mca/spml/ikrit/spml_ikrit.h

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ struct mca_spml_ikrit_t {
106106
#if MXM_API >= MXM_VERSION(2,0)
107107
int unsync_conn_max;
108108
#endif
109+
size_t put_zcopy_threshold; /* enable zcopy in put if message size is
110+
greater than the threshold */
109111
};
110112

111113
typedef struct mca_spml_ikrit_t mca_spml_ikrit_t;

oshmem/mca/spml/ikrit/spml_ikrit_component.c

+18
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ static inline void mca_spml_ikrit_param_register_int(const char* param_name,
167167
storage);
168168
}
169169

170+
static inline void mca_spml_ikrit_param_register_size_t(const char* param_name,
171+
size_t default_value,
172+
const char *help_msg,
173+
size_t *storage)
174+
{
175+
*storage = default_value;
176+
(void) mca_base_component_var_register(&mca_spml_ikrit_component.spmlm_version,
177+
param_name,
178+
help_msg,
179+
MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,
180+
OPAL_INFO_LVL_9,
181+
MCA_BASE_VAR_SCOPE_READONLY,
182+
storage);
183+
}
184+
170185
static inline void mca_spml_ikrit_param_register_string(const char* param_name,
171186
char* default_value,
172187
const char *help_msg,
@@ -230,6 +245,9 @@ static int mca_spml_ikrit_component_register(void)
230245
&mca_spml_ikrit.unsync_conn_max);
231246
#endif
232247

248+
mca_spml_ikrit_param_register_size_t("put_zcopy_threshold", 16384ULL,
249+
"[size_t] Use zero copy put if message size is greater than the threshold",
250+
&mca_spml_ikrit.put_zcopy_threshold);
233251
if (oshmem_num_procs() < mca_spml_ikrit.np) {
234252
SPML_VERBOSE(1,
235253
"Not enough ranks (%d<%d), disqualifying spml/ikrit",

0 commit comments

Comments
 (0)