Quellcode durchsuchen

use some shorter function names

Olivier Aumage vor 8 Jahren
Ursprung
Commit
eb935f13bc

+ 3 - 3
include/starpu_sched_component.h

@@ -199,12 +199,12 @@ struct starpu_sched_tree *starpu_sched_component_make_scheduler(unsigned sched_c
 #define STARPU_COMPONENT_MUTEX_LOCK(m) \
 do \
 { \
-	const int _relaxed_state = _starpu_worker_get_observation_safe_state(); \
+	const int _relaxed_state = _starpu_worker_get_relax_state(); \
 	if (!_relaxed_state) \
-		_starpu_worker_enter_section_safe_for_observation(); \
+		_starpu_worker_relax_on(); \
 	STARPU_PTHREAD_MUTEX_LOCK((m)); \
 	if (!_relaxed_state) \
-		_starpu_worker_leave_section_safe_for_observation(); \
+		_starpu_worker_relax_off(); \
 } \
 while(0)
 

+ 2 - 2
src/core/sched_policy.c

@@ -951,7 +951,7 @@ pick:
 	 * We do have a task that uses multiformat handles. Let's create the
 	 * required conversion tasks.
 	 */
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	unsigned i;
 	unsigned nbuffers = STARPU_TASK_GET_NBUFFERS(task);
 	for (i = 0; i < nbuffers; i++)
@@ -975,7 +975,7 @@ pick:
 
 	task->mf_skip = 1;
 	starpu_task_list_push_back(&worker->local_tasks, task);
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 	goto pick;
 
 profiling:

+ 3 - 3
src/core/workers.h

@@ -904,7 +904,7 @@ static inline void _starpu_worker_unlock_for_observation(int workerid)
 
 /* Temporarily allow other worker to access current worker state, when still scheduling,
  * but the scheduling has not yet been made or is already done */
-static inline void _starpu_worker_enter_section_safe_for_observation(void)
+static inline void _starpu_worker_relax_on(void)
 {
 	int workerid = starpu_worker_get_id_check();
 	struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
@@ -916,7 +916,7 @@ static inline void _starpu_worker_enter_section_safe_for_observation(void)
 	STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
 }
 
-static inline void _starpu_worker_leave_section_safe_for_observation(void)
+static inline void _starpu_worker_relax_off(void)
 {
 	int workerid = starpu_worker_get_id_check();
 	struct _starpu_worker *worker = _starpu_get_worker_struct(workerid);
@@ -927,7 +927,7 @@ static inline void _starpu_worker_leave_section_safe_for_observation(void)
 	STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
 }
 
-static inline int _starpu_worker_get_observation_safe_state(void)
+static inline int _starpu_worker_get_relax_state(void)
 {
 	int workerid = starpu_worker_get_id();
 	if (workerid < 0)

+ 4 - 4
src/sched_policies/eager_central_policy.c

@@ -150,14 +150,14 @@ static struct starpu_task *pop_every_task_eager_policy(unsigned sched_ctx_id)
 
 static struct starpu_task *pop_task_eager_policy(unsigned sched_ctx_id)
 {
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	struct starpu_task *chosen_task = NULL;
 	unsigned workerid = starpu_worker_get_id_check();
 	struct _starpu_eager_center_policy_data *data = (struct _starpu_eager_center_policy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	/* block until some event happens */
 	STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 
 	/* Here helgrind would shout that this is unprotected, this is just an
 	 * integer access, and we hold the sched mutex, so we can not miss any
@@ -182,7 +182,7 @@ static struct starpu_task *pop_task_eager_policy(unsigned sched_ctx_id)
 		/* Tell pushers that we are waiting for tasks for us */
 		starpu_bitmap_set(data->waiters, workerid);
 
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 	if(chosen_task)
 	{
@@ -198,7 +198,7 @@ static struct starpu_task *pop_task_eager_policy(unsigned sched_ctx_id)
 		}
 		_starpu_sched_ctx_unlock_write(sched_ctx_id);
 	}
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 
 	return chosen_task;
 }

+ 4 - 4
src/sched_policies/eager_central_priority_policy.c

@@ -191,7 +191,7 @@ static int _starpu_priority_push_task(struct starpu_task *task)
 
 static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 {
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	struct starpu_task *chosen_task = NULL, *task, *nexttask;
 	unsigned workerid = starpu_worker_get_id_check();
 	int skipped = 0;
@@ -202,7 +202,7 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 
 	/* block until some event happens */
 	STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 
 	/* Here helgrind would shout that this is unprotected, this is just an
 	 * integer access, and we hold the sched mutex, so we can not miss any
@@ -278,7 +278,7 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 		/* Tell pushers that we are waiting for tasks for us */
 		starpu_bitmap_set(data->waiters, workerid);
 
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 
 	if(chosen_task)
@@ -295,7 +295,7 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 		}
 		_starpu_sched_ctx_unlock_write(sched_ctx_id);
 	}
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 
 	return chosen_task;
 }

+ 2 - 2
src/sched_policies/graph_test_policy.c

@@ -321,9 +321,9 @@ static struct starpu_task *pop_task_graph_test_policy(unsigned sched_ctx_id)
 		return NULL;
 #endif
 
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 	if (!data->computed)
 	{
 		STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);

+ 4 - 4
src/sched_policies/heteroprio.c

@@ -467,9 +467,9 @@ static struct starpu_task *pop_task_heteroprio_policy(unsigned sched_ctx_id)
 		return NULL;
 	}
 #endif
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	STARPU_PTHREAD_MUTEX_LOCK(&hp->policy_mutex);
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 
 	/* keep track of the new added task to perfom real prefetch on node */
 	unsigned nb_added_tasks = 0;
@@ -612,7 +612,7 @@ done:		;
 
 	if(task)
 	{
-		_starpu_worker_enter_section_safe_for_observation();
+		_starpu_worker_relax_on();
 		_starpu_sched_ctx_lock_write(sched_ctx_id);
 		unsigned child_sched_ctx = starpu_sched_ctx_worker_is_master_for_child_ctx(workerid, sched_ctx_id);
 		if(child_sched_ctx != STARPU_NMAX_SCHED_CTXS)
@@ -622,7 +622,7 @@ done:		;
 			task = NULL;
 		}
 		_starpu_sched_ctx_unlock_write(sched_ctx_id);
-		_starpu_worker_leave_section_safe_for_observation();
+		_starpu_worker_relax_off();
 		return task;
 	}
 

+ 4 - 4
src/sched_policies/parallel_eager.c

@@ -179,7 +179,7 @@ static int push_task_peager_policy(struct starpu_task *task)
 
 static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 {
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	struct _starpu_peager_data *data = (struct _starpu_peager_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	int workerid = starpu_worker_get_id_check();
@@ -189,7 +189,7 @@ static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 	{
 		struct starpu_task *task = NULL;
 		STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-		_starpu_worker_leave_section_safe_for_observation();
+		_starpu_worker_relax_off();
 		task = _starpu_fifo_pop_task(data->fifo, workerid);
 		STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 
@@ -206,7 +206,7 @@ static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 	{
 		/* The worker is a master */
 		STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-		_starpu_worker_leave_section_safe_for_observation();
+		_starpu_worker_relax_off();
 		task = _starpu_fifo_pop_task(data->fifo, workerid);
 		STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 
@@ -285,7 +285,7 @@ static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 	{
 		/* The worker is a slave */
 		STARPU_PTHREAD_MUTEX_LOCK(&data->policy_mutex);
-		_starpu_worker_leave_section_safe_for_observation();
+		_starpu_worker_relax_off();
 		task = _starpu_fifo_pop_task(data->local_fifo[workerid], workerid);
 		STARPU_PTHREAD_MUTEX_UNLOCK(&data->policy_mutex);
 	}

+ 7 - 7
src/sched_policies/work_stealing_policy.c

@@ -535,7 +535,7 @@ static struct starpu_task *ws_pop_task(unsigned sched_ctx_id)
 
 	if (task)
 	{
-		_starpu_worker_enter_section_safe_for_observation();
+		_starpu_worker_relax_on();
 		_starpu_sched_ctx_lock_write(sched_ctx_id);
 		/* there was a local task */
 		ws->per_worker[workerid].busy = 1;
@@ -548,16 +548,16 @@ static struct starpu_task *ws_pop_task(unsigned sched_ctx_id)
 			task = NULL;
 		}
 		_starpu_sched_ctx_unlock_write(sched_ctx_id);
-		_starpu_worker_leave_section_safe_for_observation();
+		_starpu_worker_relax_off();
 		return task;
 	}
 
 	/* While stealing, relieve mutex used to synchronize with pushers */
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 
 	/* we need to steal someone's job */
 	int victim = ws->select_victim(ws, sched_ctx_id, workerid);
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 	if (victim == -1)
 	{
 		return NULL;
@@ -595,7 +595,7 @@ static struct starpu_task *ws_pop_task(unsigned sched_ctx_id)
 	}
 #endif
 
-	_starpu_worker_enter_section_safe_for_observation();
+	_starpu_worker_relax_on();
 	if (task)
 	{
 		_starpu_sched_ctx_lock_write(sched_ctx_id);
@@ -605,12 +605,12 @@ static struct starpu_task *ws_pop_task(unsigned sched_ctx_id)
 			starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx, 1, 1);
 			starpu_sched_ctx_revert_task_counters(sched_ctx_id, task->flops);
 			_starpu_sched_ctx_unlock_write(sched_ctx_id);
-			_starpu_worker_leave_section_safe_for_observation();
+			_starpu_worker_relax_off();
 			return NULL;
 		}
 		_starpu_sched_ctx_unlock_write(sched_ctx_id);
 	}
-	_starpu_worker_leave_section_safe_for_observation();
+	_starpu_worker_relax_off();
 	ws->per_worker[workerid].busy = !!task;
 	return task;
 }