Przeglądaj źródła

turn starpu_access_mode into an enumerated type

Nathalie Furmento 13 lat temu
rodzic
commit
adf2f44e62

+ 1 - 1
doc/chapters/advanced-api.texi

@@ -327,7 +327,7 @@ Returns an estimated speedup factor relative to CPU speed
 Returns expected data transfer time in µs
 @end deftypefun
 
-@deftypefun double starpu_data_expected_transfer_time (starpu_data_handle @var{handle}, unsigned @var{memory_node}, starpu_access_mode @var{mode})
+@deftypefun double starpu_data_expected_transfer_time (starpu_data_handle @var{handle}, unsigned @var{memory_node}, {enum starpu_access_mode} @var{mode})
 Predict the transfer time (in µs) to move a handle to a memory node
 @end deftypefun
 

+ 4 - 4
doc/chapters/basic-api.texi

@@ -284,7 +284,7 @@ This function frees memory which has previously allocated with
 @code{starpu_malloc}.
 @end deftypefun
 
-@deftp {Data Type} starpu_access_mode
+@deftp {Data Type} {enum starpu_access_mode}
 This datatype describes a data access mode. The different available modes are:
 @table @asis
 @item @code{STARPU_R}: read-only mode.
@@ -379,7 +379,7 @@ todo
 @node Access registered data from the application
 @subsection Access registered data from the application
 
-@deftypefun int starpu_data_acquire (starpu_data_handle @var{handle}, starpu_access_mode @var{mode})
+@deftypefun int starpu_data_acquire (starpu_data_handle @var{handle}, {enum starpu_access_mode} @var{mode})
 The application must call this function prior to accessing registered data from
 main memory outside tasks. StarPU ensures that the application will get an
 up-to-date copy of the data in main memory located where the data was
@@ -398,7 +398,7 @@ tasks or from their callbacks (in that case, @code{starpu_data_acquire} returns
 @end deftypefun
 
 
-@deftypefun int starpu_data_acquire_cb (starpu_data_handle @var{handle}, starpu_access_mode @var{mode}, void (*@var{callback})(void *), void *@var{arg})
+@deftypefun int starpu_data_acquire_cb (starpu_data_handle @var{handle}, {enum starpu_access_mode} @var{mode}, void (*@var{callback})(void *), void *@var{arg})
 @code{starpu_data_acquire_cb} is the asynchronous equivalent of
 @code{starpu_data_release}. When the data specified in the first argument is
 available in the appropriate access mode, the callback function is executed.
@@ -412,7 +412,7 @@ be called from task callbacks. Upon successful completion, this function
 returns 0.
 @end deftypefun
 
-@deftypefun void STARPU_DATA_ACQUIRE_CB (starpu_data_handle @var{handle}, starpu_access_mode @var{mode}, code)
+@deftypefun void STARPU_DATA_ACQUIRE_CB (starpu_data_handle @var{handle}, {enum starpu_access_mode} @var{mode}, code)
 @code{STARPU_DATA_ACQUIRE_CB} is the same as @code{starpu_data_acquire_cb},
 except that the code to be executed in a callback is directly provided as a
 macro parameter, and the data handle is automatically released after it. This

+ 1 - 1
gcc-plugin/tests/mocks.h

@@ -235,7 +235,7 @@ static unsigned int data_acquire_calls;
 struct data_acquire_arguments expected_acquire_arguments;
 
 int
-starpu_data_acquire (starpu_data_handle handle, starpu_access_mode mode)
+starpu_data_acquire (starpu_data_handle handle, enum starpu_access_mode mode)
 {
   /* XXX: Currently only `STARPU_RW'.  */
   assert (mode == STARPU_RW);

+ 10 - 9
include/starpu_data.h

@@ -32,16 +32,17 @@ typedef struct starpu_data_state_t * starpu_data_handle;
 extern "C" {
 #endif
 
-#define STARPU_R	(1<<0)
-#define STARPU_W	(1<<1)
-#define STARPU_RW	(STARPU_R|STARPU_W)
-#define STARPU_SCRATCH	(1<<2)
-#define STARPU_REDUX	(1<<3)
-typedef uint32_t starpu_access_mode;
+enum starpu_access_mode {
+	STARPU_R=(1<<0),
+	STARPU_W=(1<<1),
+	STARPU_RW=(STARPU_R|STARPU_W),
+	STARPU_SCRATCH=(1<<2),
+	STARPU_REDUX=(1<<3)
+};
 
 typedef struct starpu_buffer_descr_t {
 	starpu_data_handle handle;
-	starpu_access_mode mode;
+	enum starpu_access_mode mode;
 } starpu_buffer_descr;
 
 struct starpu_data_interface_ops;
@@ -58,9 +59,9 @@ void starpu_data_invalidate(starpu_data_handle);
 
 void starpu_data_advise_as_important(starpu_data_handle handle, unsigned is_important);
 
-int starpu_data_acquire(starpu_data_handle handle, starpu_access_mode mode);
+int starpu_data_acquire(starpu_data_handle handle, enum starpu_access_mode mode);
 int starpu_data_acquire_cb(starpu_data_handle handle,
-			starpu_access_mode mode, void (*callback)(void *), void *arg);
+			   enum starpu_access_mode mode, void (*callback)(void *), void *arg);
 #ifdef __GCC__
 #  define STARPU_DATA_ACQUIRE_CB(handle, mode, code) do { \
 	void callback(void *arg) { \

+ 1 - 1
include/starpu_scheduler.h

@@ -179,7 +179,7 @@ double starpu_worker_get_relative_speedup(enum starpu_perf_archtype perf_archtyp
 /* Returns expected data transfer time in µs */
 double starpu_task_expected_data_transfer_time(uint32_t memory_node, struct starpu_task *task);
 /* Predict the transfer time (in µs) to move a handle to a memory node */
-double starpu_data_expected_transfer_time(starpu_data_handle handle, unsigned memory_node, starpu_access_mode mode);
+double starpu_data_expected_transfer_time(starpu_data_handle handle, unsigned memory_node, enum starpu_access_mode mode);
 /* Returns expected power consumption in J */
 double starpu_task_expected_power(struct starpu_task *task, enum starpu_perf_archtype arch, unsigned nimpl);
 /* Returns expected conversion time in ms (multiformat interface only) */

+ 1 - 1
socl/src/cl_enqueuemapbuffer.c

@@ -26,7 +26,7 @@ static void mapbuffer_callback(void *args) {
 static void mapbuffer_task(void *args) {
 	command_map_buffer cmd = (command_map_buffer)args;
 
-	starpu_access_mode mode = (cmd->map_flags == CL_MAP_READ ? STARPU_R : STARPU_RW);
+	enum starpu_access_mode mode = (cmd->map_flags == CL_MAP_READ ? STARPU_R : STARPU_RW);
 
 	starpu_data_acquire_cb(cmd->buffer->handle, mode, mapbuffer_callback, cmd);
 }

+ 10 - 10
src/core/dependencies/data_concurrency.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * 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
@@ -60,7 +60,7 @@ static starpu_data_requester_t may_unlock_data_req_list_head(starpu_data_handle
 	/* data->current_mode == STARPU_R, so we can process more readers */
 	starpu_data_requester_t r = starpu_data_requester_list_front(req_list);
 
-	starpu_access_mode r_mode = r->mode;
+	enum starpu_access_mode r_mode = r->mode;
 	if (r_mode == STARPU_RW)
 		r_mode = STARPU_W;
 	
@@ -78,9 +78,9 @@ static starpu_data_requester_t may_unlock_data_req_list_head(starpu_data_handle
  * with the current mode, the request is put in the per-handle list of
  * "requesters", and this function returns 1. */
 static unsigned _starpu_attempt_to_submit_data_request(unsigned request_from_codelet,
-					starpu_data_handle handle, starpu_access_mode mode,
-					void (*callback)(void *), void *argcb,
-					starpu_job_t j, unsigned buffer_index)
+						       starpu_data_handle handle, enum starpu_access_mode mode,
+						       void (*callback)(void *), void *argcb,
+						       starpu_job_t j, unsigned buffer_index)
 {
 	if (mode == STARPU_RW)
 		mode = STARPU_W;
@@ -115,7 +115,7 @@ static unsigned _starpu_attempt_to_submit_data_request(unsigned request_from_cod
 	 * current one, we can proceed. */
 	unsigned put_in_list = 1;
 
-	starpu_access_mode previous_mode = handle->current_mode;
+	enum starpu_access_mode previous_mode = handle->current_mode;
 
 	if (!frozen && ((handle->refcnt == 0) || (!(mode == STARPU_W) && (handle->current_mode == mode))))
 	{
@@ -179,7 +179,7 @@ static unsigned _starpu_attempt_to_submit_data_request(unsigned request_from_cod
 }
 
 
-unsigned _starpu_attempt_to_submit_data_request_from_apps(starpu_data_handle handle, starpu_access_mode mode,
+unsigned _starpu_attempt_to_submit_data_request_from_apps(starpu_data_handle handle, enum starpu_access_mode mode,
 						void (*callback)(void *), void *argcb)
 {
 	return _starpu_attempt_to_submit_data_request(0, handle, mode, callback, argcb, NULL, 0);
@@ -190,7 +190,7 @@ static unsigned attempt_to_submit_data_request_from_job(starpu_job_t j, unsigned
 	/* Note that we do not access j->task->buffers, but j->ordered_buffers
 	 * which is a sorted copy of it. */
 	starpu_data_handle handle = j->ordered_buffers[buffer_index].handle;
-	starpu_access_mode mode = j->ordered_buffers[buffer_index].mode;
+	enum starpu_access_mode mode = j->ordered_buffers[buffer_index].mode;
 
 	return _starpu_attempt_to_submit_data_request(1, handle, mode, NULL, NULL, j, buffer_index);
 
@@ -284,7 +284,7 @@ void _starpu_notify_data_dependencies(starpu_data_handle handle)
 	while ((r = may_unlock_data_req_list_head(handle)))
 	{
 		/* STARPU_RW accesses are treated as STARPU_W */
-		starpu_access_mode r_mode = r->mode;
+		enum starpu_access_mode r_mode = r->mode;
 		if (r_mode == STARPU_RW)
 			r_mode = STARPU_W;
 
@@ -313,7 +313,7 @@ void _starpu_notify_data_dependencies(starpu_data_handle handle)
 			handle->refcnt++;
 			handle->busy_count++;
 		
-			starpu_access_mode previous_mode = handle->current_mode;
+			enum starpu_access_mode previous_mode = handle->current_mode;
 			handle->current_mode = r_mode;
 
 			/* In case we enter in a reduction mode, we invalidate all per

+ 3 - 3
src/core/dependencies/data_concurrency.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * 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
@@ -25,8 +25,8 @@ unsigned _starpu_submit_job_enforce_data_deps(starpu_job_t j);
 void _starpu_notify_data_dependencies(starpu_data_handle handle);
 
 unsigned _starpu_attempt_to_submit_data_request_from_apps(starpu_data_handle handle,
-		starpu_access_mode mode,
-		void (*callback)(void *), void *argcb);
+							  enum starpu_access_mode mode,
+							  void (*callback)(void *), void *argcb);
 
 #endif // __DATA_CONCURRENCY_H__
 

+ 5 - 5
src/core/dependencies/implicit_data_deps.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * 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
@@ -182,7 +182,7 @@ static void disable_last_writer_callback(void *cl_arg)
  * */
 /* NB : handle->sequential_consistency_mutex must be hold by the caller */
 void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_task, struct starpu_task *post_sync_task,
-						starpu_data_handle handle, starpu_access_mode mode)
+						   starpu_data_handle handle, enum starpu_access_mode mode)
 {
 	STARPU_ASSERT(!(mode & STARPU_SCRATCH));
         _STARPU_LOG_IN();
@@ -212,7 +212,7 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 			_starpu_bound_task_dep(post_sync_job, pre_sync_job);
 		}
 
-		starpu_access_mode previous_mode = handle->last_submitted_mode;
+		enum starpu_access_mode previous_mode = handle->last_submitted_mode;
 	
 		if (mode & STARPU_W)
 		{
@@ -290,7 +290,7 @@ void _starpu_detect_implicit_data_deps(struct starpu_task *task)
 	for (buffer = 0; buffer < nbuffers; buffer++)
 	{
 		starpu_data_handle handle = task->buffers[buffer].handle;
-		starpu_access_mode mode = task->buffers[buffer].mode;
+		enum starpu_access_mode mode = task->buffers[buffer].mode;
 
 		/* Scratch memory does not introduce any deps */
 		if (mode & STARPU_SCRATCH)
@@ -453,7 +453,7 @@ void _starpu_unlock_post_sync_tasks(starpu_data_handle handle)
 
 /* If sequential consistency mode is enabled, this function blocks until the
  * handle is available in the requested access mode. */
-int _starpu_data_wait_until_available(starpu_data_handle handle, starpu_access_mode mode)
+int _starpu_data_wait_until_available(starpu_data_handle handle, enum starpu_access_mode mode)
 {
 	/* If sequential consistency is enabled, wait until data is available */
 	_STARPU_PTHREAD_MUTEX_LOCK(&handle->sequential_consistency_mutex);

+ 3 - 3
src/core/dependencies/implicit_data_deps.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * 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
@@ -22,7 +22,7 @@
 #include <common/config.h>
 
 void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_task, struct starpu_task *post_sync_task,
-						starpu_data_handle handle, starpu_access_mode mode);
+						   starpu_data_handle handle, enum starpu_access_mode mode);
 void _starpu_detect_implicit_data_deps(struct starpu_task *task);
 void _starpu_release_data_enforce_sequential_consistency(struct starpu_task *task, starpu_data_handle handle);
 
@@ -30,7 +30,7 @@ void _starpu_add_post_sync_tasks(struct starpu_task *post_sync_task, starpu_data
 void _starpu_unlock_post_sync_tasks(starpu_data_handle handle);
 
 /* This function blocks until the handle is available in the requested mode */
-int _starpu_data_wait_until_available(starpu_data_handle handle, starpu_access_mode mode);
+int _starpu_data_wait_until_available(starpu_data_handle handle, enum starpu_access_mode mode);
 
 #endif // __IMPLICIT_DATA_DEPS_H__
 

+ 3 - 3
src/core/perfmodel/perfmodel.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -206,7 +206,7 @@ double starpu_task_expected_conversion_time(struct starpu_task *task, enum starp
 }
 
 /* Predict the transfer time (in µs) to move a handle to a memory node */
-double starpu_data_expected_transfer_time(starpu_data_handle handle, unsigned memory_node, starpu_access_mode mode)
+double starpu_data_expected_transfer_time(starpu_data_handle handle, unsigned memory_node, enum starpu_access_mode mode)
 {
 	/* If we don't need to read the content of the handle */
 	if (!(mode & STARPU_R))
@@ -239,7 +239,7 @@ double starpu_task_expected_data_transfer_time(uint32_t memory_node, struct star
 	for (buffer = 0; buffer < nbuffers; buffer++)
 	{
 		starpu_data_handle handle = task->buffers[buffer].handle;
-		starpu_access_mode mode = task->buffers[buffer].mode;
+		enum starpu_access_mode mode = task->buffers[buffer].mode;
 
 		penalty += starpu_data_expected_transfer_time(handle, memory_node, mode);
 	}

+ 3 - 3
src/core/task_bundle.c

@@ -233,11 +233,11 @@ double starpu_task_bundle_expected_power(struct starpu_task_bundle *bundle,  enu
 
 struct handle_list {
 	starpu_data_handle handle;
-	starpu_access_mode mode;
+	enum starpu_access_mode mode;
 	struct handle_list *next;
 };
 
-static void insertion_handle_sorted(struct handle_list **listp, starpu_data_handle handle, starpu_access_mode mode)
+static void insertion_handle_sorted(struct handle_list **listp, starpu_data_handle handle, enum starpu_access_mode mode)
 {
 	STARPU_ASSERT(listp);
 
@@ -302,7 +302,7 @@ double starpu_task_bundle_expected_data_transfer_time(struct starpu_task_bundle
 			for (b = 0; b < task->cl->nbuffers; b++)
 			{
 				starpu_data_handle handle = task->buffers[b].handle;
-				starpu_access_mode mode = task->buffers[b].mode;
+				enum starpu_access_mode mode = task->buffers[b].mode;
 
 				if (!(mode & STARPU_R))
 					continue;

+ 15 - 15
src/datawizard/coherency.c

@@ -109,8 +109,8 @@ uint32_t _starpu_select_src_node(starpu_data_handle handle, unsigned destination
 
 /* this may be called once the data is fetched with header and STARPU_RW-lock hold */
 void _starpu_update_data_state(starpu_data_handle handle,
-				struct starpu_data_replicate_s *requesting_replicate,
-				starpu_access_mode mode)
+			       struct starpu_data_replicate_s *requesting_replicate,
+			       enum starpu_access_mode mode)
 {
 	/* There is nothing to do for relaxed coherency modes (scratch or
 	 * reductions) */
@@ -209,10 +209,10 @@ static int link_supports_direct_transfers(starpu_data_handle handle, unsigned sr
  * and the max_len is the maximum number of hops (ie. the size of the
  * src_nodes, dst_nodes and handling_nodes arrays. */
 static int determine_request_path(starpu_data_handle handle,
-				unsigned src_node, unsigned dst_node,
-				starpu_access_mode mode, int max_len,
-				unsigned *src_nodes, unsigned *dst_nodes,
-				unsigned *handling_nodes)
+				  unsigned src_node, unsigned dst_node,
+				  enum starpu_access_mode mode, int max_len,
+				  unsigned *src_nodes, unsigned *dst_nodes,
+				  unsigned *handling_nodes)
 {
 	if (!(mode & STARPU_R))
 	{
@@ -264,7 +264,7 @@ static int determine_request_path(starpu_data_handle handle,
 /* handle->lock should be taken. r is returned locked. The node parameter
  * indicate either the source of the request, or the destination for a
  * write-only request. */
-static starpu_data_request_t _starpu_search_existing_data_request(struct starpu_data_replicate_s *replicate, unsigned node, starpu_access_mode mode, unsigned is_prefetch)
+static starpu_data_request_t _starpu_search_existing_data_request(struct starpu_data_replicate_s *replicate, unsigned node, enum starpu_access_mode mode, unsigned is_prefetch)
 {
 	starpu_data_request_t r;
 
@@ -323,7 +323,7 @@ static starpu_data_request_t _starpu_search_existing_data_request(struct starpu_
 /* This function is called with handle's header lock taken */
 starpu_data_request_t create_request_to_fetch_data(starpu_data_handle handle,
 				struct starpu_data_replicate_s *dst_replicate,
-                                starpu_access_mode mode, unsigned is_prefetch,
+                                enum starpu_access_mode mode, unsigned is_prefetch,
                                 void (*callback_func)(void *), void *callback_arg)
 {
 	unsigned requesting_node = dst_replicate->memory_node;
@@ -452,8 +452,8 @@ starpu_data_request_t create_request_to_fetch_data(starpu_data_handle handle,
 }
 
 int _starpu_fetch_data_on_node(starpu_data_handle handle, struct starpu_data_replicate_s *dst_replicate,
-				starpu_access_mode mode, unsigned is_prefetch,
-				void (*callback_func)(void *), void *callback_arg)
+			       enum starpu_access_mode mode, unsigned is_prefetch,
+			       void (*callback_func)(void *), void *callback_arg)
 {
 	uint32_t local_node = _starpu_get_local_memory_node();
         _STARPU_LOG_IN();
@@ -483,12 +483,12 @@ int _starpu_fetch_data_on_node(starpu_data_handle handle, struct starpu_data_rep
         return ret;
 }
 
-static int prefetch_data_on_node(starpu_data_handle handle, struct starpu_data_replicate_s *replicate, starpu_access_mode mode)
+static int prefetch_data_on_node(starpu_data_handle handle, struct starpu_data_replicate_s *replicate, enum starpu_access_mode mode)
 {
 	return _starpu_fetch_data_on_node(handle, replicate, mode, 1, NULL, NULL);
 }
 
-static int fetch_data(starpu_data_handle handle, struct starpu_data_replicate_s *replicate, starpu_access_mode mode)
+static int fetch_data(starpu_data_handle handle, struct starpu_data_replicate_s *replicate, enum starpu_access_mode mode)
 {
 	return _starpu_fetch_data_on_node(handle, replicate, mode, 0, NULL, NULL);
 }
@@ -571,7 +571,7 @@ int starpu_prefetch_task_input_on_node(struct starpu_task *task, uint32_t node)
 	for (index = 0; index < nbuffers; index++)
 	{
 		starpu_data_handle handle = descrs[index].handle;
-		starpu_access_mode mode = descrs[index].mode;
+		enum starpu_access_mode mode = descrs[index].mode;
 
 		if (mode & (STARPU_SCRATCH|STARPU_REDUX))
 			continue;
@@ -605,7 +605,7 @@ int _starpu_fetch_task_input(struct starpu_task *task, uint32_t mask)
 	{
 		int ret;
 		starpu_data_handle handle = descrs[index].handle;
-		starpu_access_mode mode = descrs[index].mode;
+		enum starpu_access_mode mode = descrs[index].mode;
 
 		struct starpu_data_replicate_s *local_replicate;
 
@@ -663,7 +663,7 @@ void _starpu_push_task_output(struct starpu_task *task, uint32_t mask)
 	for (index = 0; index < nbuffers; index++)
 	{
 		starpu_data_handle handle = descrs[index].handle;
-		starpu_access_mode mode = descrs[index].mode;
+		enum starpu_access_mode mode = descrs[index].mode;
 
 		struct starpu_data_replicate_s *replicate;
 

+ 5 - 5
src/datawizard/coherency.h

@@ -100,7 +100,7 @@ struct starpu_data_state_t {
 	 * the req_list anymore), i.e. the number of holders of the
 	 * current_mode rwlock */
 	unsigned refcnt;
-	starpu_access_mode current_mode;
+	enum starpu_access_mode current_mode;
 	/* protect meta data */
 	struct _starpu_spinlock header_lock;
 
@@ -159,7 +159,7 @@ struct starpu_data_state_t {
 	 * it would modify the piece of data ? Any task accessing the data in a
 	 * read-only mode should depend on that task implicitely if the
 	 * sequential_consistency flag is enabled. */
-	starpu_access_mode last_submitted_mode;
+	enum starpu_access_mode last_submitted_mode;
 	struct starpu_task *last_submitted_writer;
 	struct starpu_task_wrapper_list *last_submitted_readers;
 
@@ -220,7 +220,7 @@ void _starpu_display_msi_stats(void);
 /* This does not take a reference on the handle, the caller has to do it,
  * e.g. through _starpu_attempt_to_submit_data_request_from_apps() */
 int _starpu_fetch_data_on_node(struct starpu_data_state_t *state, struct starpu_data_replicate_s *replicate,
-				starpu_access_mode mode, unsigned is_prefetch,
+				enum starpu_access_mode mode, unsigned is_prefetch,
 				void (*callback_func)(void *), void *callback_arg);
 /* This releases a reference on the handle */
 void _starpu_release_data_on_node(struct starpu_data_state_t *state, uint32_t default_wt_mask,
@@ -228,7 +228,7 @@ void _starpu_release_data_on_node(struct starpu_data_state_t *state, uint32_t de
 
 void _starpu_update_data_state(starpu_data_handle handle,
 				struct starpu_data_replicate_s *requesting_replicate,
-				starpu_access_mode mode);
+				enum starpu_access_mode mode);
 
 uint32_t _starpu_get_data_refcnt(struct starpu_data_state_t *state, uint32_t node);
 
@@ -249,7 +249,7 @@ uint32_t _starpu_select_src_node(struct starpu_data_state_t *state, unsigned des
 
 starpu_data_request_t create_request_to_fetch_data(starpu_data_handle handle,
 				struct starpu_data_replicate_s *dst_replicate,
-                                starpu_access_mode mode, unsigned is_prefetch,
+                                enum starpu_access_mode mode, unsigned is_prefetch,
                                 void (*callback_func)(void *), void *callback_arg);
 
 void _starpu_redux_init_data_replicate(starpu_data_handle handle, struct starpu_data_replicate_s *replicate, int workerid);

+ 8 - 8
src/datawizard/data_request.c

@@ -84,12 +84,12 @@ static void starpu_data_request_destroy(starpu_data_request_t r)
 
 /* handle->lock should already be taken !  */
 starpu_data_request_t _starpu_create_data_request(starpu_data_handle handle,
-				struct starpu_data_replicate_s *src_replicate,
-				struct starpu_data_replicate_s *dst_replicate,
-				uint32_t handling_node,
-				starpu_access_mode mode,
-				unsigned ndeps,
-				unsigned is_prefetch)
+						  struct starpu_data_replicate_s *src_replicate,
+						  struct starpu_data_replicate_s *dst_replicate,
+						  uint32_t handling_node,
+						  enum starpu_access_mode mode,
+						  unsigned ndeps,
+						  unsigned is_prefetch)
 {
 	starpu_data_request_t r = starpu_data_request_new();
 
@@ -224,7 +224,7 @@ static void starpu_handle_data_request_completion(starpu_data_request_t r)
 {
 	unsigned do_delete = 0;
 	starpu_data_handle handle = r->handle;
-	starpu_access_mode mode = r->mode;
+	enum starpu_access_mode mode = r->mode;
 
 	struct starpu_data_replicate_s *src_replicate = r->src_replicate;
 	struct starpu_data_replicate_s *dst_replicate = r->dst_replicate;
@@ -333,7 +333,7 @@ static int starpu_handle_data_request(starpu_data_request_t r, unsigned may_allo
 	struct starpu_data_replicate_s *src_replicate = r->src_replicate;
 	struct starpu_data_replicate_s *dst_replicate = r->dst_replicate;
 
-	starpu_access_mode r_mode = r->mode;
+	enum starpu_access_mode r_mode = r->mode;
 
 	STARPU_ASSERT(!(r_mode & STARPU_R) || src_replicate);
 	STARPU_ASSERT(!(r_mode & STARPU_R) || src_replicate->allocated);

+ 3 - 3
src/datawizard/data_request.h

@@ -42,7 +42,7 @@ LIST_TYPE(starpu_data_request,
 
 	uint32_t handling_node;
 
-	starpu_access_mode mode;
+	enum starpu_access_mode mode;
 
 	struct starpu_async_channel async_channel;
 
@@ -70,7 +70,7 @@ LIST_TYPE(starpu_data_request,
  * Not only StarPU internals, but also the application may put such requests */
 LIST_TYPE(starpu_data_requester,
 	/* what kind of access is requested ? */
-	starpu_access_mode mode;
+	enum starpu_access_mode mode;
 
 	/* applications may also directly manipulate data */
 	unsigned is_requested_by_codelet;
@@ -101,7 +101,7 @@ starpu_data_request_t _starpu_create_data_request(starpu_data_handle handle,
 				struct starpu_data_replicate_s *src_replicate,
 				struct starpu_data_replicate_s *dst_replicate,
 				uint32_t handling_node,
-				starpu_access_mode mode,
+				enum starpu_access_mode mode,
 				unsigned ndeps,
 				unsigned is_prefetch);
 

+ 4 - 4
src/datawizard/user_interactions.c

@@ -43,7 +43,7 @@ int starpu_data_request_allocation(starpu_data_handle handle, uint32_t node)
 
 struct user_interaction_wrapper {
 	starpu_data_handle handle;
-	starpu_access_mode mode;
+	enum starpu_access_mode mode;
 	unsigned node;
 	pthread_cond_t cond;
 	pthread_mutex_t lock;
@@ -109,7 +109,7 @@ static void starpu_data_acquire_cb_pre_sync_callback(void *arg)
 
 /* The data must be released by calling starpu_data_release later on */
 int starpu_data_acquire_cb(starpu_data_handle handle,
-		starpu_access_mode mode, void (*callback)(void *), void *arg)
+			   enum starpu_access_mode mode, void (*callback)(void *), void *arg)
 {
 	STARPU_ASSERT(handle);
         _STARPU_LOG_IN();
@@ -192,7 +192,7 @@ static inline void _starpu_data_acquire_continuation(void *arg)
 }
 
 /* The data must be released by calling starpu_data_release later on */
-int starpu_data_acquire(starpu_data_handle handle, starpu_access_mode mode)
+int starpu_data_acquire(starpu_data_handle handle, enum starpu_access_mode mode)
 {
 	STARPU_ASSERT(handle);
         _STARPU_LOG_IN();
@@ -309,7 +309,7 @@ static void _prefetch_data_on_node(void *arg)
 }
 
 static
-int _starpu_prefetch_data_on_node_with_mode(starpu_data_handle handle, unsigned node, unsigned async, starpu_access_mode mode)
+int _starpu_prefetch_data_on_node_with_mode(starpu_data_handle handle, unsigned node, unsigned async, enum starpu_access_mode mode)
 {
 	STARPU_ASSERT(handle);
 

+ 1 - 1
src/util/starpu_insert_task_utils.c

@@ -167,7 +167,7 @@ int _starpu_insert_task_create_and_submit(char *arg_buffer, starpu_codelet *cl,
 			/* We have an access mode : we expect to find a handle */
 			starpu_data_handle handle = va_arg(varg_list, starpu_data_handle);
 
-			starpu_access_mode mode = arg_type;
+			enum starpu_access_mode mode = arg_type;
 
 			(*task)->buffers[current_buffer].handle = handle;
 			(*task)->buffers[current_buffer].mode = mode;

+ 1 - 1
tests/core/execute_on_a_specific_worker.c

@@ -58,7 +58,7 @@ static void codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 //	fprintf(stderr, "worker #%d\n", id);
 }
 
-static starpu_access_mode select_random_mode(void)
+static enum starpu_access_mode select_random_mode(void)
 {
 	int r = rand();
 

+ 1 - 1
tests/datawizard/dsm_stress.c

@@ -65,7 +65,7 @@ static void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args
 {
 }
 
-static starpu_access_mode select_random_mode(void)
+static enum starpu_access_mode select_random_mode(void)
 {
 	int r = rand();
 

+ 1 - 1
tests/microbenchs/prefetch_data_on_node.c

@@ -43,7 +43,7 @@ static void codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 //	fflush(stderr);
 }
 
-static starpu_access_mode select_random_mode(void)
+static enum starpu_access_mode select_random_mode(void)
 {
 	int r = rand();