Переглянути джерело

Do not test for task->cl == NULL on each re-push of a task, it only needs to be tested once

Samuel Thibault 12 роки тому
батько
коміт
cb68183de2
1 змінених файлів з 10 додано та 10 видалено
  1. 10 10
      src/core/sched_policy.c

+ 10 - 10
src/core/sched_policy.c

@@ -350,6 +350,16 @@ int _starpu_push_task(struct _starpu_job *j)
 		}
 	}
 
+	/* in case there is no codelet associated to the task (that's a control
+	 * task), we directly execute its callback and enforce the
+	 * corresponding dependencies */
+	if (task->cl == NULL)
+	{
+		_starpu_handle_job_termination(j);
+		_STARPU_LOG_OUT_TAG("handle_job_termination");
+		return 0;
+	}
+
 	ret = _starpu_push_task_to_workers(task);
 	if (ret == -EAGAIN)
 		/* pushed to empty context, that's fine */
@@ -383,16 +393,6 @@ int _starpu_push_task_to_workers(struct starpu_task *task)
 
 	struct _starpu_job *j = _starpu_get_job_associated_to_task(task);
 
-	/* in case there is no codelet associated to the task (that's a control
-	 * task), we directly execute its callback and enforce the
-	 * corresponding dependencies */
-	if (task->cl == NULL)
-	{
-		_starpu_handle_job_termination(j);
-		_STARPU_LOG_OUT_TAG("handle_job_termination");
-		return 0;
-	}
-
 	int ret;
 	if (STARPU_UNLIKELY(task->execute_on_a_specific_worker))
 	{