Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal set add #1120

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "modules/tests-sos"]
path = modules/tests-sos
url = ../../openshmem-org/tests-sos.git
branch = main
url = ../../wrrobin/tests-sos.git
branch = "pr/signal_set_add"
12 changes: 12 additions & 0 deletions mpp/shmemx.h4
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ SHMEM_BIND_C11_RMA(`SHMEM_CTX_C11_GEN_IBGET', `, \') \
SHMEM_BIND_C11_RMA(`SHMEM_C11_GEN_IBGET', `, \') \
)(__VA_ARGS__)

#define shmemx_signal_set(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR_OR_SCALAR(SHMEM_C11_ARG0(__VA_ARGS__)), \
shmem_ctx_t: shmemx_ctx_signal_set, \
uint64_t*: shmemx_signal_set \
)(__VA_ARGS__)

#define shmemx_signal_add(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR_OR_SCALAR(SHMEM_C11_ARG0(__VA_ARGS__)), \
shmem_ctx_t: shmemx_ctx_signal_add, \
uint64_t*: shmemx_signal_add \
)(__VA_ARGS__)

#endif /* C11 */

#endif /* SHMEMX_H */
6 changes: 6 additions & 0 deletions mpp/shmemx_c_func.h4
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_pcntr_get_completed_read(shmem_ctx_
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_pcntr_get_completed_target(uint64_t *cntr_value);
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_pcntr_get_all(shmem_ctx_t ctx, shmemx_pcntr_t *pcntr);

/* Signal extensions */
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_signal_add(uint64_t *sig_addr, uint64_t signal, int pe);
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_ctx_signal_add(shmem_ctx_t ctx, uint64_t *sig_addr, uint64_t signal, int pe);
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_signal_set(uint64_t *sig_addr, uint64_t signal, int pe);
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_ctx_signal_set(shmem_ctx_t ctx, uint64_t *sig_addr, uint64_t signal, int pe);

/* Separate initializers */
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_heap_create(void *base, size_t size, int device_type, int device_index);
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_heap_preinit();
Expand Down
54 changes: 54 additions & 0 deletions src/data_c.c4
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ SHMEM_PROF_DEF_CTX_PUT_N_SIGNAL_NBI(`mem')
#define shmemx_ct_wait pshmemx_ct_wait
#pragma weak shmem_signal_fetch = pshmem_signal_fetch
#define shmem_signal_fetch pshmem_signal_fetch
#pragma weak shmemx_signal_add = pshmemx_signal_add
#define shmemx_signal_add pshmemx_signal_add
#pragma weak shmemx_signal_set = pshmemx_signal_set
#define shmemx_signal_set pshmemx_signal_set
#pragma weak shmemx_ctx_signal_add = pshmemx_ctx_signal_add
#define shmemx_ctx_signal_add pshmemx_ctx_signal_add
#pragma weak shmemx_ctx_signal_set = pshmemx_ctx_signal_set
#define shmemx_ctx_signal_set pshmemx_ctx_signal_set

#endif /* ENABLE_PROFILING */

Expand Down Expand Up @@ -866,6 +874,52 @@ shmem_signal_fetch(const uint64_t* sig_addr)
return val;
}

void SHMEM_FUNCTION_ATTRIBUTES
shmemx_signal_add(uint64_t *sig_addr, uint64_t signal, int pe)
{
SHMEM_ERR_CHECK_INITIALIZED();
SHMEM_ERR_CHECK_PE(pe);
SHMEM_ERR_CHECK_SYMMETRIC(sig_addr, sizeof(uint64_t));

shmem_internal_atomic(SHMEM_CTX_DEFAULT, sig_addr, &signal, sizeof(uint64_t),
pe, SHM_INTERNAL_SUM, SHM_INTERNAL_UINT64);
}

void SHMEM_FUNCTION_ATTRIBUTES
shmemx_ctx_signal_add(shmem_ctx_t ctx, uint64_t *sig_addr, uint64_t signal, int pe)
{
SHMEM_ERR_CHECK_INITIALIZED();
SHMEM_ERR_CHECK_PE(pe);
SHMEM_ERR_CHECK_CTX(ctx);
SHMEM_ERR_CHECK_SYMMETRIC(sig_addr, sizeof(uint64_t));

shmem_internal_atomic(ctx, sig_addr, &signal, sizeof(uint64_t),
pe, SHM_INTERNAL_SUM, SHM_INTERNAL_UINT64);
}

void SHMEM_FUNCTION_ATTRIBUTES
shmemx_signal_set(uint64_t *sig_addr, uint64_t signal, int pe)
{
SHMEM_ERR_CHECK_INITIALIZED();
SHMEM_ERR_CHECK_PE(pe);
SHMEM_ERR_CHECK_SYMMETRIC(sig_addr, sizeof(uint64_t));

shmem_internal_atomic_set(SHMEM_CTX_DEFAULT, (void *) sig_addr, &signal,
sizeof(uint64_t), pe, SHM_INTERNAL_UINT64);
}

void SHMEM_FUNCTION_ATTRIBUTES
shmemx_ctx_signal_set(shmem_ctx_t ctx, uint64_t *sig_addr, uint64_t signal, int pe)
{
SHMEM_ERR_CHECK_INITIALIZED();
SHMEM_ERR_CHECK_PE(pe);
SHMEM_ERR_CHECK_CTX(ctx);
SHMEM_ERR_CHECK_SYMMETRIC(sig_addr, sizeof(uint64_t));

shmem_internal_atomic_set(ctx, (void *) sig_addr, &signal,
sizeof(uint64_t), pe, SHM_INTERNAL_UINT64);
}

void SHMEM_FUNCTION_ATTRIBUTES
shmemx_getmem_ct(shmemx_ct_t ct, void *target, const void *source, size_t nelems, int pe)
{
Expand Down
Loading