Kaynağa Gözat

Fix performance loss due to multiple implementation support: introduce _starpu_fifo_pop_local_task which does not check (again) that the task can run on the worker

Samuel Thibault 12 yıl önce
ebeveyn
işleme
2b3cd2ad78

+ 2 - 2
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2012  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
@@ -150,7 +150,7 @@ static struct starpu_task *dmda_pop_task(void)
 	int workerid = starpu_worker_get_id();
 	struct _starpu_fifo_taskq *fifo = queue_array[workerid];
 
-	task = _starpu_fifo_pop_task(fifo, workerid);
+	task = _starpu_fifo_pop_local_task(fifo);
 	if (task)
 	{
 		double model = task->predicted;

+ 18 - 1
src/sched_policies/fifo_queues.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2012  Université de Bordeaux 1
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  *
@@ -94,6 +94,23 @@ struct starpu_task *_starpu_fifo_pop_task(struct _starpu_fifo_taskq *fifo_queue,
 	return NULL;
 }
 
+/* This is the same as _starpu_fifo_pop_task, but without checking that the
+ * worker will be able to execute this task. This is useful when the scheduler
+ * has already checked it. */
+struct starpu_task *_starpu_fifo_pop_local_task(struct _starpu_fifo_taskq *fifo_queue)
+{
+	struct starpu_task *task = NULL;
+
+	if (!starpu_task_list_empty(&fifo_queue->taskq))
+	{
+		task = starpu_task_list_pop_back(&fifo_queue->taskq);
+		fifo_queue->ntasks--;
+		_STARPU_TRACE_JOB_POP(task, 0);
+	}
+
+	return task;
+}
+
 /* pop every task that can be executed on the calling driver */
 struct starpu_task *_starpu_fifo_pop_every_task(struct _starpu_fifo_taskq *fifo_queue, pthread_mutex_t *sched_mutex, int workerid)
 {

+ 2 - 1
src/sched_policies/fifo_queues.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2012  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -47,6 +47,7 @@ int _starpu_fifo_empty(struct _starpu_fifo_taskq *fifo);
 int _starpu_fifo_push_task(struct _starpu_fifo_taskq *fifo, pthread_mutex_t *sched_mutex, pthread_cond_t *sched_cond, struct starpu_task *task);
 
 struct starpu_task *_starpu_fifo_pop_task(struct _starpu_fifo_taskq *fifo, int workerid);
+struct starpu_task *_starpu_fifo_pop_local_task(struct _starpu_fifo_taskq *fifo);
 struct starpu_task *_starpu_fifo_pop_every_task(struct _starpu_fifo_taskq *fifo, pthread_mutex_t *sched_mutex, int workerid);
 
 #endif // __FIFO_QUEUES_H__