Skip to content

Commit 707f233

Browse files
committed
OSHMEM/MCA/SPML/UCX: added a fence in the nb API, fixed mca_spml_ucx_signal_common
Signed-off-by: Roie Danino <[email protected]>
1 parent 63dbb0e commit 707f233

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,25 +1648,31 @@ static inline int mca_spml_ucx_signal_common(shmem_ctx_t ctx,
16481648
uint64_t *sig_addr,
16491649
uint64_t signal,
16501650
int sig_op,
1651-
int dst)
1651+
int dst,
1652+
int blocking)
16521653
{
1653-
int res;
1654-
uint64_t dummy_prev;
1654+
uint64_t dummy_prev, dummy_fetch;
16551655

16561656
if (sig_op == SHMEM_SIGNAL_SET) {
16571657
/* Use atomic swap to set the signal value */
1658-
res = MCA_ATOMIC_CALL(swap(ctx, (void*)sig_addr, (void*)&dummy_prev,
1658+
if (blocking) {
1659+
return MCA_ATOMIC_CALL(swap(ctx, (void*)sig_addr, (void*)&dummy_prev,
1660+
signal, sizeof(uint64_t), dst));
1661+
}
1662+
return MCA_ATOMIC_CALL(swap_nb(ctx, &dummy_fetch, (void*)sig_addr, (void*)&dummy_prev,
16591663
signal, sizeof(uint64_t), dst));
16601664
} else if (sig_op == SHMEM_SIGNAL_ADD) {
16611665
/* Use atomic add to add the signal value */
1662-
res = MCA_ATOMIC_CALL(add(ctx, (void*)sig_addr, signal,
1666+
if (blocking) {
1667+
return MCA_ATOMIC_CALL(add(ctx, (void*)sig_addr, signal,
16631668
sizeof(uint64_t), dst));
1664-
} else {
1665-
SPML_UCX_ERROR("Invalid signal operation: %d", sig_op);
1666-
return OSHMEM_ERROR;
1669+
}
1670+
return MCA_ATOMIC_CALL(fadd_nb(ctx, &dummy_fetch, (void*)sig_addr, (void*)&dummy_prev,
1671+
signal, sizeof(uint64_t), dst));
16671672
}
16681673

1669-
return res;
1674+
SPML_UCX_ERROR("Invalid signal operation: %d", sig_op);
1675+
return OSHMEM_ERR_NOT_IMPLEMENTED;
16701676
}
16711677

16721678
int mca_spml_ucx_put_signal(shmem_ctx_t ctx, void* dst_addr, size_t size, void*
@@ -1679,7 +1685,12 @@ int mca_spml_ucx_put_signal(shmem_ctx_t ctx, void* dst_addr, size_t size, void*
16791685
return res;
16801686
}
16811687

1682-
return mca_spml_ucx_signal_common(ctx, sig_addr, signal, sig_op, dst);
1688+
res = mca_spml_ucx_fence(ctx);
1689+
if (OPAL_UNLIKELY(OSHMEM_SUCCESS != res)) {
1690+
return res;
1691+
}
1692+
1693+
return mca_spml_ucx_signal_common(ctx, sig_addr, signal, sig_op, dst, 1);
16831694
}
16841695

16851696
int mca_spml_ucx_put_signal_nb(shmem_ctx_t ctx, void* dst_addr, size_t size,
@@ -1693,7 +1704,12 @@ int mca_spml_ucx_put_signal_nb(shmem_ctx_t ctx, void* dst_addr, size_t size,
16931704
return res;
16941705
}
16951706

1696-
return mca_spml_ucx_signal_common(ctx, sig_addr, signal, sig_op, dst);
1707+
res = mca_spml_ucx_fence(ctx);
1708+
if (OPAL_UNLIKELY(OSHMEM_SUCCESS != res)) {
1709+
return res;
1710+
}
1711+
1712+
return mca_spml_ucx_signal_common(ctx, sig_addr, signal, sig_op, dst, 0);
16971713
}
16981714

16991715
/* This routine is not implemented */

0 commit comments

Comments
 (0)