Skip to content

Commit bd84165

Browse files
author
Sergey Oblomov
committed
ATOMICS: renamed atomic calls to unsigned datatypes
Signed-off-by: Sergey Oblomov <sergeyo@mellanox.com>
1 parent 9d3a799 commit bd84165

File tree

12 files changed

+294
-232
lines changed

12 files changed

+294
-232
lines changed

oshmem/include/pshmem.h

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -379,39 +379,39 @@ OSHMEM_DECLSPEC long long pshmem_longlong_fadd(long long *target, long long valu
379379
#endif
380380

381381
/* Atomic Fetch&And */
382-
OSHMEM_DECLSPEC int pshmem_int_atomic_fand(int *target, int value, int pe);
383-
OSHMEM_DECLSPEC long pshmem_long_atomic_fand(long *target, long value, int pe);
384-
OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fand(long long *target, long long value, int pe);
385-
#if OSHMEMP_HAVE_C11
386-
#define pshmem_atomic_fand(dst, val, pe) \
387-
_Generic(&*(dst), \
388-
int*: pshmem_int_atomic_fand, \
389-
long*: pshmem_long_atomic_fand, \
390-
long long*: pshmem_longlong_atomic_fand)(dst, val, pe)
382+
OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe);
383+
OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe);
384+
OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe);
385+
#if OSHMEM_HAVE_C11
386+
#define pshmem_atomic_fetch_and(dst, val, pe) \
387+
_Generic(&*(dst), \
388+
unsigned int*: pshmem_uint_atomic_fetch_and, \
389+
unsigned long*: pshmem_ulong_atomic_fetch_and, \
390+
unsigned long long*: pshmem_ulonglong_atomic_fetch_and)(dst, val, pe)
391391
#endif
392392

393393
/* Atomic Fetch&Or */
394-
OSHMEM_DECLSPEC int pshmem_int_atomic_for(int *target, int value, int pe);
395-
OSHMEM_DECLSPEC long pshmem_long_atomic_for(long *target, long value, int pe);
396-
OSHMEM_DECLSPEC long long pshmem_longlong_atomic_for(long long *target, long long value, int pe);
397-
#if OSHMEMP_HAVE_C11
398-
#define pshmem_atomic_for(dst, val, pe) \
399-
_Generic(&*(dst), \
400-
int*: pshmem_int_atomic_for, \
401-
long*: pshmem_long_atomic_for, \
402-
long long*: pshmem_longlong_atomic_for)(dst, val, pe)
394+
OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe);
395+
OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe);
396+
OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe);
397+
#if OSHMEM_HAVE_C11
398+
#define pshmem_atomic_fetch_or(dst, val, pe) \
399+
_Generic(&*(dst), \
400+
unsigned int*: pshmem_uint_atomic_fetch_or, \
401+
unsigned long*: pshmem_ulong_atomic_fetch_or, \
402+
unsigned long long*: pshmem_ulonglong_atomic_fetch_or)(dst, val, pe)
403403
#endif
404404

405405
/* Atomic Fetch&Xor */
406-
OSHMEM_DECLSPEC int pshmem_int_atomic_fxor(int *target, int value, int pe);
407-
OSHMEM_DECLSPEC long pshmem_long_atomic_fxor(long *target, long value, int pe);
408-
OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fxor(long long *target, long long value, int pe);
409-
#if OSHMEMP_HAVE_C11
410-
#define pshmem_atomic_fxor(dst, val, pe) \
411-
_Generic(&*(dst), \
412-
int*: pshmem_int_atomic_fxor, \
413-
long*: pshmem_long_atomic_fxor, \
414-
long long*: pshmem_longlong_atomic_fxor)(dst, val, pe)
406+
OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe);
407+
OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe);
408+
OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe);
409+
#if OSHMEM_HAVE_C11
410+
#define pshmem_atomic_fetch_xor(dst, val, pe) \
411+
_Generic(&*(dst), \
412+
unsigned int*: pshmem_uint_atomic_fetch_xor, \
413+
unsigned long*: pshmem_ulong_atomic_fetch_xor, \
414+
unsigned long long*: pshmem_ulonglong_atomic_fetch_xor)(dst, val, pe)
415415
#endif
416416

417417
/* Atomic Fetch */
@@ -455,39 +455,39 @@ OSHMEM_DECLSPEC void pshmem_longlong_add(long long *target, long long value, int
455455
#endif
456456

457457
/* Atomic And */
458-
OSHMEM_DECLSPEC void pshmem_int_atomic_and(int *target, int value, int pe);
459-
OSHMEM_DECLSPEC void pshmem_long_atomic_and(long *target, long value, int pe);
460-
OSHMEM_DECLSPEC void pshmem_longlong_atomic_and(long long *target, long long value, int pe);
461-
#if OSHMEMP_HAVE_C11
462-
#define pshmem_atomic_and(dst, val, pe) \
463-
_Generic(&*(dst), \
464-
int*: pshmem_int_atomic_and, \
465-
long*: pshmem_long_atomic_and, \
466-
long long*: pshmem_longlong_atomic_and)(dst, val, pe)
458+
OSHMEM_DECLSPEC void pshmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe);
459+
OSHMEM_DECLSPEC void pshmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe);
460+
OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe);
461+
#if OSHMEM_HAVE_C11
462+
#define pshmem_atomic_and(dst, val, pe) \
463+
_Generic(&*(dst), \
464+
unsigned int*: pshmem_uint_atomic_and, \
465+
unsigned iong*: pshmem_ulong_atomic_and, \
466+
unsigned iong long*: pshmem_ulonglong_atomic_and)(dst, val, pe)
467467
#endif
468468

469469
/* Atomic Or */
470-
OSHMEM_DECLSPEC void pshmem_int_atomic_or(int *target, int value, int pe);
471-
OSHMEM_DECLSPEC void pshmem_long_atomic_or(long *target, long value, int pe);
472-
OSHMEM_DECLSPEC void pshmem_longlong_atomic_or(long long *target, long long value, int pe);
473-
#if OSHMEMP_HAVE_C11
474-
#define pshmem_atomic_or(dst, val, pe) \
475-
_Generic(&*(dst), \
476-
int*: pshmem_int_atomic_or, \
477-
long*: pshmem_long_atomic_or, \
478-
long long*: pshmem_longlong_atomic_or)(dst, val, pe)
470+
OSHMEM_DECLSPEC void pshmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe);
471+
OSHMEM_DECLSPEC void pshmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe);
472+
OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe);
473+
#if OSHMEM_HAVE_C11
474+
#define pshmem_atomic_or(dst, val, pe) \
475+
_Generic(&*(dst), \
476+
unsigned int*: pshmem_uint_atomic_or, \
477+
unsigned iong*: pshmem_ulong_atomic_or, \
478+
unsigned iong long*: pshmem_ulonglong_atomic_or)(dst, val, pe)
479479
#endif
480480

481481
/* Atomic Xor */
482-
OSHMEM_DECLSPEC void pshmem_int_atomic_xor(int *target, int value, int pe);
483-
OSHMEM_DECLSPEC void pshmem_long_atomic_xor(long *target, long value, int pe);
484-
OSHMEM_DECLSPEC void pshmem_longlong_atomic_xor(long long *target, long long value, int pe);
485-
#if OSHMEMP_HAVE_C11
486-
#define pshmem_atomic_xor(dst, val, pe) \
487-
_Generic(&*(dst), \
488-
int*: pshmem_int_atomic_xor, \
489-
long*: pshmem_long_atomic_xor, \
490-
long long*: pshmem_longlong_atomic_xor)(dst, val, pe)
482+
OSHMEM_DECLSPEC void pshmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe);
483+
OSHMEM_DECLSPEC void pshmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe);
484+
OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe);
485+
#if OSHMEM_HAVE_C11
486+
#define pshmem_atomic_xor(dst, val, pe) \
487+
_Generic(&*(dst), \
488+
unsigned int*: pshmem_uint_atomic_xor, \
489+
unsigned iong*: pshmem_ulong_atomic_xor, \
490+
unsigned iong long*: pshmem_ulonglong_atomic_xor)(dst, val, pe)
491491
#endif
492492

493493
/* Atomic Inc */

oshmem/include/pshmemx.h

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,22 @@ OSHMEM_DECLSPEC int32_t pshmemx_int32_fadd(int32_t *target, int32_t value, int p
9090
OSHMEM_DECLSPEC int64_t pshmemx_int64_fadd(int64_t *target, int64_t value, int pe);
9191

9292
/* Atomic Fetch&And */
93-
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fand(int32_t *target, int32_t value, int pe);
94-
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fand(int64_t *target, int64_t value, int pe);
93+
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fetch_and(int32_t *target, int32_t value, int pe);
94+
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fetch_and(int64_t *target, int64_t value, int pe);
95+
OSHMEM_DECLSPEC uint32_t pshmemx_uint32_atomic_fetch_and(uint32_t *target, uint32_t value, int pe);
96+
OSHMEM_DECLSPEC uint64_t pshmemx_uint64_atomic_fetch_and(uint64_t *target, uint64_t value, int pe);
9597

9698
/* Atomic Fetch&Or */
97-
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_for(int32_t *target, int32_t value, int pe);
98-
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_for(int64_t *target, int64_t value, int pe);
99+
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fetch_or(int32_t *target, int32_t value, int pe);
100+
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fetch_or(int64_t *target, int64_t value, int pe);
101+
OSHMEM_DECLSPEC uint32_t pshmemx_uint32_atomic_fetch_or(uint32_t *target, uint32_t value, int pe);
102+
OSHMEM_DECLSPEC uint64_t pshmemx_uint64_atomic_fetch_or(uint64_t *target, uint64_t value, int pe);
99103

100104
/* Atomic Fetch&Xor */
101-
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fxor(int32_t *target, int32_t value, int pe);
102-
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fxor(int64_t *target, int64_t value, int pe);
105+
OSHMEM_DECLSPEC int32_t pshmemx_int32_atomic_fetch_xor(int32_t *target, int32_t value, int pe);
106+
OSHMEM_DECLSPEC int64_t pshmemx_int64_atomic_fetch_xor(int64_t *target, int64_t value, int pe);
107+
OSHMEM_DECLSPEC uint32_t pshmemx_uint32_atomic_fetch_xor(uint32_t *target, uint32_t value, int pe);
108+
OSHMEM_DECLSPEC uint64_t pshmemx_uint64_atomic_fetch_xor(uint64_t *target, uint64_t value, int pe);
103109

104110
/* Atomic Fetch */
105111
OSHMEM_DECLSPEC int32_t pshmemx_int32_fetch(const int32_t *target, int pe);
@@ -116,14 +122,20 @@ OSHMEM_DECLSPEC void pshmemx_int64_add(int64_t *target, int64_t value, int pe);
116122
/* Atomic And */
117123
OSHMEM_DECLSPEC void pshmemx_int32_atomic_and(int32_t *target, int32_t value, int pe);
118124
OSHMEM_DECLSPEC void pshmemx_int64_atomic_and(int64_t *target, int64_t value, int pe);
125+
OSHMEM_DECLSPEC void pshmemx_uint32_atomic_and(uint32_t *target, uint32_t value, int pe);
126+
OSHMEM_DECLSPEC void pshmemx_uint64_atomic_and(uint64_t *target, uint64_t value, int pe);
119127

120128
/* Atomic Or */
121129
OSHMEM_DECLSPEC void pshmemx_int32_atomic_or(int32_t *target, int32_t value, int pe);
122130
OSHMEM_DECLSPEC void pshmemx_int64_atomic_or(int64_t *target, int64_t value, int pe);
131+
OSHMEM_DECLSPEC void pshmemx_uint32_atomic_or(uint32_t *target, uint32_t value, int pe);
132+
OSHMEM_DECLSPEC void pshmemx_uint64_atomic_or(uint64_t *target, uint64_t value, int pe);
123133

124134
/* Atomic Xor */
125135
OSHMEM_DECLSPEC void pshmemx_int32_atomic_xor(int32_t *target, int32_t value, int pe);
126136
OSHMEM_DECLSPEC void pshmemx_int64_atomic_xor(int64_t *target, int64_t value, int pe);
137+
OSHMEM_DECLSPEC void pshmemx_uint32_atomic_xor(uint32_t *target, uint32_t value, int pe);
138+
OSHMEM_DECLSPEC void pshmemx_uint64_atomic_xor(uint64_t *target, uint64_t value, int pe);
127139

128140
/* Atomic Inc */
129141
OSHMEM_DECLSPEC void pshmemx_int32_inc(int32_t *target, int pe);

oshmem/include/shmem.h.in

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -464,39 +464,39 @@ OSHMEM_DECLSPEC long long shmem_longlong_fadd(long long *target, long long value
464464
#endif
465465

466466
/* Atomic Fetch&And */
467-
OSHMEM_DECLSPEC int shmem_int_atomic_fand(int *target, int value, int pe);
468-
OSHMEM_DECLSPEC long shmem_long_atomic_fand(long *target, long value, int pe);
469-
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fand(long long *target, long long value, int pe);
467+
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe);
468+
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe);
469+
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe);
470470
#if OSHMEM_HAVE_C11
471-
#define shmem_atomic_fand(dst, val, pe) \
472-
_Generic(&*(dst), \
473-
int*: shmem_int_atomic_fand, \
474-
long*: shmem_long_atomic_fand, \
475-
long long*: shmem_longlong_atomic_fand)(dst, val, pe)
471+
#define shmem_atomic_fetch_and(dst, val, pe) \
472+
_Generic(&*(dst), \
473+
unsigned int*: shmem_uint_atomic_fetch_and, \
474+
unsigned long*: shmem_ulong_atomic_fetch_and, \
475+
unsigned long long*: shmem_ulonglong_atomic_fetch_and)(dst, val, pe)
476476
#endif
477477

478478
/* Atomic Fetch&Or */
479-
OSHMEM_DECLSPEC int shmem_int_atomic_for(int *target, int value, int pe);
480-
OSHMEM_DECLSPEC long shmem_long_atomic_for(long *target, long value, int pe);
481-
OSHMEM_DECLSPEC long long shmem_longlong_atomic_for(long long *target, long long value, int pe);
479+
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe);
480+
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe);
481+
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe);
482482
#if OSHMEM_HAVE_C11
483-
#define shmem_atomic_for(dst, val, pe) \
484-
_Generic(&*(dst), \
485-
int*: shmem_int_atomic_for, \
486-
long*: shmem_long_atomic_for, \
487-
long long*: shmem_longlong_atomic_for)(dst, val, pe)
483+
#define shmem_atomic_fetch_or(dst, val, pe) \
484+
_Generic(&*(dst), \
485+
unsigned int*: shmem_uint_atomic_fetch_or, \
486+
unsigned long*: shmem_ulong_atomic_fetch_or, \
487+
unsigned long long*: shmem_ulonglong_atomic_fetch_or)(dst, val, pe)
488488
#endif
489489

490490
/* Atomic Fetch&Xor */
491-
OSHMEM_DECLSPEC int shmem_int_atomic_fxor(int *target, int value, int pe);
492-
OSHMEM_DECLSPEC long shmem_long_atomic_fxor(long *target, long value, int pe);
493-
OSHMEM_DECLSPEC long long shmem_longlong_atomic_fxor(long long *target, long long value, int pe);
491+
OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe);
492+
OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe);
493+
OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe);
494494
#if OSHMEM_HAVE_C11
495-
#define shmem_atomic_fxor(dst, val, pe) \
496-
_Generic(&*(dst), \
497-
int*: shmem_int_atomic_fxor, \
498-
long*: shmem_long_atomic_fxor, \
499-
long long*: shmem_longlong_atomic_fxor)(dst, val, pe)
495+
#define shmem_atomic_fetch_xor(dst, val, pe) \
496+
_Generic(&*(dst), \
497+
unsigned int*: shmem_uint_atomic_fetch_xor, \
498+
unsigned long*: shmem_ulong_atomic_fetch_xor, \
499+
unsigned long long*: shmem_ulonglong_atomic_fetch_xor)(dst, val, pe)
500500
#endif
501501

502502
/* Atomic Fetch */
@@ -540,39 +540,39 @@ OSHMEM_DECLSPEC void shmem_longlong_add(long long *target, long long value, int
540540
#endif
541541

542542
/* Atomic And */
543-
OSHMEM_DECLSPEC void shmem_int_atomic_and(int *target, int value, int pe);
544-
OSHMEM_DECLSPEC void shmem_long_atomic_and(long *target, long value, int pe);
545-
OSHMEM_DECLSPEC void shmem_longlong_atomic_and(long long *target, long long value, int pe);
543+
OSHMEM_DECLSPEC void shmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe);
544+
OSHMEM_DECLSPEC void shmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe);
545+
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe);
546546
#if OSHMEM_HAVE_C11
547547
#define shmem_atomic_and(dst, val, pe) \
548548
_Generic(&*(dst), \
549-
int*: shmem_int_atomic_and, \
550-
long*: shmem_long_atomic_and, \
551-
long long*: shmem_longlong_atomic_and)(dst, val, pe)
549+
unsigned int*: shmem_uint_atomic_and, \
550+
unsigned iong*: shmem_ulong_atomic_and, \
551+
unsigned iong long*: shmem_ulonglong_atomic_and)(dst, val, pe)
552552
#endif
553553

554554
/* Atomic Or */
555-
OSHMEM_DECLSPEC void shmem_int_atomic_or(int *target, int value, int pe);
556-
OSHMEM_DECLSPEC void shmem_long_atomic_or(long *target, long value, int pe);
557-
OSHMEM_DECLSPEC void shmem_longlong_atomic_or(long long *target, long long value, int pe);
555+
OSHMEM_DECLSPEC void shmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe);
556+
OSHMEM_DECLSPEC void shmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe);
557+
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe);
558558
#if OSHMEM_HAVE_C11
559559
#define shmem_atomic_or(dst, val, pe) \
560560
_Generic(&*(dst), \
561-
int*: shmem_int_atomic_or, \
562-
long*: shmem_long_atomic_or, \
563-
long long*: shmem_longlong_atomic_or)(dst, val, pe)
561+
unsigned int*: shmem_uint_atomic_or, \
562+
unsigned iong*: shmem_ulong_atomic_or, \
563+
unsigned iong long*: shmem_ulonglong_atomic_or)(dst, val, pe)
564564
#endif
565565

566566
/* Atomic Xor */
567-
OSHMEM_DECLSPEC void shmem_int_atomic_xor(int *target, int value, int pe);
568-
OSHMEM_DECLSPEC void shmem_long_atomic_xor(long *target, long value, int pe);
569-
OSHMEM_DECLSPEC void shmem_longlong_atomic_xor(long long *target, long long value, int pe);
567+
OSHMEM_DECLSPEC void shmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe);
568+
OSHMEM_DECLSPEC void shmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe);
569+
OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe);
570570
#if OSHMEM_HAVE_C11
571571
#define shmem_atomic_xor(dst, val, pe) \
572572
_Generic(&*(dst), \
573-
int*: shmem_int_atomic_xor, \
574-
long*: shmem_long_atomic_xor, \
575-
long long*: shmem_longlong_atomic_xor)(dst, val, pe)
573+
unsigned int*: shmem_uint_atomic_xor, \
574+
unsigned iong*: shmem_ulong_atomic_xor, \
575+
unsigned iong long*: shmem_ulonglong_atomic_xor)(dst, val, pe)
576576
#endif
577577

578578
/* Atomic Inc */

0 commit comments

Comments
 (0)