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

Add support for transmission side multiplexing of messages #1126

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
105 changes: 74 additions & 31 deletions src/atomic_c.c4

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions src/atomic_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ FC_SHMEM_SWAP(fortran_integer_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, SIZEOF_FORTRAN_INTEGER);

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, value, &newval, SIZEOF_FORTRAN_INTEGER,
*pe, SHM_INTERNAL_FORTRAN_INTEGER);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_FORTRAN_INTEGER, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -64,8 +64,8 @@ FC_SHMEM_INT4_SWAP(int32_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, 4);

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, value, &newval, 4,
*pe, SHM_INTERNAL_INT32);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_INT32, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -87,8 +87,8 @@ FC_SHMEM_INT8_SWAP(int64_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, 8);

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, value, &newval, 8,
*pe, SHM_INTERNAL_INT64);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_INT64, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -112,8 +112,8 @@ FC_SHMEM_REAL4_SWAP(float *target,
shmem_internal_assert(sizeof(float) == 4);

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, value, &newval, 4,
*pe, SHM_INTERNAL_FLOAT);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_FLOAT, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -137,8 +137,8 @@ FC_SHMEM_REAL8_SWAP(double *target,
shmem_internal_assert(sizeof(double) == 8);

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, value, &newval, 8,
*pe, SHM_INTERNAL_DOUBLE);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_DOUBLE, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -163,8 +163,8 @@ FC_SHMEM_INT4_CSWAP(int32_t *target,

shmem_internal_cswap(SHMEM_CTX_DEFAULT, target, value, &newval, cond,
4,
*pe, SHM_INTERNAL_INT32);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_INT32, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -189,8 +189,8 @@ FC_SHMEM_INT8_CSWAP(int64_t *target,

shmem_internal_cswap(SHMEM_CTX_DEFAULT, target, value, &newval, cond,
8,
*pe, SHM_INTERNAL_INT64);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_INT64, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return newval;
}

Expand All @@ -212,8 +212,8 @@ FC_SHMEM_INT4_FADD(int32_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, 4);

shmem_internal_fetch_atomic(SHMEM_CTX_DEFAULT, target, value, &oldval, 4,
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT32);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT32, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return oldval;
}

Expand All @@ -235,8 +235,8 @@ FC_SHMEM_INT8_FADD(int64_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, 8);

shmem_internal_fetch_atomic(SHMEM_CTX_DEFAULT, target, value, &oldval, 8,
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT64);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT64, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return oldval;
}

Expand All @@ -256,8 +256,8 @@ FC_SHMEM_INT4_FINC(int32_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, 4);

shmem_internal_fetch_atomic(SHMEM_CTX_DEFAULT, target, &tmp, &oldval, 4,
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT32);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT32, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return oldval;
}

Expand All @@ -277,8 +277,8 @@ FC_SHMEM_INT8_FINC(int64_t *target,
SHMEM_ERR_CHECK_SYMMETRIC(target, 8);

shmem_internal_fetch_atomic(SHMEM_CTX_DEFAULT, target, &tmp, &oldval, 8,
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT64);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
*pe, SHM_INTERNAL_SUM, SHM_INTERNAL_INT64, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);
return oldval;
}

Expand Down Expand Up @@ -373,8 +373,8 @@ FC_SHMEM_INT4_FETCH(int32_t *source,
SHMEM_ERR_CHECK_PE(*pe);
SHMEM_ERR_CHECK_SYMMETRIC(source, 4);

shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 4, *pe, SHM_INTERNAL_INT32);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 4, *pe, SHM_INTERNAL_INT32, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);

return val;
}
Expand All @@ -394,8 +394,8 @@ FC_SHMEM_INT8_FETCH(int64_t *source,
SHMEM_ERR_CHECK_PE(*pe);
SHMEM_ERR_CHECK_SYMMETRIC(source, 8);

shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 8, *pe, SHM_INTERNAL_INT64);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 8, *pe, SHM_INTERNAL_INT64, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);

return val;
}
Expand All @@ -417,8 +417,8 @@ FC_SHMEM_REAL4_FETCH(float *source,

shmem_internal_assert(sizeof(float) == 4);

shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 4, *pe, SHM_INTERNAL_INT32);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 4, *pe, SHM_INTERNAL_INT32, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);

return val;
}
Expand All @@ -440,8 +440,8 @@ FC_SHMEM_REAL8_FETCH(double *source,

shmem_internal_assert(sizeof(double) == 8);

shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 8, *pe, SHM_INTERNAL_INT64);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
shmem_internal_atomic_fetch(SHMEM_CTX_DEFAULT, &val, (void *) source, 8, *pe, SHM_INTERNAL_INT64, 0);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, 0);

return val;
}
Expand Down
42 changes: 34 additions & 8 deletions src/atomic_nbi_c.c4
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_swap_nbi(ctx, target, &value, fetch, \
sizeof(TYPE), pe, ITYPE); \
sizeof(TYPE), pe, ITYPE, \
nic_idx); \
}


Expand All @@ -137,8 +141,11 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_cswap_nbi(ctx, target, &value, fetch, &cond, \
sizeof(TYPE), pe, ITYPE); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
}


Expand All @@ -151,9 +158,12 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic_nbi(ctx, target, &tmp, fetch, \
sizeof(TYPE), pe, SHM_INTERNAL_SUM, \
ITYPE); \
ITYPE, nic_idx); \
}


Expand All @@ -165,9 +175,13 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic_nbi(ctx, target, &value, fetch, \
sizeof(TYPE), pe, \
SHM_INTERNAL_SUM, ITYPE); \
SHM_INTERNAL_SUM, ITYPE, \
nic_idx); \
}


Expand All @@ -179,8 +193,11 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(source, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_atomic_fetch(ctx, fetch, (void *) source, \
sizeof(TYPE), pe, ITYPE); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
}


Expand All @@ -192,9 +209,12 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic_nbi(ctx, target, &value, fetch, \
sizeof(TYPE), pe, SHM_INTERNAL_BXOR,\
ITYPE); \
ITYPE, nic_idx); \
}


Expand All @@ -206,9 +226,12 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic_nbi(ctx, target, &value, fetch, \
sizeof(TYPE), pe, SHM_INTERNAL_BAND,\
ITYPE); \
ITYPE, nic_idx); \
}


Expand All @@ -220,9 +243,12 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic_nbi(ctx, target, &value, fetch, \
sizeof(TYPE), pe, SHM_INTERNAL_BOR, \
ITYPE); \
ITYPE, nic_idx); \
}

/* Function prototype for v1.4 routines with the default context: */
Expand Down
Loading