commit 6345b3ec47081fec12740dceadf1221cc2a7228c
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sat Apr 8 14:38:04 2023 +0200

    Make socl use starpu macros for atomic operations

diff --git a/socl/src/cl_createkernel.c b/socl/src/cl_createkernel.c
index aaacc90450..b38eaf5b86 100644
--- a/socl/src/cl_createkernel.c
+++ b/socl/src/cl_createkernel.c
@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2021  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2010-2021, 2023  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -40,7 +40,7 @@ static void soclCreateKernel_task(void *data)
 	}
 
 	/* One worker creates argument structures */
-	if (__sync_bool_compare_and_swap(&k->num_args, 0, 666))
+	if (STARPU_BOOL_COMPARE_AND_SWAP(&k->num_args, 0, 666))
 	{
 		unsigned int i;
 		cl_uint num_args;
diff --git a/socl/src/event.c b/socl/src/event.c
index 23eb48bdcb..604371149f 100644
--- a/socl/src/event.c
+++ b/socl/src/event.c
@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2021  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2010-2021, 2023  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -24,7 +24,7 @@ int event_unique_id()
 {
 	static int id = 1;
 
-	return __sync_fetch_and_add(&id,1);
+	return STARPU_ATOMIC_ADD(&id,1) - 1;
 }
 
 /**
diff --git a/socl/src/gc.c b/socl/src/gc.c
index 1ec8bdef55..dab7625492 100644
--- a/socl/src/gc.c
+++ b/socl/src/gc.c
@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2022  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2010-2023  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  * Copyright (C) 2012       Vincent Danjean
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -114,7 +114,7 @@ int gc_entity_release_ex(entity e, const char * DEBUG_PARAM(caller))
 	DEBUG_MSG("[%s] Decrementing refcount of %s %p to ", caller, e->name, (void *)e);
 
 	/* Decrement reference count */
-	int refs = __sync_sub_and_fetch(&e->refs, 1);
+	int refs = STARPU_ATOMIC_ADD(&e->refs, -1);
 
 	DEBUG_MSG_NOHEAD("%d\n", refs);
 
@@ -187,7 +187,7 @@ void gc_entity_retain_ex(void *arg, const char * DEBUG_PARAM(caller))
 #ifdef DEBUG
 	int refs =
 #endif
-		__sync_add_and_fetch(&e->refs, 1);
+		STARPU_ATOMIC_ADD(&e->refs, 1);
 
 	DEBUG_MSG("[%s] Incrementing refcount of %s %p to %d\n", caller, e->name, e, refs);
 }
