ソースを参照

starpu_access_mode is not an enum type anymore, so that we can add new types of
accesses more easily.

Cédric Augonnet 15 年 前
コミット
b2a1bfd608
共有4 個のファイルを変更した15 個の追加15 個の削除を含む
  1. 5 5
      include/starpu_data.h
  2. 2 2
      src/core/dependencies/implicit_data_deps.c
  3. 4 4
      src/datawizard/coherency.c
  4. 4 4
      src/datawizard/user_interactions.c

+ 5 - 5
include/starpu_data.h

@@ -29,11 +29,11 @@ typedef struct starpu_data_state_t * starpu_data_handle;
 #ifdef __cplusplus
 extern "C" {
 #endif
-typedef enum {
-	STARPU_R,
-	STARPU_W,
-	STARPU_RW
-} starpu_access_mode;
+
+#define STARPU_R	(1<<0)
+#define STARPU_W	(1<<1)
+#define STARPU_RW	(STARPU_R|STARPU_W)
+typedef uint32_t starpu_access_mode;
 
 typedef struct starpu_buffer_descr_t {
 	starpu_data_handle handle;

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

@@ -26,9 +26,9 @@ static void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *ta
 	{
 		starpu_access_mode previous_mode = handle->last_submitted_mode;
 	
-		if (mode != STARPU_R)
+		if (mode & STARPU_W)
 		{
-			if (previous_mode != STARPU_R)
+			if (previous_mode & STARPU_W)
 			{
 				/* (Read) Write */
 				/* This task depends on the previous writer */

+ 4 - 4
src/datawizard/coherency.c

@@ -281,8 +281,8 @@ static int fetch_data(starpu_data_handle handle, starpu_access_mode mode)
 	uint32_t requesting_node = _starpu_get_local_memory_node(); 
 
 	uint8_t read, write;
-	read = (mode != STARPU_W); /* then R or STARPU_RW */
-	write = (mode != STARPU_R); /* then STARPU_W or STARPU_RW */
+	read = (mode & STARPU_R); /* then R or STARPU_RW */
+	write = (mode & STARPU_W); /* then STARPU_W or STARPU_RW */
 
 	return _starpu_fetch_data_on_node(handle, requesting_node, read, write, 0);
 }
@@ -335,8 +335,8 @@ int _starpu_prefetch_task_input_on_node(struct starpu_task *task, uint32_t node)
 		
 		uint32_t mode = task->buffers[index].mode;
 	
-		uint8_t read = (mode != STARPU_W);
-		uint8_t write = (mode != STARPU_R);
+		uint8_t read = (mode & STARPU_R);
+		uint8_t write = (mode & STARPU_W);
 
 		prefetch_data_on_node(handle, read, write, node);
 	}

+ 4 - 4
src/datawizard/user_interactions.c

@@ -60,8 +60,8 @@ static inline void _starpu_sync_data_with_mem_continuation(void *arg)
 
 	STARPU_ASSERT(handle);
 
-	unsigned r = (statenode->mode != STARPU_W);
-	unsigned w = (statenode->mode != STARPU_R);
+	unsigned r = (statenode->mode & STARPU_R);
+	unsigned w = (statenode->mode & STARPU_W);
 
 	ret = _starpu_fetch_data_on_node(handle, 0, r, w, 0);
 	STARPU_ASSERT(!ret);
@@ -207,8 +207,8 @@ int _starpu_prefetch_data_on_node_with_mode(starpu_data_handle handle, unsigned
 	if (!_starpu_attempt_to_submit_data_request_from_apps(handle, mode, _prefetch_data_on_node, &statenode))
 	{
 		/* we can immediately proceed */
-		uint8_t read = (mode != STARPU_W);
-		uint8_t write = (mode != STARPU_R);
+		uint8_t read = (mode & STARPU_R);
+		uint8_t write = (mode & STARPU_W);
 		_starpu_fetch_data_on_node(handle, node, read, write, async);
 
 		/* remove the "lock"/reference */