Browse Source

Move nb_tasks_prefetch to starpu_data_can_evict

So that victim selectors can get the test
Samuel Thibault 4 years ago
parent
commit
98580a528e
2 changed files with 7 additions and 7 deletions
  1. 1 1
      include/starpu_data.h
  2. 6 6
      src/datawizard/memalloc.c

+ 1 - 1
include/starpu_data.h

@@ -581,7 +581,7 @@ void *starpu_data_get_user_data(starpu_data_handle_t handle);
 /**
   Check whether data \p handle can be evicted now from node \p node
 */
-int starpu_data_can_evict(starpu_data_handle_t handle, unsigned node);
+int starpu_data_can_evict(starpu_data_handle_t handle, unsigned node, enum starpu_is_prefetch is_prefetch);
 
 /** @} */
 

+ 6 - 6
src/datawizard/memalloc.c

@@ -545,7 +545,7 @@ static void reuse_mem_chunk(unsigned node, struct _starpu_data_replicate *new_re
 	free(mc);
 }
 
-int starpu_data_can_evict(starpu_data_handle_t handle, unsigned node)
+int starpu_data_can_evict(starpu_data_handle_t handle, unsigned node, enum starpu_is_prefetch is_prefetch)
 {
 	/* This data should be written through to this node, avoid dropping it! */
 	if (handle->wt_mask & (1<<node))
@@ -560,6 +560,10 @@ int starpu_data_can_evict(starpu_data_handle_t handle, unsigned node)
 		&& starpu_memory_nodes_get_numa_count() == 1)
 		return 0;
 
+	if (is_prefetch >= STARPU_TASK_PREFETCH && handle->per_node[node].nb_tasks_prefetch)
+		/* We have not finished executing the tasks this was prefetched for */
+		return 0;
+
 	return 1;
 }
 
@@ -574,17 +578,13 @@ static size_t try_to_throw_mem_chunk(struct _starpu_mem_chunk *mc, unsigned node
 	handle = mc->data;
 	STARPU_ASSERT(handle);
 
-	if (!starpu_data_can_evict(handle, node))
+	if (!starpu_data_can_evict(handle, node, is_prefetch))
 		return 0;
 
 	if (diduse_barrier && !mc->diduse)
 		/* Hasn't been used yet, avoid evicting it */
 		return 0;
 
-	if (is_prefetch >= STARPU_TASK_PREFETCH && handle->per_node[node].nb_tasks_prefetch)
-		/* We have not finished executing the tasks this was prefetched for */
-		return 0;
-
 	/* REDUX memchunk */
 	if (mc->relaxed_coherency == 2)
 	{