浏览代码

Optimise dmdas in the case where all tasks have the same priority

Samuel Thibault 8 年之前
父节点
当前提交
d33a58793f
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      src/sched_policies/fifo_queues.c

+ 17 - 0
src/sched_policies/fifo_queues.c

@@ -82,6 +82,14 @@ _starpu_fifo_get_exp_len_prev_task_list(struct _starpu_fifo_taskq *fifo_queue, s
 		struct starpu_task *current = list->head;
 		struct starpu_task *prev = NULL;
 
+		if (list->head->priority == task->priority &&
+		    list->head->priority == list->tail->priority)
+		{
+			/* They all have the same priority, the task's place is at the end */
+			prev = list->tail;
+			current = NULL;
+		}
+		else
 		while (current)
 		{
 			if (current->priority < task->priority)
@@ -128,6 +136,15 @@ _starpu_fifo_push_sorted_task(struct _starpu_fifo_taskq *fifo_queue, struct star
 		task->prev = NULL;
 		task->next = NULL;
 	}
+	else if (list->head->priority == task->priority &&
+		 list->head->priority == list->tail->priority)
+	{
+		/* They all have the same priority, just put at the end */
+		list->tail->next = task;
+		task->next = NULL;
+		task->prev = list->tail;
+		list->tail = task;
+	}
 	else
 	{
 		struct starpu_task *current = list->head;