|
@@ -148,30 +148,34 @@ static void block_sync_task(job_t j)
|
|
|
job_delete(j);
|
|
|
}
|
|
|
|
|
|
-/* application should submit new tasks to StarPU through this function */
|
|
|
-int starpu_submit_task(struct starpu_task *task)
|
|
|
-{
|
|
|
- int ret;
|
|
|
- unsigned is_sync = task->synchronous;
|
|
|
|
|
|
- STARPU_ASSERT(task);
|
|
|
-
|
|
|
- if (!worker_exists(task->cl->where))
|
|
|
- return -ENODEV;
|
|
|
+/* This function is called when a new task is submitted to StarPU
|
|
|
+ * it returns 1 if the task deps are not fulfilled, 0 otherwise */
|
|
|
+static unsigned enforce_task_deps(job_t j)
|
|
|
+{
|
|
|
+ if (j->task->use_tag)
|
|
|
+ {
|
|
|
+ unsigned deps_are_not_fulfilled;
|
|
|
+ struct tag_s *tag = j->tag;
|
|
|
+ deps_are_not_fulfilled = (tag->state == BLOCKED);
|
|
|
|
|
|
- /* internally, StarPU manipulates a job_t which is a wrapper around a
|
|
|
- * task structure */
|
|
|
- job_t j = job_create(task);
|
|
|
+ return deps_are_not_fulfilled;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /* this task does not use tags, so we can go on */
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+static enforce_deps_and_schedule(job_t j)
|
|
|
+{
|
|
|
/* enfore task dependencies */
|
|
|
if (task->use_tag)
|
|
|
{
|
|
|
- if (submit_job_enforce_task_deps(j))
|
|
|
+ if (enforce_task_deps(j))
|
|
|
{
|
|
|
j->tag->is_submitted = 1;
|
|
|
-
|
|
|
- if (is_sync)
|
|
|
- block_sync_task(j);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -182,14 +186,28 @@ int starpu_submit_task(struct starpu_task *task)
|
|
|
#ifdef NO_DATA_RW_LOCK
|
|
|
/* enforce data dependencies */
|
|
|
if (submit_job_enforce_data_deps(j))
|
|
|
- {
|
|
|
- if (is_sync)
|
|
|
- block_sync_task(j);
|
|
|
return 0;
|
|
|
- }
|
|
|
#endif
|
|
|
|
|
|
ret = push_task(j);
|
|
|
+}
|
|
|
+
|
|
|
+/* application should submit new tasks to StarPU through this function */
|
|
|
+int starpu_submit_task(struct starpu_task *task)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ unsigned is_sync = task->synchronous;
|
|
|
+
|
|
|
+ STARPU_ASSERT(task);
|
|
|
+
|
|
|
+ if (!worker_exists(task->cl->where))
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ /* internally, StarPU manipulates a job_t which is a wrapper around a
|
|
|
+ * task structure */
|
|
|
+ job_t j = job_create(task);
|
|
|
+
|
|
|
+ enforce_deps_and_schedule(j);
|
|
|
|
|
|
if (is_sync)
|
|
|
block_sync_task(j);
|