Skip to content

Commit f3ebc45

Browse files
committed
TL/UCP: non zero versions
1 parent 0750a5c commit f3ebc45

File tree

3 files changed

+97
-25
lines changed

3 files changed

+97
-25
lines changed

src/components/tl/ucp/tl_ucp.h

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ typedef ucc_status_t (*ucc_tl_ucp_copy_test_fn_t)(ucc_tl_ucp_context_t *ctx,
143143
ucc_tl_ucp_copy_task_t *copy_task);
144144
typedef ucc_status_t (*ucc_tl_ucp_copy_finalize_fn_t)(ucc_tl_ucp_copy_task_t *copy_task);
145145

146-
147-
148146
typedef struct ucc_tl_ucp_team {
149147
ucc_tl_team_t super;
150148
ucc_status_t status;
@@ -163,20 +161,38 @@ typedef struct ucc_tl_ucp_team {
163161
UCC_CLASS_DECLARE(ucc_tl_ucp_team_t, ucc_base_context_t *,
164162
const ucc_base_team_params_t *);
165163

166-
typedef ucc_status_t (*ucc_tl_ucp_send_nb_fn_t)(void *buffer, size_t msglen, ucc_memory_type_t mtype,
167-
ucc_rank_t dest_group_rank, ucc_tl_ucp_team_t *team,
168-
ucc_tl_ucp_task_t *task);
169-
typedef ucc_status_t (*ucc_tl_ucp_recv_nb_fn_t)(void *buffer, size_t msglen, ucc_memory_type_t mtype,
170-
ucc_rank_t dest_group_rank, ucc_tl_ucp_team_t *team,
171-
ucc_tl_ucp_task_t *task);
164+
typedef ucc_status_t (*ucc_tl_ucp_send_nb_fn_t)(void *buffer, size_t msglen,
165+
ucc_memory_type_t mtype,
166+
ucc_rank_t dest_group_rank,
167+
ucc_tl_ucp_team_t *team,
168+
ucc_tl_ucp_task_t *task);
169+
typedef ucc_status_t (*ucc_tl_ucp_recv_nb_fn_t)(void *buffer, size_t msglen,
170+
ucc_memory_type_t mtype,
171+
ucc_rank_t dest_group_rank,
172+
ucc_tl_ucp_team_t *team,
173+
ucc_tl_ucp_task_t *task);
174+
175+
typedef ucc_status_t (*ucc_tl_ucp_recv_nz_fn_t)(void *buffer, size_t msglen,
176+
ucc_memory_type_t mtype,
177+
ucc_rank_t dest_group_rank,
178+
ucc_tl_ucp_team_t *team,
179+
ucc_tl_ucp_task_t *task);
180+
181+
typedef ucc_status_t (*ucc_tl_ucp_send_nz_fn_t)(void *buffer, size_t msglen,
182+
ucc_memory_type_t mtype,
183+
ucc_rank_t dest_group_rank,
184+
ucc_tl_ucp_team_t *team,
185+
ucc_tl_ucp_task_t *task);
172186
typedef struct ucc_tl_ucp_context {
173187
ucc_tl_context_t super;
174188
ucc_tl_ucp_context_config_t cfg;
175189
ucc_tl_ucp_worker_t worker;
176190
ucc_tl_ucp_worker_t service_worker;
177191
struct {
178-
ucc_tl_ucp_send_nb_fn_t ucc_tl_ucp_send_nb;
179-
ucc_tl_ucp_recv_nb_fn_t ucc_tl_ucp_recv_nb;
192+
ucc_tl_ucp_send_nb_fn_t ucc_tl_ucp_send_nb;
193+
ucc_tl_ucp_recv_nb_fn_t ucc_tl_ucp_recv_nb;
194+
ucc_tl_ucp_send_nz_fn_t ucc_tl_ucp_send_nz;
195+
ucc_tl_ucp_recv_nz_fn_t ucc_tl_ucp_recv_nz;
180196
} callbacks;
181197
uint32_t service_worker_throttling_count;
182198
ucc_mpool_t req_mp;

src/components/tl/ucp/tl_ucp_context.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,15 @@ UCC_CLASS_INIT_FUNC(ucc_tl_ucp_context_t,
219219
worker_params.thread_mode = UCS_THREAD_MODE_SINGLE;
220220
self->callbacks.ucc_tl_ucp_send_nb = ucc_tl_ucp_send_nb_st;
221221
self->callbacks.ucc_tl_ucp_recv_nb = ucc_tl_ucp_recv_nb_st;
222+
self->callbacks.ucc_tl_ucp_send_nz = ucc_tl_ucp_send_nz_st;
223+
self->callbacks.ucc_tl_ucp_recv_nz = ucc_tl_ucp_recv_nz_st;
222224
break;
223225
case UCC_THREAD_MULTIPLE:
224226
worker_params.thread_mode = UCS_THREAD_MODE_MULTI;
225227
self->callbacks.ucc_tl_ucp_send_nb = ucc_tl_ucp_send_nb_mt;
226-
self->callbacks.ucc_tl_ucp_recv_nb = ucc_tl_ucp_recv_nb_mt;
228+
self->callbacks.ucc_tl_ucp_recv_nb = ucc_tl_ucp_recv_nb_mt;
229+
self->callbacks.ucc_tl_ucp_send_nz = ucc_tl_ucp_send_nz_mt;
230+
self->callbacks.ucc_tl_ucp_recv_nz = ucc_tl_ucp_recv_nz_mt;
227231
break;
228232
default:
229233
/* unreachable */

src/components/tl/ucp/tl_ucp_sendrecv.h

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,35 +253,87 @@ ucc_tl_ucp_recv_cb(void *buffer, size_t msglen, ucc_memory_type_t mtype,
253253
}
254254

255255
/* Non-Zero recv: if msglen == 0 then it is a no-op */
256-
static inline ucc_status_t ucc_tl_ucp_recv_nz(void *buffer, size_t msglen,
257-
ucc_memory_type_t mtype,
258-
ucc_rank_t dest_group_rank,
259-
ucc_tl_ucp_team_t *team,
260-
ucc_tl_ucp_task_t *task)
256+
static inline ucc_status_t ucc_tl_ucp_recv_nz_mt(void *buffer, size_t msglen,
257+
ucc_memory_type_t mtype,
258+
ucc_rank_t dest_group_rank,
259+
ucc_tl_ucp_team_t *team,
260+
ucc_tl_ucp_task_t *task)
261261
{
262262
if (msglen == 0) {
263263
task->tagged.recv_posted++;
264264
ucc_atomic_add32(&task->tagged.recv_completed, 1);
265265
return UCC_OK;
266266
}
267-
return ucc_tl_ucp_recv_nb(buffer, msglen, mtype,
268-
dest_group_rank, team, task);
267+
return ucc_tl_ucp_recv_nb_mt(buffer, msglen, mtype, dest_group_rank, team,
268+
task);
269+
}
270+
271+
/* Non-Zero recv: if msglen == 0 then it is a no-op */
272+
static inline ucc_status_t ucc_tl_ucp_recv_nz_st(void *buffer, size_t msglen,
273+
ucc_memory_type_t mtype,
274+
ucc_rank_t dest_group_rank,
275+
ucc_tl_ucp_team_t *team,
276+
ucc_tl_ucp_task_t *task)
277+
{
278+
if (msglen == 0) {
279+
task->tagged.recv_posted++;
280+
task->tagged.recv_completed++;
281+
return UCC_OK;
282+
}
283+
return ucc_tl_ucp_recv_nb_st(buffer, msglen, mtype, dest_group_rank, team,
284+
task);
269285
}
270286

271287
/* Non-Zero send: if msglen == 0 then it is a no-op */
272-
static inline ucc_status_t ucc_tl_ucp_send_nz(void *buffer, size_t msglen,
273-
ucc_memory_type_t mtype,
274-
ucc_rank_t dest_group_rank,
275-
ucc_tl_ucp_team_t *team,
276-
ucc_tl_ucp_task_t *task)
288+
static inline ucc_status_t ucc_tl_ucp_send_nz_mt(void *buffer, size_t msglen,
289+
ucc_memory_type_t mtype,
290+
ucc_rank_t dest_group_rank,
291+
ucc_tl_ucp_team_t *team,
292+
ucc_tl_ucp_task_t *task)
277293
{
278294
if (msglen == 0) {
279295
task->tagged.send_posted++;
280296
ucc_atomic_add32(&task->tagged.send_completed, 1);
281297
return UCC_OK;
282298
}
283-
return ucc_tl_ucp_send_nb(buffer, msglen, mtype,
284-
dest_group_rank, team, task);
299+
return ucc_tl_ucp_send_nb_mt(buffer, msglen, mtype, dest_group_rank, team,
300+
task);
301+
}
302+
303+
/* Non-Zero send: if msglen == 0 then it is a no-op */
304+
static inline ucc_status_t ucc_tl_ucp_send_nz_st(void *buffer, size_t msglen,
305+
ucc_memory_type_t mtype,
306+
ucc_rank_t dest_group_rank,
307+
ucc_tl_ucp_team_t *team,
308+
ucc_tl_ucp_task_t *task)
309+
{
310+
if (msglen == 0) {
311+
task->tagged.send_posted++;
312+
task->tagged.send_completed++;
313+
return UCC_OK;
314+
}
315+
return ucc_tl_ucp_send_nb_st(buffer, msglen, mtype, dest_group_rank, team,
316+
task);
317+
}
318+
319+
static inline ucc_status_t ucc_tl_ucp_send_nz(void *buffer, size_t msglen,
320+
ucc_memory_type_t mtype,
321+
ucc_rank_t dest_group_rank,
322+
ucc_tl_ucp_team_t *team,
323+
ucc_tl_ucp_task_t *task)
324+
{
325+
return UCC_TL_UCP_TEAM_CTX(team)->callbacks.ucc_tl_ucp_send_nz(
326+
buffer, msglen, mtype, dest_group_rank, team, task);
327+
}
328+
329+
static inline ucc_status_t ucc_tl_ucp_recv_nz(void *buffer, size_t msglen,
330+
ucc_memory_type_t mtype,
331+
ucc_rank_t dest_group_rank,
332+
ucc_tl_ucp_team_t *team,
333+
ucc_tl_ucp_task_t *task)
334+
{
335+
return UCC_TL_UCP_TEAM_CTX(team)->callbacks.ucc_tl_ucp_recv_nz(
336+
buffer, msglen, mtype, dest_group_rank, team, task);
285337
}
286338

287339
static inline ucc_status_t

0 commit comments

Comments
 (0)