Преглед изворни кода

memalloc: Drop diduse

nb_tasks_prefetch already provides the support
Samuel Thibault пре 4 година
родитељ
комит
2e0dd21c8b

+ 0 - 9
doc/doxygen/chapters/501_environment_variables.doxy

@@ -1123,15 +1123,6 @@ GPUs (or in main memory, when using out of core), when performing an asynchronou
 writeback pass. The default is 10%.
 </dd>
 
-<dt>STARPU_DIDUSE_BARRIER</dt>
-<dd>
-\anchor STARPU_DIDUSE_BARRIER
-\addindex __env__STARPU_DIDUSE_BARRIER
-When set to 1, StarPU will never evict a piece of data if it has not been used
-by at least one task. This avoids odd behaviors under high memory pressure, but
-can lead to deadlocks, so is to be considered experimental only.
-</dd>
-
 <dt>STARPU_DISK_SWAP</dt>
 <dd>
 \anchor STARPU_DISK_SWAP

+ 0 - 1
src/datawizard/coherency.c

@@ -1208,7 +1208,6 @@ void _starpu_fetch_task_input_tail(struct starpu_task *task, struct _starpu_job
 		_starpu_spin_lock(&handle->header_lock);
 		if (local_replicate->mc)
 		{
-			local_replicate->mc->diduse = 1;
 			if (task->prefetched && local_replicate->initialized &&
 				/* See prefetch conditions in
 				 * starpu_prefetch_task_input_on_node_prio and alike */

+ 0 - 11
src/datawizard/memalloc.c

@@ -36,9 +36,6 @@ static unsigned target_clean_p;
 /* Whether CPU memory has been explicitly limited by user */
 static int limit_cpu_mem;
 
-/* Prevent memchunks from being evicted from memory before they are actually used */
-static int diduse_barrier;
-
 /* This per-node RW-locks protect mc_list and memchunk_cache entries */
 /* Note: handle header lock is always taken before this (normal add/remove case) */
 static struct _starpu_spinlock mc_lock[STARPU_MAXNODES];
@@ -200,7 +197,6 @@ void _starpu_init_mem_chunk_lists(void)
 	minimum_clean_p = starpu_get_env_number_default("STARPU_MINIMUM_CLEAN_BUFFERS", 5);
 	target_clean_p = starpu_get_env_number_default("STARPU_TARGET_CLEAN_BUFFERS", 10);
 	limit_cpu_mem = starpu_get_env_number("STARPU_LIMIT_CPU_MEM");
-	diduse_barrier = starpu_get_env_number_default("STARPU_DIDUSE_BARRIER", 0);
 }
 
 void _starpu_deinit_mem_chunk_lists(void)
@@ -581,10 +577,6 @@ static size_t try_to_throw_mem_chunk(struct _starpu_mem_chunk *mc, unsigned 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;
-
 	/* REDUX memchunk */
 	if (mc->relaxed_coherency == 2)
 	{
@@ -1330,7 +1322,6 @@ static struct _starpu_mem_chunk *_starpu_memchunk_init(struct _starpu_data_repli
 	mc->chunk_interface = NULL;
 	mc->size_interface = interface_size;
 	mc->remove_notify = NULL;
-	mc->diduse = 0;
 	mc->wontuse = 0;
 
 	return mc;
@@ -1693,8 +1684,6 @@ void _starpu_memchunk_wont_use(struct _starpu_mem_chunk *mc, unsigned node)
 		/* Don't bother */
 		return;
 	_starpu_spin_lock(&mc_lock[node]);
-	/* Avoid preventing it from being evicted */
-	mc->diduse = 1;
 	mc->wontuse = 1;
 	if (mc->data && mc->data->home_node != -1)
 	{

+ 0 - 3
src/datawizard/memalloc.h

@@ -59,9 +59,6 @@ LIST_TYPE(_starpu_mem_chunk,
 	unsigned home:1;
 	/** Whether the memchunk is in the clean part of the mc_list */
 	unsigned clean:1;
-	/** Was this chunk used since it got allocated?
-	    FIXME: probably useless now with nb_tasks_prefetch */
-	unsigned diduse:1;
 	/** Was this chunk marked as "won't use"? */
 	unsigned wontuse:1;
 

+ 0 - 16
src/datawizard/user_interactions.c

@@ -112,17 +112,6 @@ static inline void _starpu_data_acquire_wrapper_fini(struct user_interaction_wra
 	STARPU_PTHREAD_MUTEX_DESTROY(&wrapper->lock);
 }
 
-/* Called when the fetch into target memory is done, we're done! */
-static inline void _starpu_data_acquire_fetch_done(struct user_interaction_wrapper *wrapper)
-{
-	if (wrapper->node >= 0)
-	{
-		struct _starpu_data_replicate *replicate = &wrapper->handle->per_node[wrapper->node];
-		if (replicate->mc)
-			replicate->mc->diduse = 1;
-	}
-}
-
 /* Called when the data acquisition is done, to launch the fetch into target memory */
 static inline void _starpu_data_acquire_launch_fetch(struct user_interaction_wrapper *wrapper, int async, void (*callback)(void *), void *callback_arg)
 {
@@ -154,8 +143,6 @@ static void _starpu_data_acquire_fetch_data_callback(void *arg)
 	if (wrapper->post_sync_task)
 		_starpu_add_post_sync_tasks(wrapper->post_sync_task, handle);
 
-	_starpu_data_acquire_fetch_done(wrapper);
-
 	wrapper->callback(wrapper->callback_arg);
 
 	_starpu_data_acquire_wrapper_fini(wrapper);
@@ -326,7 +313,6 @@ static inline void _starpu_data_acquire_continuation(void *arg)
 	STARPU_ASSERT(handle);
 
 	_starpu_data_acquire_launch_fetch(wrapper, 0, NULL, NULL);
-	_starpu_data_acquire_fetch_done(wrapper);
 	_starpu_data_acquire_wrapper_finished(wrapper);
 }
 
@@ -411,7 +397,6 @@ int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum star
 	{
 		/* no one has locked this data yet, so we proceed immediately */
 		_starpu_data_acquire_launch_fetch(&wrapper, 0, NULL, NULL);
-		_starpu_data_acquire_fetch_done(&wrapper);
 	}
 	else
 	{
@@ -466,7 +451,6 @@ int starpu_data_acquire_on_node_try(starpu_data_handle_t handle, int node, enum
 	{
 		/* no one has locked this data yet, so we proceed immediately */
 		_starpu_data_acquire_launch_fetch(&wrapper, 0, NULL, NULL);
-		_starpu_data_acquire_fetch_done(&wrapper);
 	}
 	else
 	{