Ver código fonte

memalloc: Do try to evict data on prefetch

Since we have nb_tasks_prefetch, we will not be evicting data that we have
loaded for good reasons, while prefetches are a good reason for evicting
data.
Samuel Thibault 4 anos atrás
pai
commit
ac04c599f4
1 arquivos alterados com 12 adições e 3 exclusões
  1. 12 3
      src/datawizard/memalloc.c

+ 12 - 3
src/datawizard/memalloc.c

@@ -1519,9 +1519,9 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
 			}
 			reclaim -= freed;
 
-			if (is_prefetch)
+			if (is_prefetch >= STARPU_IDLEFETCH)
 			{
-				/* It's just prefetch, don't bother existing allocations */
+				/* It's just idle fetch, don't bother existing allocations */
 				/* And don't bother tracing allocation attempts */
 				prefetch_out_of_memory[dst_node] = 1;
 				/* TODO: ideally we should not even try to allocate when we know we have not freed anything */
@@ -1547,8 +1547,17 @@ static starpu_ssize_t _starpu_allocate_interface(starpu_data_handle_t handle, st
 			}
 			/* That was not enough, we have to really reclaim */
 			_STARPU_TRACE_START_MEMRECLAIM(dst_node,is_prefetch);
-			_starpu_memory_reclaim_generic(dst_node, 0, reclaim, is_prefetch);
+			freed = _starpu_memory_reclaim_generic(dst_node, 0, reclaim, is_prefetch);
 			_STARPU_TRACE_END_MEMRECLAIM(dst_node,is_prefetch);
+
+			if (!freed && is_prefetch >= STARPU_FETCH)
+			{
+				/* It's just prefetch, don't bother tracing allocation attempts */
+				prefetch_out_of_memory[dst_node] = 1;
+				/* TODO: ideally we should not even try to allocate when we know we have not freed anything */
+				continue;
+			}
+
 			prefetch_out_of_memory[dst_node] = 0;
 		}
 		else